BlockChain - Ethereum on AWS


There are many possible ways to define Blockchains. For me,an encrypted database of agreements.

Blockchain is a decentralized database technology that maintains a continually growing set of transactions and smart contracts hardened against tampering and revision using cryptography - AWS

Blockchain records agreements in the form of verified transactions that are stored in a distributed manner. These agreements are stored across a network of distributed nodes where all of the nodes do not necessarily trust each other. All of these transactions or terms of the agreement are recorded in the form of blocks, and these blocks are arranged in some order in a chain, which is where the term blockchain comes from.

Its incorruptible, transparent.

Blockchain platforms basically can be used for any contractual agreement. A blockchain is a growing list of records. These records are called blocks, which are linked together.A block in blockchain is just a list of records or transactions with their own unique IDs and own unique contractual terms written out in the form of a block. This blocks are linked using some HASH Algorithm or cryptographically attached to each other

Every block in a blockchain is linked to the next block containing the next set of transactions. And this is kind of like a linked list of blocks. Every set of transactions contained within a block has a unique hash called a transaction hash, which represents those transactions. If any of the transactions within a particular block is different, out of the order of the transactions change, this hash will also change. Even if you try to change the HASH of any block you need to change all the subsequent blocks which contain the hash of this current block. Even though you are able to change the HASH of subsequent blocks, It will be difficult when you will have multiple copies of this blockchain. This update will have to be performed on several of nodes.

Also these growing list of records arranged in the form of blocks is not located at a single centralized authority. Instead, this ledger is distributed across multiple nodes. Blockchain networks are peer-to-peer networks, and this can have thousands, even millions of nodes participating, which is true for public blockchain platforms. These list of records are distributed across all participating nodes, which is why blockchains have often been called an open, distributed ledger.


Ethereum is an open blockchain platform that lets anyone build and use decentralized applications that run on blockchain technology. Like Bitcoin, no one controls or owns Ethereum – it is an open-source project built by many people around the world. It allows you to build blockchain-based applications using smart contracts (a mechanism on Ethereum that allows you to specify common contractual clauses).

Transacting on an Ethereum network isn't free. We have to use Ether, which is a crypto-currency whose blockchain is generated by Ethereum, and Ether is what is used to compensate the participants in the Ethereum network. Participants in an Ethereum blockchain network are basically compute nodes, and all of these compute nodes have to run the EVM, or the Ethereum Virtual Machine (software that powers the Ethereum blockchain network and responsible for executing the contract code).It is also responsible for calculating of complexity of a transaction, and how much should be charged for executing that transaction in terms of gas consumption. Smarat contract are written in a high-level programming language. Most commonly used language is Solidity. Solidity syntax is very similar to that of JavaScript. We can use other languages such as Serpent which is similar to Python, or LLL - Lisp Like Language.

Whenever you want to add a contractual agreement to a blockchain, you have to have a smart contract that represents that agreement, and you have to initiate a transaction on that smart contract. Transactions are initiated from accounts on an Ethereum network. These transaction needs to be verified. The contents of a transaction on an Ethereum network has a number of different fields. executing a transaction on the Ethereum blockchain network incurs a computation cost.The participant nodes on the network have to be incentivized to take up and verify this transaction so that it becomes a part of the blockchain, and this incentive for the transaction to be processed is the gas price specified in units of Ether.

The process of verifying transactions is called mining and the participants are called miners

Once miners do the verification of transaction. Question does these transaction become part of Blockchain? So Ethereum is a distributed system, means the nodes in the Ethereum network need to agree on the consistency of the transactions, as well as the order of the transactions.

All of the participant nodes need to perform some really hard computation work, and then prove that they've actually done that work and submit it. This is called consensus algorithm in a blockchain network. As a term, 'Consensus' means that the nodes on the network agree on the same state of a Blockchain, in a sense making it a self-auditing ecosystem.Consensus algorithm allows all of the participant nodes to achieve consensus even when they don't trust each other. This hard computation work that miners have to submit proof of, so that their blocks can be added to the blockchain is such that it's extremely hard to perform, but easy to verify. Two types consensus algorithms that can be used. The first is called the proof-of-work that's currently being used by Ethereum networks and another is called proof-of-stake.

The process of generating proof-of-work is called mining and the participants are miners

Mining is not just about verifying the transactions in the block but also about generating the proof-of-work by performing a hard task which gives Gas as prize to them. Now to creation such computational environment is difficult task. For which we will talk about AWS template

AWS Blockchain

AWS Blockchain Templates helps us quickly create and deploy blockchain networks on AWS using different blockchain frameworks. AWS Blockchain templates are with Ethereum, as well as Hyperledger. We will talk about Ethereum as topic of this article only. AWS blockchain templates make it very easy for you to provision the nodes you need with the right kind of software to get your blockchain network up and running.Once your network is up and running, we can connect your blockchain network to run decentralized applications or DAPPs. We can write up your smart contracts using the Solidity or other programming languages and execute them on this AWS blockchain network.The fundamental components of a blockchain network on AWS created using AWS Blockchain Templates are shown in the following diagram.

AWS Services Used

EC2: Computation instances runs for miner nodes and client nodes which run EVMECS: Orchestrates container deployment for EC2 clusters set upVPC: Network componentALB: Single point of access to resources

Blockchain Template Architecture

Lets talk about this infrastructure of Blockchain etherium on AWS in more detail.Elastic container service ie ECS to set up distributed containers across multiple EC2 instances. These Docker images which run the Ethereum virtual machine will be installed using the ECR, or Amazon's Elastic Container Registry. We'll also be using ALB to connect to all of the instances in our network. AWS template also manages monitoring of Ethereum using EthStats - network status monitoring tool and EthExplorer - monitors the blocks on blockchain network. We can't connect directly to your Amazon VPC from an external computer. For this We need to set up a Bastion host ( provides secure access to Linux instances located in the private and public subnets), which is an instance on the public subnet which will connect to your load balancer and in turn to your Ethereum network. Any client running on your local machine that will connect to the Ethereum network running on AWS will use this Bastion host or jump host.

Bastion host, which is an EC2 instance which lives on the public subnet in a different availability zone from our Ethereum nodes.

After setting up entire AWS Infra, we need to connect this network and to run decentralized Ethereum apps. This will be done by simple Chrome web extension - Metamask.This will allow us to interact with the Ethereum network from our web browser.

Its brief about #AWS #Blockchain template & overview of Blockchain and #Ethereum. In Next coming article , we will use this same infra and connect to Ethereum dapps and executing Transactions on some sample application Land Contract using solidity.

75 views0 comments