I have been learning about Ethereum blockchain platform for some time and the more I learn, the more exciting it looks. There are lots of resources (articles, videos, platform documentation) about Ethereum, it’s easy to get overwhelmed. But, many of them are outdated understandably because the platform is still evolving at a rapid pace. It took me some time to piece together and get a complete picture of what Ethereum is and how it works. Talking to developers in meetup groups and other online communities, it feels like there are many people who would like to get their hands dirty with this new technology but have the same issue. This article is my attempt at explaining Ethereum from a web developer’s point of view.

If you are a web developer, you know how a webapp with it’s client server architecture works at a very high level.

You have your web application hosted on a hosting provider like AWS, Heroku or a VPS. All the clients interact with this one central application. Clients can be a browser, another api consuming your service etc. When a client makes a request to the server, the server does it’s magic, talks to the database and/or cache, reads/writes/updates the database and serves the client.

This architecture works very well most of the times. However, there are certain applications where it would be really helpful if that database was publicly and securely accessible by everyone and you don’t have to rely on this webapp owner for your data.

For example, let’s look at eBay. If you are a power seller who has earned hundreds of good reviews and for some reason eBay suspends your account. That would be very bad and could severely impact your business. What would be really nice is the ability for you take all your reviews and ratings and move to another platform (say eBay Competitor). eBay does provide a service by being the trusted third party between buyers and sellers. But then, they also take a commission off each sale. What if there was a way to eliminate eBay altogether from the transaction between buyer and seller so you save on commission and also you have access to all your data? This is where decentralized applications come in to picture. Ethereum makes it very easy to build Dapps (decentralized applications).

This is how an Ethereum Dapp looks at a high level:

If you notice, every client (browser) communicates with it’s own instance of the application. There is no central server to which all clients connect to. This means, every person who wants to interact with a dapp (Decentralized Application) will need a full copy of the blockchain running on their computer/phone etc. That means, before you can use an application, you have to download the entire blockchain and then start using the application. This might sound ridiculous at first but it has the advantage of not relying on a single central server which might disappear tomorrow.

In reality, you don’t need to spend lot of your hard disk and RAM downloading the entire blockchain. There are a few workarounds/optimizations to keep the application decentralized yet make the interaction quick and easy.

Now, what exactly is this blockchain? It has:

Database: Every few transactions that occur in the Ethereum network are packaged in to blocks and each block is linked to the next block. This linked series of blocks which holds all the transaction data is the blockchain. If we go back to the eBay example, every transaction between buyers and sellers, whether it is a sale, refund or dispute would all be recorded on the blockchain and is available for everyone to see. To make sure all the nodes in the network have same copy of the data and to insure no invalid data gets written to this database, Ethereum uses an algorithm called Proof of Work (http://ethereum.stackexchange.com/questions/14/what-proof-of-work-function-does-ethereum-use) Code: The database aspect of blockchain just stores the data. But where is all the logic to buy, sell, cancel, refund etc. In Ethereum world, you write the application code (called contract) in a language called Solidity. You then use the solidity compiler to compile it to Ethereum Byte Code and then deploy that byte code to the blockchain. There are few other alternates to Solidity but Solidity is by far the most popular language for contract development.

So basically, the blockchain stores your data, stores the code and also runs the code in the EVM (Ethereum Virtual Machine).

To build web based dapps, Ethereum comes with a handy javascript library called web3.js which connects to your blockchain node. So you can just include this library in your famous js framework like reactjs, angularjs etc and start building.

Another big and most important feature is the financial capabilities of the platform. What if I tell you, as soon as you start using a dapp, you get an in built bank account? Actually, not one bank account, but you can create as many bank accounts as you like in a fraction of second? These bank accounts are called wallets where you store money (Ether - the currency used in the Ethereum ecosystem) and transact.

There are lot of details about the inner workings of the blockchain I left out deliberately because I wanted to concentrate on mostly comparing the blockchain based Dapp with a centalized webapp. Hope this post accomplishes that and gives a good high level idea of what Ethereum is and how it can be used to build decentralized applications.

I plan on writing more posts/tutorials on dapp development this year. If you would like to get notified, you can subscribe here!

[I have written a 3 part guided tutorial on building a full stack dapp here: Part1, Part2, Part3]

I have also created a more complex course to build a decentralized eBay on Ethereum & IPFS.

Further Reading:

For in depth details on how Ethereum works you can read the Ethereum white paper.

More about the solidity language Solidity Language

For all questions, of course you have Ethereum Stack Exchange

Super helpful community at gitter: https://gitter.im/ethereum/solidity and https://gitter.im/ethereum/web3.js

Thanks @raineorshine, @alwaysbcoding, @kinjalmurthy for feedback on the article.