I'd like to build some code that monitors a wallet address, and performs an action whenever that wallet receives a transaction.

I could do this with say javascript or whatever, but that doesn't offer any guarantees to people that I will actually run it. Hence my desire to look into smart contracts or the like for this, where a contract is published to the blockchain and people can verify that it will run, so when they submit their transaction to the wallet address, the expectated behaviour will occur.

  • No. You'll need to monitor the address from an off-chain script, and invoke your contract function whenever it receives a transaction. Alternatively, you can implement a payable function in your contract, which takes this address as a parameter, and then do whatever it is you want to do. So you'll get the desired behavior, but only when people choose to transfer funds via your designated payable function. If they do it in the "standard" way, then your contract will have no knowledge about it. Commented Feb 4, 2019 at 10:15
  • Thanks for the quick response. Do you know if there are any ethereum alternatives that encode such behaviour? I guess assigning an immutable contract to a wallet upon its creation, that persists for its lifetime.
    – balupton
    Commented Feb 4, 2019 at 10:17
  • No. The Ethereum block-chain is "passive" by nature. You cannot get it to "automatically run" in response to something. Every operation is initiated explicitly (by miners). Commented Feb 4, 2019 at 10:19

1 Answer 1


To add to goodvibration's answer, I'm not what you're trying to achieve exactly, but you can trigger code with a fallback function - as in a user will just send eth, and the code will execute, without having to manually call any functions - but you have to set that up, you don't add that to a pre-existing address. But you can definitely create a wallet that, upon installation/initiation, creates a personal version of a contract that includes a fallback function (however they will need some eth to initiate this because creating the contract every time requires gas).

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.