I want to make a smart contract that wraps over other various smart contracts.

In some of these contracts the user needs to send the transaction themselves. Is it possible to make a smart contract send transactions on behalf of the caller?

1 Answer 1


Sort of.

Yes, contracts can send messages to other contracts. They can do so because an externally owned account signed a transaction. For example (simplified):

contract Helper {    

// a bunch of initialization stuff ... 

function doStuff() public {

In the context of contractA and contractB, the msg.sender is Helper, not the signer of the transaction sent to Helper.doStuff().

Helper can't impersonate the original signer for the same reason that Alice can't spend Bob's money. From the perspective of contractA and contractB, Helper is just another user with no (more precisely, very few) distinguishing properties.

There are some common patterns for working within these constraints. For example, it can work like an Escrow agent, so users actually transfer in the assets they want the contract to manage for them.

If you're actually writing contractA and contractB then you have more control over the design, so you can pass the user's address in:

In contractA ...

  function aFunction(address user) public onlyAuthorized {
    // In this context, "msg.sender" is the calling contract and there is access control so only the trusted contract has this privilege.
    // address "user" is the user the trusted contract passed in which could be the original signer.

Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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