Web developer, welcome to Ethereum

The complete on-boarding guide to Ethereum for web developers

Tomer Gabbai
Wemark
11 min readOct 23, 2017

--

So you heard about Blockchain technology and the Ethereum project and thought it’s novel and interesting. Until today you have dealt with many web related tasks and processes, such as client and server communication, Ajax requests, web sockets, DB tables indexing, user authentication and more. Today you are about to enter a new playground, where most of the players work totally different. Welcome to the decentralized computing world, where there is no single server for your app, HTTP is not the main protocol and SQL injection is just gibberish.

Traditional full stack developers can have quite a cumbersome process of adjusting their mind-set to decentralized computing. Everything is different — protocols, applications, developer tools, security and performance concerns. We at Wemark, a bunch of experienced web developers, have gone through this process over the last few months. We have decided to share our knowledge with the community, mainly web developers, spoken in their language. It’s not going to teach you all about Ethereum, but to give you a kickstart for your learning process and to understand who’s against who in this ecosystem. I grouped the knowledge into a few learning steps: intro, terms, tools, main stakeholders and code examples.

Ethereum Foundation logo (ethereum.org)

Intro to Blockchain and Ethereum

First, you’ll have to understand the underlying technology of Ethereum — which is the blockchain. The first famous use of the blockchain was the Bitcoin, which you already know. You’d better have a solid understanding of how it works — what it enables and how.

  • In this video, you’ll get a live and working demonstration of how blockchain works. Make sure you fully understand it.
  • Watch Ethereum in 25 Minutes, a presentation by Vitalik Buterin, the founder of Ethereum, explaining it from A to Z.
  • Watch this talk of Vitalik Buterin and Naval Ravikant, discussing about the current state of Ethereum and the challenges ahead.
  • Fat Protocols, an article by Joel Monegro, sketches the difference between layers in web and blockchain stacks, and the movement of the core value from application layer to the protocol layer. Worth reading.

Terms you must know

By entering the Ethereum ecosystem, and decentralized computing in general, you’ll stumble upon unfamiliar terms. Knowing this list of terms below will help you starting your learning journey and make you feel much more familiar with this world.

  • Smart Contract is a term that was proposed back in 1996 by Nick Szabo, describing a piece of software that verifies or enforces a contract between parties, and basically controls any kind of digital asset. Ethereum took this term and implemented a platform for writing Turing complete logic using smart contracts and running it on top of the blockchain. This is where your backend logic of your decentralized applications going to be implemented. Think about it as your server in the client-server architecture. Developing smart contracts is usually done using the Solidity high level programming language (described below) which is compiled and being executed by the EVM, running on miners nodes. The mental shift from writing backend web logic to writing smart contracts can be tough, especially when talking about security constraints. Because smart contracts deal directly with money, it’s even more critical to know the possible attacks and audit your smart contracts code before releasing it. A good start is to read the best practices of smart contracts development, written by Consensys.
  • ÐApps (stands for Decentralized Applications) are applications that run on top of Ethereum or any other decentralized backend architecture. Such an application usually runs some HTML, JS, CSS on the frontend and integrates with smart contracts and other decentralized systems in the backend. If the common architecture in the web is client-server, here the client is also using the same technology, but the backend is based on decentralized systems (some of them are mentioned in this article). EthTweet and WeiFund are good examples for ÐApps.
