June 22, 2020
At TryCrypto we’re all about making your development experience efficient. We don’t want you to waste time or get frustrated. In keeping with the spirit of our mission we thought it would be beneficial to list out 15 things that our developers wished they knew before they got started developing decentralized apps for blockchain.
1. Mainnet means the main blockchain. Testnet means a test blockchain.
Blockchains usually have a mainnet and a testnet.
2. Dapp development is only 30-40% Smart Contract. You still have to build a UI, an API, and interact with wallets etc.
3. There is a severe penalty in the form of money for writing inefficient code.
4. When you read data from blockchain it is free and nearly instantaneous.
5. When you write data to a blockchain it's called "changing state" and always costs “gas”. Storing data is the most expensive thing your Smart Contract can do.
6. There are limits on everything.
Don't use loops in your code because as the loop count increases you will run up against the maximum gas limit for a transaction. This will potentially make your contract forever unusable as higher loop items will never be executed. Instead, read an array from your client and have it do whatever you need to do for each item in the loop.
7. It's easy to write code that allows bad guys to steal money from your Smart Contract.
8. Once you deploy your contract you can't change it without re-deploying.
Re-deploying means your contract will have a new address. Imagine that every update you pushed out gave your web app a brand new domain name and URL...yeah...it's like that.
9. Smart contracts are not at all smart –– they are merely programs written by humans that implement business rules and run on blockchain virtual machines.
10. It isn't possible for a Smart Contract to execute anything by itself.
Everything a Smart Contract does is always triggered by an external call from a user or another contract.
11. Data associated with a contract stays with a contract.
If you re-deploy, the new contract won't have any correlation with the old contract. In fact, both contracts continue to exist and work in perpetuity.
12. Only functions marked "payable" can accept money.
13. Some wallets have significant friction and some don't.
Choosing the right tools for your users is key to building a great dapp.
14. ENS is the ethereum name service where you can register a name like DNS.
Users can then find your contract at a new address if you re-deploy. This is not very practical as all your data will still be with your previous contract.
15. You can't deploy without having some ETH in a wallet as that is needed to pay for the deployment in the form of gas.
We love sharing helpful info and insight gained from all our time spent learning and developing dapps. Hopefully the items listed above save you time and headaches!
Want to save even more time? Check out our full stack, open source blockchain dapp starter at dappstarter.decentology.com