Peter Kent

Cryptocurrency All-in-One For Dummies


Скачать книгу

MetaMask wallet opens as a pop-up window.

      9 Confirm the Gas Fee cost, and click Confirm.

Snapshot of the Add Members box.

      FIGURE 5-3: The Add Members box.

      

Important! If you don’t have enough ETH in your wallet to cover the gas fee to create your DAO, just stop at this point. You can always quit this DAO setup and return to these instructions at a later date when your wallet has more ETH. If you have enough ETH to cover the transaction, it takes a few minutes to create your DAO. You are asked to Confirm one more time, and then your DAO is created. Congrats!

      Smart contracts and decentralized organizations hold a lot of promise. Their pure democratic and hyper-rational nature is very appealing. However, at this point, more possibilities exist than knowns, and each contract that’s created could be groundbreaking or a massive flop.

      If you approach Ethereum as the new frontier that it is, you’ll have more success. The Ethereum network has more benefits than drawbacks if you’re careful. But expecting everything to work flawlessly and all the participants to act with integrity will open you up to greater losses. Ethereum has its share of bandits, not to mention those friendly enthusiasts who would like you to succeed.

      The smart contract hacks of 2016 have highlighted the importance of security and properly reviewing contracts. They also showed that people with integrity exist, and fight to fix issues.

      Reading this book is only the beginning. It will give you a sound basis on which to build your knowledge of Ethereum, but as with all new technologies, Ethereum is quickly evolving. Keep reviewing best practices and security measures.

      The following sections touch on a few things to keep in mind as you build your first few DAOs, build smart contracts, and debug your new blockchain systems.

      Putting money in a DAO

      Don’t trust large sums of money to untested contracts and contracts that haven’t been fully vetted. Large contracts are more often targeted by hackers. The DAO hack described earlier in this chapter (see the sidebar, “With great power comes … great power”) showed that even well-thought-out contracts have unexpected weaknesses.

      

Although smart contracts and blockchains let you conduct business with anyone around the world, it’s still early days. You can mitigate your risk by working only with known and trusted parties.

The security landscape will constantly be evolving with new bugs. Reviewing all new best practices is imperative. Manage the amount of money you’re putting at risk and roll out contracts slowly and in phases. Ethereum is a fairly new technology, and mature solutions are not yet built.

      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.

      Finding bugs in the system

      Don’t reinvent the wheel by building your own tools such as random number generators. Instead, leverage the work that the community has already done and that has been well tested.

      

You can only control for things within your own contract. Be cautious of external contract calls. They can execute malicious code and take away your control.

      The Ethereum community has an excellent known bug list and even more helpful tips on how to build secure smart contracts. You can find it at eth.wiki/en/howto/smart-contract-safety.

      This section shows you how to create your own token on the Ethereum network. Before you read through this section, make sure that you’ve set up MetaMask. If you haven’t, refer to Chapter 3 of this minibook, where you find detailed instructions for setting up your computer and downloading MetaMask.

      To create your token, follow these steps:

      1 Go to https://www.createmytoken.com.

      2 Click Ethereum Network.

      3 Click Create ERC-20 Token for free!.

      4 Connect your MetaMask wallet by clicking Connect.

      5 Name your token and give it a Token (ticker) Symbol.

      6 Make sure that All Functionality is set to the On position.

      7 Type in your initial supply of tokens, such as 100,000,000.Under the Ready to Deploy? box, make sure you have enough ETH in your MetaMask wallet to cover the gas fees. For example, at the time of this writing, the estimated cost was 0.05 ETH. If this amount is acceptable to you, click Deploy Token!.

      Congratulations! You’ve created your own token. With tools like https://www.createmytoken.com, it’s easy and fast to create a token on various platforms. If you’re curious to find out more about Ethereum, head to Book 4.

      Getting Your Hands on Hyperledger

      IN THIS CHAPTER

      

Uncovering Hyperledger Foundation

      

Discovering key Hyperledger projects