I want to collect user data and store it on the blockchain. Let's say I need to store usernames. Is the cost of storing 1 byte on the blockchain different for contract storage/log data/transaction input?

1 Answer 1


Contract storage is the most expensive at generally 20,000 gas for each 32 bytes (which is 1 storage slot).

Logs cost 375 gas for a LOG operation. 375 gas for each topic. 8 gas for each byte of a LOG operation's data. See Ethereum event log maximum size for more information.

Transaction input costs 4 gas for a zero byte, and 68 gas for a non-zero byte.

Important consideration: Does the data need to be accessible directly by contracts? If so, contract storage is the only option: contracts can't directly access logs or other transactions.

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.