Читать книгу Cryptocurrency All-in-One For Dummies - Peter Kent, Kiana Danial - Страница 155
Building smarter smart contracts
ОглавлениеSmart contract programming requires a different mindset than standard contract writing. There is no third party to make things right if the contract executes in a way that you didn’t expect or intend. The immutable and distributed nature of blockchains makes it tough to change an unwanted outcome.
Your contract will have flaws and may fail. Build safety valves into your contracts so you can respond to bugs and vulnerabilities as they come up. Smart contracts also need an off switch that lets you pull the plug and pause your contract when things are going wrong.
If your contract is big enough, offer bug-hunting bounties that incentivize the community to find vulnerabilities and flaws in your contract.
As with many things, the complexity of your contract also increases the likelihood of errors and attack vectors. Keep your contract logic simple. Build out small modules that hold each section of the contract. Creating a contract in this manner will help you compartmentalize any issues.