Ethereum ÐApp architecture
  • Gas is the way to measure how much computing power a transaction requires over the Ethereum blockchain. This amount is usually measured in Gwei and charges the transaction sender to compensate miners for running and signing transactions into blocks (unlike Bitcoin, miners here are not actually mining new Ether, but getting Ether from gas amount and transaction fees as an incentive). Make sure you know the terms gas limit and gas price and deeply understand how it works and being measured, since it has a significant influence on your ÐApp performance (mainly cost-wise). You can think about it as the same concern for having the least number of server calls to your web server, for minimizing AWS running costs. GasStation is a handy website for getting live gas details. Read also this article to understand how gas is being calculated in astep by step explanation. Further info about gas can be found in the official wiki.
  • IPFS (stands for InterPlanetary File System) is a protocol for persisting data on a decentralized network of storage providers. If you are developing a ÐApp, you can’t use a centralized storage like DynamoDB or MongoDB, therefore you need a decentralized storage. The problem is that storing data on Ethereum is very expensive — that’s why IPFS is gaining traction from developers, leading as the most common solution right now for decentralized storage. It works like a CDN by architecture design and unlike the IP protocol, it fetches data by its content and not by its location. Watch this introduction by one of the IPFS core developers to understand it better.
  • Swarm is the IPFS alternative, developed by the Ethereum organization as part of the Web3 initiative. It’s currently pretty at its infancy (like most of the projects around), but you should definitely know about it. Explore the project’s docs for better understanding.
  • Whisper is a protocol for sending P2P messages between ÐApps in a pub/sub design over the Ethereum network, developed by the Ethereum organization. You can think about it as web sockets for Ethereum. This protocol is also at its infancy, but you should definitely be aware of it.
  • We all know that running your web application in staging environment before deploying to production is very useful. Before deploying your smart contracts to the live Ethereum network (called mainnet), you can test your code locally using TestRPC which simulates an Ethereum client on your local machine. When you want to get wet, deploy it to one of the testnets (Ropsten, Rinkeby, Kovan) that are very similar to the real thing, but with no real money (you can get Ether for free from a something called faucet), so if something bad happens you won’t lose your panties.
  • Oracle (read also this) is an entity that allows you to fetch off chain data to your smart contracts. Let’s say your ÐApp fetches data from external source, such as stock exchange rates or weather forecast. Because we live in a decentralized world, every data that’s fetched from an external centralized source should be verified and agreed upon. This protocol gives you that bridge to keep your ÐApp fully decentralized.
  • Proof of Work (also notated as PoW, described in this video) is the algorithm which the Ethereum (and also Bitcoin) consensus is achieved with. Miners prove that they did some work in order to convince the network to accept their new chain of blocks. The work involves solving an intensively hard math puzzle (which you already know from the intro section). This method is considered to be very wasteful, since it uses huge amounts of electricity to achieve consensus (some say it reaches to $1M per day for the whole Bitcoin network). Notice that in Ethereum, miners do not mine new Ether (like Bitcoins in Bitcoin) but get rewarded with a fee that’s being sent on the transaction.
  • Proof of Stake (also notated as PoS) is the major alternative for PoW when talking about a way to achieve consensus. In contrast to PoW, where miners gain advantage by having more computing power, in PoS the more tokens that miners have, the more advantage they get. Today, the main shortcoming of PoW is the waste of electricity power. By moving to PoS, energy consumption will get significantly low, thus mining compensation can get low, meaning that sending transactions could be cheaper. It should also protect against the 51% attack, since it allows to use economic penalties so that anyone being involved in such an attack would be ripped off.
  • Ethereum node (also referred as Ethereum client) is a server component that implements Ethereum’s JSON-RPC API for interacting with the blockchain. That would be the component that your client side code will interact with (using Web3.js, described below). Variety of implementations of nodes give so much credibility to Ethereum as a truly decentralized network. It doesn’t matter how your node is implementing the protocol — it just works. Geth is the most common implementation of an Ethereum client (described below). You can get here live details about Ethereum nodes, such as location, implementations, etc.
  • ENS is the DNS for Ethereum. Addresses on Ethereum are long and hard to remember (160 bits sized, composed of 42 characters and look like this: 0x1e2F058…). ENS enables you to assign alphanumeric meaningful names to such an address. Each name registered requires depositing some amount of Ether directly into its respective registrar contract for a minimum duration of one year. If you made the highest deposit, you win the auction and get the ownership of that name. You can register through here, just make sure you use Mist or MetaMask (described below). There is a nice tutorial here too.
  • ERC20 Token is the standard for writing digital currency over the Ethereum blockchain. One of the common usages of Ethereum smart contract as for writing these lines is for writing digital tradable tokens. Companies create their own tokens and sell them to the public for future use of their products (more than 10K tokens are deployed to mainnet as of writing these lines). This selling is usually named ICO (Initial Coin Offering), which is a powerful way for funding startups that use the Ethereum blockchain as their infrastructure.

Tools you have to know

