Check our github https://github.com/irespo/irespo/tree/master/irespo/iresporemove I did a sample contract with one empty action, but it is still 30 KB. I tried a contract without action, but did not work. Anyone has ideas how to optimize it?
1 Answer
Update 19th September: As of v1.3.0, it is now possible to delete the smart contract from an account using the --clear
flag ($ cleos set contract <account> --clear
)
To make a small contract, I suggest not using cpp
or eosiocpp
/eosio-cpp
at all. The smallest contract I managed to upload on chain takes 0.392 KiB and it's written in webassembly:
contract.wast
(module
(export "apply" (func $apply))
(func $apply (param $0 i64) (param $1 i64) (param $2 i64))
)
contract.abi
{
"____comment": "",
"version": "eosio::abi/1.0",
"types": [],
"structs": [],
"actions": [],
"tables": [],
"ricardian_clauses": [],
"error_messages": [],
"abi_extensions": []
}
Use wat2wasm
binary from here to convert the wast
file into a wasm
binary that will take up 38 bytes. When you upload it on the chain, 38 bytes * 10 = 0.38 KB which is a decrease of almost 99% in size and costs from 30KB.
-
Can you recommend any good sources to learn web assembly? Aug 17, 2018 at 21:43
-
1@PhillipHamnett i'm probably not the best person to answer this as i'm still in the process of learning wasm myself, but i just used this page for finding resources Aug 17, 2018 at 22:26