Transfer the gas value of contract to my own address

0 votes

What happens ?

    msg.sender.transfer(msg.value);

remix.eth is just telling me

errored: Cannot read property 'op' of undefined

Oct 10, 2018 in Blockchain by digger
• 26,740 points
438 views

1 answer to this question.

0 votes

Works fine for me:

pragma solidity ^0.4.0;

contract Test {

    function () payable {
        msg.sender.transfer(msg.value);
    }

}

I get invalid opcode if I don't specify the function is payable.

answered Oct 10, 2018 by Omkar
• 69,230 points

Related Questions In Blockchain

0 votes
1 answer

What if Gas required in my program exceeds the limit of 3000000?

Going through your code, I noticed that  you ...READ MORE

answered May 29, 2018 in Blockchain by Perry
• 17,100 points
682 views
0 votes
1 answer

How do I send back ethers to the sender of the tokens in a smart contract?

Whenever a smart contract receives ether via ...READ MORE

answered May 30, 2018 in Blockchain by Perry
• 17,100 points
3,476 views
0 votes
1 answer

How to limit execution of smart contract only to my dapp?

You can use modifiers to do it ...READ MORE

answered Jul 17, 2018 in Blockchain by digger
• 26,740 points
542 views
0 votes
1 answer

How to get the current state of a smart contract?

Hey, you gotta provide the contract code, and ...READ MORE

answered Aug 1, 2018 in Blockchain by Perry
• 17,100 points
963 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,780 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,304 views
0 votes
1 answer

Solidity geth: Error encountered during contract execution [Bad instruction]

recipes is a dynamic storage array. You need ...READ MORE

answered Oct 15, 2018 in Blockchain by Omkar
• 69,230 points
1,320 views
0 votes
1 answer

Is the msg.sender address changed while passing to another contract as a parameter?

I tried your contracts in Remix, but ...READ MORE

answered Oct 10, 2018 in Blockchain by Omkar
• 69,230 points
1,250 views
+1 vote
4 answers

How to estimate the cost for deploying smart contract on mainnet?

Since you have already deployed the contract ...READ MORE

answered Apr 10, 2018 in Blockchain by Shashank
• 10,400 points
15,039 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP