Search code examples
blockchainethereumsoliditysmartcontracts

Is it possible to store images on the Ethereum blockchain?


I'm ramping up on learning Solidity, and have some ideas. At the moment I am curious if files/images can be put on the blockchain. I'm thinking an alternative would be some hybrid approach where some stuff is on the blockchain, and some stuff is in a more traditional file storage and uses address references to grab it. One issue I foresee is gas price of file uploads.


Solution

  • Is it possible to store images on the Ethereum blockchain?

    It's absolutely possible!

    Should you do it? Almost certainly not!

    One issue I foresee is gas price of file uploads.

    • The cost of data storage is 640k gas per kilobyte of data.
    • The current gas price is approximately 15 Gwei (or 0.000000015 ETH).
    • At today's price, 1 ETH is approximately $200.

    That works out at just under $2 per kilobyte.

    It's not for me to tell you if this is too expensive for your application, but you should also consider that the price of both Gas and Ether vary dramatically over time, and you should expect to experience periods when this number will be significantly higher.