Hi, guys! From your experience, how much CKB needed for the working project? How to make the right calculation? Any advice would be appreciated. Thanks
It is a good question.And I believe it depends on how many bytes your script need.
For example,a sUDT contract need around 29000 ckbytes ,and if you want to deploy a crypto primitive on chain it may need more than 100000 ckbytes.
The CKB Studio is a good dev programming tool that could estimate how many ckbytes you should use with a friendly UI.Be free to have a look the guide I paste below .
I would like to add some more details from my recent experiences.
When creating basic on-chain smart contract scripts in Rust, the smallest was usually about 17k bytes. My alternate implementation of SUDT is also 17k bytes. On Nervos’ Layer 1, 1 byte of data storage requires 1 CKByte, so approximately 17k CKBytes would be required to launch a new script.
The number of bytes needed for a script can vary greatly depending on a lot of factors, including which compiler and language are used. Rust scripts are larger, but compiler optimizations continue to make binaries smaller. When space savings are absolutely critical, C can be used instead of Rust. However, for most developers, we recommend using Rust.
It’s also worth noting that the fees involved with smart contract deployment are not directly comparable to other platforms. If your script is 20k, you will need 20k CKBytes to deploy on-chain. However, if you later remove the script because it is no longer needed, you get your CKBytes back.
Appreciate for your experience sharing. It makes me understand more about the real situation of ckybte consumption on L1 when developing .And I also believe that it is meaningful and helpful to general devs who are on the road to learn programming on CKB.
Thanks guys @WilliamsBlock @jm9k for your replies.
And finally, do you think the question about an efficient way to use CKB is crucial in development?
If the number of bytes needed for the simple script about 17000, it will cost by the current price of about $420, and this just a simple script! Wow, looks like an efficient way of using CKBytes very very important.
Correct. Storage with global consensus (a.k.a common knowledge byte) is a scarce resource.
Be aware that the “cost” of CKBytes is different from the transaction fee or gas cost. When a developer buys some CKbytes to store a script, the payment goes to the previous CKBytes owner not the miner. When the developer decides that the script is no longer useful he/she can free the storage, reclaim and sell those CKBytes. If the script is used by many, the reclaim decision should be made by all stakeholders instead of the developer. In short, CKBytes is more like a means of production which you acquired before and liquidate after production.
It is also worth pointing out that a simple token on Nervos does not require you to redeploy the contract. Everyone can use the existing SUDT contract, so you don’t have to worry about redeploying like you would have to on Ethereum. Users only have to pay for the cell that is used to store the tokens, not for the cell that holds the contract.
Even if you have to deploy a contract, it is still far less expensive on Nervos than it is on Ethereum today. Here is the cost of deploying the most basic token right now.
What better for a successful growing ecosystem - cheap and unlimited resource or scarce and expensive? How to find this golden line?
Neither extreme is good, a balance must be found and only the market knows where the line is.
Initially the common storage is cheap, and people will use it to store low-value data. As more applications emerge and more users join, the need for ckbytes rises and people must bid for limited supply. Those who use the storage for high-value data are willing to pay more than those who use it for low-value data. Low-value data will gradually be forced to layer 2, L1 value-density will rise.
The economic pressure means the ecosystem will not grow unlimitedly on layer 1, unlike on blockchains which abuse global consensus and common storage. Instead the ecosystem will grow horizontally and vertically simultaneously, with layer 1 always in healthy condition. The market will apportion storage usage and transaction processing on different layers dynamically.