How to retrieve on-chain large-sized data

Franck Dupont
OpenGem • GEM score
4 min readJul 28, 2022


Here is a tutorial on retrieving large-sized data on an EVM blockchain (e.g. Ethereum, Polygon, Avalanche…) according to the OpenGem standard.

Before starting, let’s see the practice’s overview of storing image on-chain:

  • An NFT contract owner wants to store an image on-chain
  • The idea is to store the image on-chain without paying so much gas
  • To do so, instead of storing it in the contract, he should store it in the header of the next validated block
  • He can do that by emitting an event and storing the hash of the transaction that emitted it into the smart contract

To go deeper into this philosophy, you should jump to this great article: “Smart contracts are not databases”

Example of NFT Biarritz 2022 Ticket

Let’s take the NFT Biarritz 2022 Ticket:

NFT Biarritz 2022 ticket
NFT Biarritz 2022 Ticket

NFT Biarritz organisers choose to store a preview image on-chain to offer a backup to owners.

Here is the contract:

1. Getting the transaction that stored the data

The first step is to find the transaction that stored the image. According to OpenGem standards, it needs to be stored on the NFT smart-contract.

Let’s jump into Etherscan to browse the NFT Biarritz contract, and click on Contract > Read Contract tabs :

Scroll a little bit, and you’ll see all the possible actions you can have on the contract.

Let’s find the transaction we are looking for at function n°35 “txHashImgData”

Copy the transaction and jump into the details by visiting:

2. Retrieving the JPG image

Now, let’s click on “Logs” tab and see what is written in “Data” :

Congrats! You just found out the image’s fingerprint! We need now to translate it to get the jpeg format.

Let’s copy this biiiiiig string. Actually, this is a hexadecimal format. We need now to translate it to base64: by typing “hex to base64” on Google, you’ll find lot a tools like

Copy it, convert it, and copy the result :

Ok now we need to convert the Base64 string into an image. Let’s type “base64 to image” on Google. Oh cool, same tool. Let’s use it:

Et voilà! We can say NFT Biarritz offers a nice way to have an image backup if IPFS or Arweave just get down for any reason.

Take care of our planet

Getting a low definition on-chain is a great way to take care of the planet and not congest the chain. Here, we’re talking about a backup, not the NFT value itself.

If you need the high-definition image of NFT Biarritz ticket, let’s use the IPFS or Arweave hash provided in the contract. They are great decentralized protocol:

You can get it there :

To learn more about OpenGem standards, I suggest you to jump into the scoring system published there: