If I want to store abi in contract, which type can be use? and How can I get it later.

For example, if I use bytes to store a contract's abi. How can I use JSON.parse to get it. I have not find a proper api in web3.

  • I don't see any reason why you would want to store an ABI in a contract. ABI is for interacting with a contract from a node and it's not needed inside the blockchain. Furthermore, storing it in bytes would cost you a lot of gas. Commented Oct 3, 2019 at 13:40
  • 1
    Suggestion: verify the contract on Etherscan, and it will store its ABI for you. Commented Oct 3, 2019 at 14:19
  • 1
    It seems to me that string would be most appropriate.
    – user19510
    Commented Oct 3, 2019 at 16:09


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.