EOS RAM and Bandwith Analysis: Airdropping steps on Junglenet
eos·@leordev·
0.000 HBDEOS RAM and Bandwith Analysis: Airdropping steps on Junglenet
I was studying about EOS RAM Allocation, CPU and NET bandwith and I was wondering about how much it costs to organize a real airdrop. So I just came up with this small experiment in Jungle testnet which can be totally adapted to Mainnet, because the storage and bandwith are the same you can just adjust the current EOS and RAM prices. It's actually super simple to Airdrop a token in EOS <3 1. Create an account for your smart contract 1. Download the official [`eosio.token` from eos repository]( https://github.com/EOSIO/eos/tree/013c282edb3513078c573d4feb626403778af954/contracts/eosio.token) 1. Compile and deploy it to your contract 1. Create your token symbol and supply 1. Start issuing tokens I'm going to cover all the above steps below, let's go!  _Getty Images_ ## Default Account creation on Junglenet Created account `eosairdroper` from http://dev.cryptolions.io/#account Here's the initial account balance and stake stats: ``` $ cleos get account eosairdroper permissions: owner 1: 1 EOS84uT4DBAJQpagWDfZPbk2hd9aaH8ZGZUxHTrpdjCqCzMEVP8cB active 1: 1 EOS84uT4DBAJQpagWDfZPbk2hd9aaH8ZGZUxHTrpdjCqCzMEVP8cB memory: quota: 623.2 Kb used: 3.365 Kb net bandwidth: staked: 100.0000 EOS (total stake delegated from account to self) delegated: 0.0000 EOS (total staked delegated to account from others) used: 0 bytes available: 19.29 Mb limit: 19.29 Mb cpu bandwidth: staked: 100.0000 EOS (total stake delegated from account to self) delegated: 0.0000 EOS (total staked delegated to account from others) used: 0 us available: 3.862 sec limit: 3.862 sec ``` ## Deploying the `eosio.token` contract Simple deploy from original EOS Repo without any changes: ``` $ cleos set contract eosairdroper ~/eos/build/contracts/eosio.token ~/eos/build/contracts/eosio.token/eosio.token.wast ~/eos/build/contracts/eosio.token/eosio.token.abi Reading WAST/WASM... Assembling WASM... Publishing contract... executed transaction: d4025c7627d3a8334451ca382be86867eed55f2a442205ac269db8d4228554ca 8496 bytes 3203 us # eosio <= eosio::setcode {"account":"eosairdroper","vmtype":0,"vmversion":0,"code":"0061736d01000000017e1560037f7e7f0060057f7... # eosio <= eosio::setabi {"account":"eosairdroper","abi":"0e656f73696f3a3a6162692f312e30010c6163636f756e745f6e616d65046e616d6... # >>>> checking account stats <<<< $ cleos get account eosairdroper permissions: owner 1: 1 EOS84uT4DBAJQpagWDfZPbk2hd9aaH8ZGZUxHTrpdjCqCzMEVP8cB active 1: 1 EOS84uT4DBAJQpagWDfZPbk2hd9aaH8ZGZUxHTrpdjCqCzMEVP8cB memory: quota: 623.2 Kb used: 189.7 Kb net bandwidth: staked: 100.0000 EOS (total stake delegated from account to self) delegated: 0.0000 EOS (total staked delegated to account from others) used: 8.298 Kb available: 19.28 Mb limit: 19.29 Mb cpu bandwidth: staked: 100.0000 EOS (total stake delegated from account to self) delegated: 0.0000 EOS (total staked delegated to account from others) used: 1.817 ms available: 3.86 sec limit: 3.862 sec ``` Balance stats: - Used RAM: 186.335 Kb (From 3.365 Kb, To 189.7 Kb) - Used NET: 8.298 Kb (From 0 Kb, To 8.298 Kb) - Used CPU: 1.817 ms (From 0 ms, To 1.817 ms) Yeah, the cost to deploy `eosio.token` is 186.335 Kb with today's version! Ok, the fun begins... Let's create a token! ## Creating a token Default token, 1 billion supply and four decimals exactly like EOS. ``` $ cleos push action eosairdroper create '[ "eosairdroper", "1000000000.0000 TOKEN", 0, 0, 0]' -p eosairdroper executed transaction: 7123c8e34853205b9176a8d02526a570f32e908212f0a3eff7e9dd9544803101 120 bytes 738 us # eosairdroper <= eosairdroper::create {"issuer":"eosairdroper","maximum_supply":"1000000000.0000 TOKEN"} # >>>> checking account stats <<<< $ cleos get account eosairdroper permissions: owner 1: 1 EOS84uT4DBAJQpagWDfZPbk2hd9aaH8ZGZUxHTrpdjCqCzMEVP8cB active 1: 1 EOS84uT4DBAJQpagWDfZPbk2hd9aaH8ZGZUxHTrpdjCqCzMEVP8cB memory: quota: 623.2 Kb used: 190 Kb net bandwidth: staked: 100.0000 EOS (total stake delegated from account to self) delegated: 0.0000 EOS (total staked delegated to account from others) used: 8.314 Kb available: 19.28 Mb limit: 19.29 Mb cpu bandwidth: staked: 100.0000 EOS (total stake delegated from account to self) delegated: 0.0000 EOS (total staked delegated to account from others) used: 2.656 ms available: 3.859 sec limit: 3.862 sec ``` Balance stats: - Used RAM: 0.3 Kb (From 189.7 Kb, To 190 Kb) - Used NET: 0.016 Kb (From 8.298 Kb, To 8.314 Kb) - Used CPU: 0.839 ms (From 1.817 ms, To 2.656 ms) Neat! To create a token we spent very little resources, almost nothing... ## Issuing some Tokens Now let's airdrop some tokens! I'm using some random accounts from the official snapshot (sorry if you are one of them): account | snapshot balance --- | --- gm4domrtgqge | 12.6521 EOS gu2dkmztgage | 606.0000 EOS gu2dgmrrguge | 6233.0000 EOS gu2dgmrshege | 15000.9383 EOS ge3tgmzxhege | 172150.0000 EOS ``` cleos push action eosairdroper issue '["gu2dgmrshege", "15000.9383 TOKEN", "airdrop"]' -p eosairdroper executed transaction: f81bf85f5fe51e2bb78e8f3398e384b17587d1abb21255ca4e5dc64874fac263 128 bytes 2467 us # eosairdroper <= eosairdroper::issue {"to":"gu2dgmrshege","quantity":"15000.9383 TOKEN","memo":"airdrop"} # eosairdroper <= eosairdroper::transfer {"from":"eosairdroper","to":"gu2dgmrshege","quantity":"15000.9383 TOKEN","memo":"airdrop"} # gu2dgmrshege <= eosairdroper::transfer {"from":"eosairdroper","to":"gu2dgmrshege","quantity":"15000.9383 TOKEN","memo":"airdrop"} cleos get account eosairdroper permissions: owner 1: 1 EOS84uT4DBAJQpagWDfZPbk2hd9aaH8ZGZUxHTrpdjCqCzMEVP8cB active 1: 1 EOS84uT4DBAJQpagWDfZPbk2hd9aaH8ZGZUxHTrpdjCqCzMEVP8cB memory: quota: 623.2 Kb used: 190.2 Kb net bandwidth: staked: 100.0000 EOS (total stake delegated from account to self) delegated: 0.0000 EOS (total staked delegated to account from others) used: 8.346 Kb available: 19.28 Mb limit: 19.29 Mb cpu bandwidth: staked: 100.0000 EOS (total stake delegated from account to self) delegated: 0.0000 EOS (total staked delegated to account from others) used: 3.787 ms available: 3.858 sec limit: 3.862 sec ``` Balance stats: - Used RAM: 0.2 Kb (From 190 Kb, To 190.2 Kb) - Used NET: 0.032 Kb (From 8.314 Kb, To 8.346 Kb) - Used CPU: 1.131 ms (From 2.656 ms, To 3.787 ms) ### More Tokens Issuing ``` cleos push action eosairdroper issue '["gu2dgmrrguge", "6233.0000 TOKEN", "airdrop"]' -p eosairdroper executed transaction: 26a0477eaa5147e454a0a2c4c436ae5d4b356deddc303d4a0ad43108c3480307 128 bytes 2122 us $ cleos get account eosairdroper permissions: owner 1: 1 EOS84uT4DBAJQpagWDfZPbk2hd9aaH8ZGZUxHTrpdjCqCzMEVP8cB active 1: 1 EOS84uT4DBAJQpagWDfZPbk2hd9aaH8ZGZUxHTrpdjCqCzMEVP8cB memory: quota: 623.2 Kb used: 190.4 Kb net bandwidth: staked: 100.0000 EOS (total stake delegated from account to self) delegated: 0.0000 EOS (total staked delegated to account from others) used: 7.506 Kb available: 19.28 Mb limit: 19.29 Mb cpu bandwidth: staked: 100.0000 EOS (total stake delegated from account to self) delegated: 0.0000 EOS (total staked delegated to account from others) used: 5.567 ms available: 3.856 sec limit: 3.862 sec $ cleosjn push action eosairdroper issue '["gu2dkmztgage", "606.0000 TOKEN", "airdrop"]' -p eosairdroper executed transaction: a642adfaf2a715e7bf9a8ecb2d9f8cd1cbc4925ffb7edbbbe1c78b77383de487 128 bytes 2291 us $ cleos get account eosairdroper permissions: owner 1: 1 EOS84uT4DBAJQpagWDfZPbk2hd9aaH8ZGZUxHTrpdjCqCzMEVP8cB active 1: 1 EOS84uT4DBAJQpagWDfZPbk2hd9aaH8ZGZUxHTrpdjCqCzMEVP8cB memory: quota: 623.2 Kb used: 190.7 Kb net bandwidth: staked: 100.0000 EOS (total stake delegated from account to self) delegated: 0.0000 EOS (total staked delegated to account from others) used: 7.443 Kb available: 19.28 Mb limit: 19.29 Mb cpu bandwidth: staked: 100.0000 EOS (total stake delegated from account to self) delegated: 0.0000 EOS (total staked delegated to account from others) used: 7.719 ms available: 3.854 sec limit: 3.862 sec cleos push action eosairdroper issue '["gm4domrtgqge", "12.6521 TOKEN", "airdrop"]' -p eosairdroper executed transaction: 6a9695ba0508bb967b08341794ba49a597276971d2c34f7178a06db089b39943 128 bytes 2326 us $ cleos get account eosairdroper permissions: owner 1: 1 EOS84uT4DBAJQpagWDfZPbk2hd9aaH8ZGZUxHTrpdjCqCzMEVP8cB active 1: 1 EOS84uT4DBAJQpagWDfZPbk2hd9aaH8ZGZUxHTrpdjCqCzMEVP8cB memory: quota: 623.2 Kb used: 190.9 Kb net bandwidth: staked: 100.0000 EOS (total stake delegated from account to self) delegated: 0.0000 EOS (total staked delegated to account from others) used: 7.561 Kb available: 19.28 Mb limit: 19.29 Mb cpu bandwidth: staked: 100.0000 EOS (total stake delegated from account to self) delegated: 0.0000 EOS (total staked delegated to account from others) used: 9.026 ms available: 3.853 sec limit: 3.862 sec ``` ### After 6 Hours sleep ZzZzz It looked like my net and cpu bandwith has reduced a little bit, perfect! ``` $ cleos push action eosairdroper issue '["ge3tgmzxhege", "172150.0000 TOKEN", "airdrop"]' -p eosairdroper executed transaction: 704ba42b779cbb7a77ca0160511c7178117c65700ec2da40f0579e3ecdaa6594 128 bytes 2375 us $ cleos get account eosairdroper permissions: owner 1: 1 EOS84uT4DBAJQpagWDfZPbk2hd9aaH8ZGZUxHTrpdjCqCzMEVP8cB active 1: 1 EOS84uT4DBAJQpagWDfZPbk2hd9aaH8ZGZUxHTrpdjCqCzMEVP8cB memory: quota: 623.2 Kb used: 191.2 Kb net bandwidth: staked: 100.0000 EOS (total stake delegated from account to self) delegated: 0.0000 EOS (total staked delegated to account from others) used: 6.129 Kb available: 19.2 Mb limit: 19.2 Mb cpu bandwidth: staked: 100.0000 EOS (total stake delegated from account to self) delegated: 0.0000 EOS (total staked delegated to account from others) used: 9.543 ms available: 3.835 sec limit: 3.845 sec ``` ### Big airdrop to B1 Testing a big amount Airdrop to b1 (not that they need it lol - usually this would go to the Airdrop team): ``` $ cleos push action eosairdroper issue '["b1", "100000000.0100 TOKEN", "airdrop"]' -p eosairdroper executed transaction: 8458b5f23d6764333db5ba2d8133cabe65265abf6ecf674810a8eb1de05e25f7 128 bytes 2540 us # eosairdroper <= eosairdroper::issue {"to":"b1","quantity":"100000000.0100 TOKEN","memo":"airdrop"} # eosairdroper <= eosairdroper::transfer {"from":"eosairdroper","to":"b1","quantity":"100000000.0100 TOKEN","memo":"airdrop"} # b1 <= eosairdroper::transfer {"from":"eosairdroper","to":"b1","quantity":"100000000.0100 TOKEN","memo":"airdrop"} $ cleos get account eosairdroper permissions: owner 1: 1 EOS84uT4DBAJQpagWDfZPbk2hd9aaH8ZGZUxHTrpdjCqCzMEVP8cB active 1: 1 EOS84uT4DBAJQpagWDfZPbk2hd9aaH8ZGZUxHTrpdjCqCzMEVP8cB memory: quota: 623.2 Kb used: 191.4 Kb net bandwidth: staked: 100.0000 EOS (total stake delegated from account to self) delegated: 0.0000 EOS (total staked delegated to account from others) used: 6.22 Kb available: 19.2 Mb limit: 19.2 Mb cpu bandwidth: staked: 100.0000 EOS (total stake delegated from account to self) delegated: 0.0000 EOS (total staked delegated to account from others) used: 11.66 ms available: 3.833 sec limit: 3.845 sec ``` ### No Memo Testing an airdrop with no memo to another random account `ge3dmgenesis: 1000.5425 EOS` - it reduced from 128 bytes to 120 bytes of net bandwith usage, no significative changes in cpu and didn't affect anything on RAM, AT ALL - Remember, from the `eosio.token` contract we don't store the memo anywhere. ``` cleos push action eosairdroper issue '["ge3dmgenesis", "1000.5425 TOKEN", ""]' -p eosairdroper executed transaction: 34d05c59c10049ae946ad4e66703bb42987d1a1ce248115f3bea4bb6b1120e7f 120 bytes 2387 us $ cleosjn get account eosairdroper permissions: owner 1: 1 EOS84uT4DBAJQpagWDfZPbk2hd9aaH8ZGZUxHTrpdjCqCzMEVP8cB active 1: 1 EOS84uT4DBAJQpagWDfZPbk2hd9aaH8ZGZUxHTrpdjCqCzMEVP8cB memory: quota: 623.2 Kb used: 191.6 Kb net bandwidth: staked: 100.0000 EOS (total stake delegated from account to self) delegated: 0.0000 EOS (total staked delegated to account from others) used: 6.275 Kb available: 19.2 Mb limit: 19.2 Mb cpu bandwidth: staked: 100.0000 EOS (total stake delegated from account to self) delegated: 0.0000 EOS (total staked delegated to account from others) used: 13.22 ms available: 3.831 sec limit: 3.845 sec ``` ## Results If we assume the above values as an approximated average (I would need to load a batch of a couple thousands accounts to make sure), these are the stats that we will need for a full airdrop based on the [official mainnet launch snapshot](https://github.com/eoscafe/eos-snapshot-validation): Stat | Avg / tx | Total 163,930 Accounts --- | --- | --- Net Bandwith | 128 bytes | 20.98 Mb Cpu Bandwith | ~2.36 ms | 386.87 sec RAM | 0.229 kb | 37,540 kb You will eventually want to remove some accounts like B1, exchanges and so on from the airdrop. Also these are other interesting stats from the genesis snapshot: Minimum EOS Balance | Number of Accounts --- | --- 0.0000 EOS | 163,930 1.0000 EOS | 162,106 5.0000 EOS | 148,624 10.0000 EOS | 137,950 100.0000 EOS | 84,979 ## Mainnet As of today's date, a couple hours ago we had an account creation with a RAM price of 0.015 EOS/Kb. So if you are planning an Airdrop now, with the official genesis snapshot it would cost around ~563 EOS, which right now translates to $6025.17 (USD). I'm not considering the net and cpu because it fully restores in 3 days, you could separate your airdrop in blocks. My next step is to run a big batch of thousands of tokens issuing transactions so I can prove all of these stats are correct. Also a **BIG THANK YOU** to @nsjames, @syedjafri and @blockliberty for the nice insights, discussions and prices! And of course to this amazing Jungle Testnet @cryptolions **EDIT: Follow up article released: https://steemit.com/eos/@leordev/eos-ram-and-bandwith-analysis-2-tokens-claiming-and-achieving-zero-cost-airdrop **
👍 thevillan, cmadh, alienzin, kirkins, wekkel, startdominating, cmichel, kirill-yurkov, twokings3queens, twittering, max-infeld, dallasrushing, natp, giraffeass, jd3, str11ngfello, equeiroz, blocktheory, lapapanite, leordev, gnumarcelo, elorenzoni, tsto, javiersuweijie, genereos, luigi-tecnologo, chiliec, bhikkhu, eosgreen, shakhruz, arcange, raphaelle, cryptohead, sukeshtedla, liondani, soleone, thomasuk, andriuha, ashe-oro, philmesnier, nsjames, eosinsider, jorfermo, dimelopons, cybercodetwins, lukestokes, eosys, cypherman, unus, jackalxx, raycai, muguika, joehitt, djjaron, willpark, reyhaynes, iscott, sivachaitanya,