0

I have a smart contract compiled resulting in a 10,961 Bytes wasm file and a 2,372 Bytes abi file. However, when deploying the contract on chain it consumes about 110,000 Bytes which is almost 10x the wasm+abi file.

Why is the on chain RAM consumption so much higher than what the binary files consume on my hard drive?

How can I estimate/calculate the on chain RAM usage of a compiled smart contract before deploying it?

1 Answer 1

2

Deploying contract is done by two actions, eosio::setcode for wasm, and eosio::setabi for abi. setcode costs 10x the size of wasm file, but setabi costs the exact size of abi file.

1
  • 1
    But why does setcode consume 10 times of the size of the wasm file? Doesn't a normal c/c++ library/executable only consume as much RAM as their filesize? Why is that different for wasm/eosio? Thanks for the info so far. Apr 24, 2021 at 7:52

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.