I’ve written countless lines of code in my life, but I’ve recently deployed code that will live forever. It resides on the Ethereum blockchain and can be executed decades from now, outliving any domain name I’ve ever purchased and outliving every internet company that has ever existed. Long after I pass away, when there’s no one to update the code base, no one to pay App Store fees, no one to renew domain names or pay server fees, this code will keep on running. This code runs not on a monolith tech company’s servers, but will run on millions — billions — of people’s computers, making it perpetual and unstoppable.
This is the promise of Ethereum, an emerging platform for decentralized, blockchain-based applications. The promise of a democratic, transparent, and decentralized Internet version 2.0 has fueled the skyrocketing price of Ether — the cryptocurrency powering the platform — from 4 Ether per Bitcoin (at the time of launch, about 1 Bitcoin was about $500) to $15 per Ether, an astronomical increase during the past 2 years. Ethereum can no longer be dismissed as a tech cult. While the world sleeps, household names such as Microsoft (which has incorporated Ethereum’s new Solidity programming language into Visual Studio) and JP Morgan Chase, recognizing how revolutionary the concept of Ethereum is, are investing in the vision. Ethereum has made headlines in the New York Times, and children of Ethereum such as The DAO (Decentralized Autonomous Organization) have also been featured in widely-read publications such as the Economist.
In this article, I offer practical pro-tips and gotchas for writing and submitting contracts on the Ethereum blockchain, along with a vision for Ethereum’s future. The process of running the Ethereum client will vary depending on which version of the client you use and your operating system. I’m a die-hard Linux user and prefer the Ethereum Go client over others; if you’re running Mac OS X or Windows (or another client), your experience will be slightly different.
You’ll note that both the Ethereum Wallet (Mist) and the Mix IDE are featured on the Ethereum homepage as graphical interfaces that allow users to create, debug, and deploy contracts. I eagerly await a mature version of the Mix IDE, as the current version is still in concept stage. I’ve always preferred command line to GUIs for the control and transparency they offer, and so, after experimenting with different clients, I ended up choosing the Go client.
The Ethereum website now has several handy code samples for things like creating a new currency, an autonomous organization with its own voting mechanisms, or launching a crowdsale — tasks conceivable only through the novelty of Ethereum’s decentralized structure. Running the simple “hello world” Greeter contract can be challenging for newbies. Here are a few tips that will hopefully get you up and running more quickly:
- After installing the geth client, follow these instructions to create a new account and remember the password! Remember it like your own name but guard it like your biggest secret.
- Now you’ll have to download the blockchain to your node. This process can take several hours and will begin once you run the geth command. The terminal will print out which block is being downloaded, and you can track your progress by comparing that block with the latest block on the chain.
- Once your node is updated, open another terminal window and enter geth attach. This opens the geth console while creating a single concurrent session between the two windows.
- Within the console, try eth.accounts to see your account addresses. You might want to copy these somewhere convenient but safe for your own reference. eth.getBalance(eth.accounts) will print out the balance in wei (1^18 wei = 1 Ether). If your balance is zero, you will have to add Ether to your account before you can deploy contracts to the blockchain. Pro users can upload their presale wallets, or if you’re coming later to the game (or want to be cautious) you can buy Ether on an exchange such as Kraken and transfer Ether to your account address. This reddit post describes the process well. Note that after successfully transferring Ether (the transaction itself shouldn’t take more than a few seconds), your client will need to be fully synced to the network before eth.getBalance(eth.accounts) command will show your updated balance. You can verify that your transaction was successful on this website by entering your address, while you’re waiting for your client to sync.
- Nice work if you’ve made it this far (it may take a few days, depending on your experience and if you already have Ether or a trading account). Now you can start deploying your contract to the blockchain so it can bask in immortality. Close all terminal windows, open a new one, and enter: geth –unlock=0 –password=”/path/to/your/password” where “/path/to/your/password” is a file containing nothing but your account password from step #1.
- Open another terminal window and enter geth attach. This will open the geth console. Then follow the steps in the Greeter tutorial to launch your first Hello, World! contract. Common reasons for not succeeding at first are not unlocking your account (or using the wrong account), not having enough Ether in your account, and not completely syncing the blockchain on your node. More precisely, you must have downloaded at least the block that contains the transaction in which you transferred Ether into your account (if this sentence doesn’t make sense, don’t worry — just sync your node and be patient while this happens) so your local Ethereum client can “see” the transaction.
After working through these steps and browsing StackExchange and Ethereum forums while you get up and running, the fun part really starts. So you’ve become a believer in Ethereum. You’ve even bought some Ether and deployed your first contract. The big question now is, what makes Ethereum a revolutionary act rather than just another blockchain startup based on yet another programming language called Solidity.
If you’ve ever read (and comprehended) Hofstadter’s Gödel, Escher, Bach: An Eternal Golden Braid, you’ll appreciate that meaning is intrinsically tied to form. Ethereum’s significance lies in the fact that Solidity is a Turing-complete language running on the blockchain. That is, it is entirely decentralized and contracts are fully transparent. I’ve jumped on innumerable hot new technologies and platforms in the 18 years I’ve been coding, some of which take off, many of which fizzle away in a cloud of hype. I believe that Ethereum may be one of the most substantial events I will witness in my life due to its form (i.e., a Turing-complete language running on a blockchain).
Surprisingly, several dozen Ethereum-powered dapps (as they’re called) are already live. Ethereum developers are still trying to wrap their heads around the essence — the form — of a dapp, which are largely in concept or early beta stages. The fact that Ethereum is not yet mainstream means that the pool of potential dapp users consists of a small number of tech savvy individuals, in contrast to the huge pool of iOS and Android users who can effortlessly download apps via the App Stores.
What many people, who don’t understand the technical underpinnings of the Ethereum Virtual Machine (EVM), don’t realize, is the following:
“Roughly, a good heuristic to use is that you will not be able to do anything on the EVM that you cannot do on a smartphone from 1999. Acceptable uses of the EVM include running business logic (“if this then that”) and verifying signatures and other cryptographic objects; at the upper limit of this are applications that verify parts of other blockchains (eg. a decentralized ether-to-bitcoin exchange); unacceptable uses include using the EVM as a file storage, email or text messaging system, anything to do with graphical interfaces, and applications best suited for cloud computing like genetic algorithms, graph analysis or machine learning.” (Ethereum Wiki)
Keep this in mind as you dream up your dapps, contracts, and DAOs. This isn’t just another app platform; this is Ethereum. To give birth to revolutionary ideas on the Ethereum blockchain, you need to respect its form.
I’m thrilled to be part of a small but growing community of dreamers writing code on the blockchain. What are you working on? Send me a line and let’s connect.
Omar Metwally, MD (@osmode)