0

Let say I have a code that print "Hello World". I deploy it to the blockchain and pay 1000 gas for it. Will my code keep running for every subsequent block till it runs out of gas? Or will it only run when other user interact with it?

1

Your code only runs when somebody sends it a transaction, using the gas sent with that transaction. A transaction is executed as part of a block.

PS. The resource the EVM controls is basically a shared database. It doesn't have a console, so you can't print "Hello World". But you could write "Hello World" to storage, or to the event log.

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