As in web technologies, Ethereum has a thriving ecosystem of tools and services for developers. It’s important to know them all and understand how they work and how they can help you. Mind that because Ethereum development ecosystem is at its infancy, it’s rapidly evolving and this list will probably be extended/changed in the soon future.

  • Etherscan is a powerful tool that gives you the UI for getting information about the main Ethereum networks. You can search for addresses, transactions, smart contracts and tokens, trace or backtrace any movement of Ether or flow of transactions. You can read smart contracts’ source code and get gas usage of any transaction. Think about it as some kind of a debugger for your ÐApp, where you can verify that things are going as expected. It’s available also for testnets (Ropsten, Rinkeby, Kovan).
  • Geth is the most popular Ethereum client, implemented in Go language. Understand what it provides and how it works by reading its documentation. There are more Ethereum client implementations in various languages.
  • Solidity is a high level language for writing smart contracts on top of Ethereum. It’s written in a Javascript nuance and should be easily reached out by Javascript developers. It has a great self explanatory documentation. Notice that because it’s in its early days, many fundamental actions can be very cumbersome now, such as working with strings or arrays, so make sure you know the limitations and edge cases. Make sure you read this and this — containing useful pitfalls and tips for writing in this very immature programming language (as for now).
  • Web3.js is the way for your ÐApp to interact with Ethereum nodes. Under the hood, it communicates with any node that implements a JSON-RPC layer. If you’re a Javascript frontend developer, your learning should be a breeze.
  • Mist/MetaMask is the way to browse ÐApps and connect to Ethereum through a browser. They hold your private key, which means that your identity can be used to send signed transactions to the blockchain. Mist is a standalone desktop application (a Chromium wrap) running a full node, while MetaMask is running a light node, installed as a Chrome extension. MetaMask is easy to start with, while Mist is more secured and being used for advanced scenarios. If you’re a beginner, I suggest you to download MetaMask first and start play with it.
  • Remix IDE is a web IDE for Ethereum smart contracts. It allows you to run your code with any Solidity version and against any Ethereum node (even local), debug your smart contracts and gives you a few mock accounts to play with. It’s a good place to start hacking smart contracts and understand the development process. I wouldn’t recommend using it for any productional development though.
  • Truffle is framework for writing ÐApps, focused on testing, deploying and migrating smart contracts. It uses the familiar Mocha and Chai libraries for testing. If you’re a Javascript developer, you should find it very easy to work with. Checkout this tutorial for gaining some hands on experience with this framework.
  • Embark is a one stop shop framework for developing ÐApps. Its approach is more holistic than Truffle, by allowing you to easily integrate protocols such as IPFS, Whisper (described above), and even libraries and frameworks you probably already know such as ReactJS and Webpack.

Companies and project you should know and follow

In this playground of Ethereum, there are few big players that you should know about. They contribute frameworks, libraries and infrastructural protocols to the Ethereum community.

  • ConsenSys is an agency that creates libraries, examples and standards for the Ethereum developers community. Visit their Github page to get an impression of their projects.
  • OpenZeppelin develops a framework for reusable smart contracts. Their motto is that smart contract developers should not “reinvent the wheel” and use their audited smart contracts. They also provide auditing service for your own smart contracts.
  • Storj is a decentralized cloud storage provider. They let you store data twice cheaper than Google Drive (as for writing this line). They also allow you to rent part of your hard drive and get paid for it (with their own currency).
  • Oraclize allows you to bridge between your smart contracts on Ethereum and external data from any source, and keep it safe and reliable. Read their docs to understand it better.

Pull up your sleeves and have some hands on experience

Gathered here a few examples for implementations of useful smart contracts. Each one of them can give you a glimpse of the utility a smart contract can give to you. I suggest you to read the code, see what you don’t understand, and complete this knowledge from the documentation. Then, think of a scenario that can be implemented using a smart contract and implement it on your own.

After covering the material above you’re still not an Ethereum developer, but you should now understand the Ethereum ecosystem much better and know the fundamental terms and main stakeholders. To keep your learning running, I suggest you to be active in the community by posting and answering questions on Ethereum’s StackExchange and Ethereum dev subreddit.

Happy learning!

--

--