How would I calculate how much it would cost to store the string "hello world" on an Ethereum block? Would this be more or less than a transaction fee?


I suppose it depends how you store it. A single SSTORE opcode can store 32 bytes, which is enough to store "hello world." An SSTORE operation costs 20,000 gas if it's storing a non-zero value where a zero used to be.

The base gas used in a transaction (before any code is executed) is 21,000, so it would roughly double the cost of the transaction.

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.