5 Tips for Blockchain App Development

Nik Kalyani

July 31, 2020

Blockchain app development can be tricky. We've put together 5 tips and best practices to avoid costly or irreversible mistakes when it comes to blockchain development.

‍

‍

1. Item Collections

Do: Have the client call the smart contract function for each item

Don't: Loop through each item in your smart contract function

Every line of code executed on a smart contract costs money! To save money and improve efficiency, have the client call the smart contract function for each item, rather than looping through each item in your smart contract.

‍

‍

2. Transferring Funds

Do: Have the user "pull" funds

Don't: Send funds to the user by using "push"

Transferring funds can be a high-stakes process. Having the user pull funds, rather than pushing funds to the user can avoid mistakes and immutable errors.

‍

‍

3. Reducing Gas Fees

Do: Validate all inputs before using them in code

Don't: Intersperse input validation within code

Again, smart contract execution is costly. Be sure to validate all inputs before using them in code to avoid expensive errors before it's too late.

‍

‍

4. Arithmetic Errors

Do: Use a library that checks for numeric overflow/underflow

Don't: Perform arithmetic in smart contracts without bounds-checking

Arithmetic errors are never good, but in smart contracts β€’ they're irreversible. Use a library that checks for numeric overflow/underflow to ensure arithmetic errors don't become an expensive headache.

‍

‍

5. Minimizing On-chain Data

Do: Hash data on-chain and store actual values off-chain

Don't: Store large amounts of data on-chain

Storing data on-chain is incredibly expensive. Using a decentralized storage solution such as IPFS or Sia is a best-practice to maintain the decentralized nature of an app without racking up cost.

‍

‍

6. (Extra tip!) Using Great Tools

Blockchain app development can be confusing, using great tools can make it easier. These best practices (and more!) are built into DappStarter, our full-stack blockchain application generator.

‍

πŸ’Œ
Join the newsletter & get updates to your inbox.
Your information has been saved.
Looks like we're having trouble