4

What is the typical amount of RAM needed to store a smart contract?

Can you give some examples and their RAM sizes?

1
  • 1
    Here is an example: "the cost to deploy eosio.token is 186.335 Kb" steemit.com/eos/@leordev/… You can recreate this experiment with any contract by launching it to the testnet and assessing the RAM consumption difference.
    – Nat
    Commented Jul 26, 2018 at 16:21

1 Answer 1

6

For some examples, you can check the sizes of the wasm files in EOSIO contracts (sizes are approximate):

$ ls -l eos/build/contracts/* | grep wasm | awk 'BEGIN {print "SIZE \t NAME"} {sum+= $5; n++; print $5/100"KB " $NF} END {print "average: " sum/n/100"KB"}'

SIZE     NAME
44.05KB asserter.wasm
345.34KB dice.wasm
59.9KB eosio.bios.wasm
217.36KB eosio.msig.wasm
31.47KB eosio.sudo.wasm
1163.96KB eosio.system.wasm
189.65KB eosio.token.wasm
721.87KB exchange.wasm
30.42KB hello.wasm
234.83KB identity.wasm
3.71KB infinite.wasm
158.93KB multi_index_test.wasm
49.7KB noop.wasm
29.34KB payloadless.wasm
163.42KB proxy.wasm
65.67KB simple.token.wasm
244.44KB stltest.wasm
897.36KB test_api.wasm
300.91KB test_api_db.wasm
140.09KB test_api_mem.wasm
756.55KB test_api_multi_index.wasm
54.43KB test.inline.wasm
108.23KB test_ram_limit.wasm
134.42KB tic_tac_toe.wasm
average: 256.085KB

So I would say the typical size is 200-300KB, but it can go much lower or much higher.

Note that I'm dividing by 100 instead of 1000 because the mainnet is set to take up RAM space 10x the size of the WASM binary

2
  • 1
    mainnet is set to take up 10x size of wasm? which set is this? and why would it set this way? thanks~ Commented Sep 10, 2018 at 17:37
  • @JohnnyZhao see this answer
    – confused00
    Commented Oct 10, 2018 at 20:25

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.