It is possible to read json value from ipfs file in solidity contract?

  • 1
    A contract cannot interact directly with anything outside the blockchain. You'll need an oracle that sends the Ipfs file to the contract. Also you should consider that any processing involving strings will be expensive.
    – Ismael
    Commented Feb 18, 2022 at 15:13

1 Answer 1


This is entirely impossible. Solutions that would come the closest are: relying on oracles to feed in off-chain data, or, having the json data be created on-chain.

  • I want to have information about game items, e.g. in json to use in contract. How to do this? Arrays? This is big amount of items (10k)
    – Blendered
    Commented Feb 18, 2022 at 15:34
  • 1
    Projects have implemented optimised gamified contracts by storing a uint256 as a tokens dna. Best example is to look at cryptozombies.io If you are looking to use this information in a contract, it must be on-chain. You can then either have the metadata json be created on-chain in the tokenURI function, or retroactively create the metadata (uploaded to ipfs) to match the on-chain information or set up a web-server that will dynamically server metadata jsons by reading on-chain data.
    – phaze
    Commented Feb 18, 2022 at 15:49
  • so how to get information from token metadata?
    – Blendered
    Commented Feb 18, 2022 at 18:46

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.