0

In other words, can a contract initiate a transaction by itself, without someone activating it's code? An example would be if a contract can do that when times eg. reaches a specific point.

1

1 Answer 1

0

In other words, can a contract initiate a transaction by itself, without someone activating his code?

No.

Smart contracts are not autonomous, their behavior is triggered by signed public transactions broadcast on the network by Externally Owned Accounts (EOA), basically an entity holding a private key. To 'initiate' (i.e., send) a transaction you need a private key, and autonomy. Smart contract cannot keep a private key private since they are stored on the public blockchain, therefore they can only be reactive in the current form of Ethereum and blockchain more generally.

tx.origin cannot be a smart contract by definition.

To automate smart contract behaviors several services already exist, the most famous one is arguably Chainlink keepers. It basically sends a transaction from an EOA when required.

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.