contract A {
   function one() public {
      //transfer to B to call its fallback function

contract B {
   function() external payable {

In reality, is it impossible to do so? Otherwise, if I create an empty B's fallback function then it works. Or if I create simple function with someaddress.transfer(msg.value); and call this function from contract A as B(address).someFunction.value(value)() then it also works.


The thing is that the transfer method allows for 2300 gas stipend. Because the fallback has a transfer again, 2300 won't be enough. You can use


which will pass all the available gas or you can do:


Hope this helps

| improve this answer | |

You can decide how much gas you give to the transfer.

The basic transfer or send give a default gas of only 2300 which is not enough for almost anything - you can just emit a log event and that's about it.

But if you use the pattern of recipient.call.value(1)() you can specify the amount of gas you pass to the recipient. You can read more for example here: https://ethereum.stackexchange.com/a/5993/31933

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.