How to do it...

  1. The first and most important technique is to keep the contract as simple as possible. Complex contracts increase the likelihood of bugs. The contract's logic should be simple and modularized.
  2. Use already available, well-tested, and popular libraries to achieve common tasks. This can help you in writing bug-free and high-performing contracts.
  3. Only use the blockchain where your application needs decentralization. It is okay to keep other things in a traditional centralized database. It is not advised to store everything in Blockchain.
  4. Always keep your contract and the libraries up to date. This protects your contract from recently discovered bugs.
  5. There are several Ethereum-specific properties that need to be considered while writing code for the Blockchain. This includes gas limitations, transparency, and trust.
  6. Every instruction costs a value to run, and there is an upper limit enforced by each block. A transaction can use a maximum of the gas allowed for a block. The code has to be written in such a way that no transaction exceeds this limit in the future.
  7. No value in Ethereum is private and anyone can read data from any contract. There are private access modifiers available for state variables, but they can still be read in other ways. Write your contracts considering this fact.
  8. Relying on untrusted external contracts is very risky. It is always recommended not to do that for any task, since they can execute malicious code and do something bad.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.208.97