Recently, I just got started learning blockchain development. Therefore, I am going talk about basic blockchain concept and smart contract.
Blockchain development
In this post, I would mainly use ethereum and bitcoin to explain how blockchain works.
Topic cover
- Basic blockchain concept
- Smart Contract
Basic concept of Blockchain
Why is it called BlockChain?
Blockchain is pass by 1 block to another block

- In block
N
, it contains transactions - In block
N+1
, it contians transactions and part of signature and blockN
- In block
N+2
, it contains transactions and part of signature of blockN+1
The first block
The first block is called the genesis block which is configured in genesis.json
. The genesis block is often hardcoded into the applications that use block chain. [1]
In the main-net, every block is connected to existing blockchain.
For private network (normally for development purpose), the block chain are in full control, which means the network can be defined by the owner because there is only a node (or more nodes).
In genesis block perspective, the block chain started like this:

- In block
1
, it is the first block / genesis block - In block
2
, it contains transaction and part of signature of Block 1 - In block
3
, it contains transaction and part of signature of Block 2
How new block created?
For ethereum and bitcoin, new block is created by miners. The miners is running server that trys to solve a hard calculation to verify the transactions. The calculation for solving by using a lot of computing power.
Both Bitcoin and Ethereum used Proof-of-work concept.
Proof of work means that piece of data is hard to produce but very easily to be verify. [2]
How is transaction created?

Assume you want to make 1 ether transaction, you first set up the amount to send, the sign it with private key. The valid transaction is created after that, and it will send to the network. When the next block is mined, the transaction will then be included into the blockchain.
ether is the currency called for ethereum cryptocurrency.
How to store blockchain?
Using a wallet, which is a private and public key pair.
Private key are just like how ssh works. In case you are not familiar with ssh, public key and private key pair will be generated.
The private key is use to sign transactions, and should be kept as secrete.
The public key which is derived from the private key are used to verify transactions. There is almost not possible to retrieve private key from public key.
Wallet address also derived from public key.
Where is blockchain located?
Blockchain is a constantly growing "ledger" of transaction information. The database are massively distributed, which we called the data to be decentralized. So, the data/blockchain can be stored on many computers of the blockchain user around the world.
Using Geth, a Golang implementation for ethereum, you can download the whole chain.
Smart Contract
Smart contract is a contract that helps to exchange with transparent and conflict-free way (to avoid man in the middle service) [3] You can read more about it here.
Programming language for Smart Contract
These languages compiled down to Ethereum Virtual Machine (EVM) Assembly
- Solidity
- Serpent
- LLL
An example on how smart contract looks like from OpenSourceUniversity
From this smart contract, you can see that the contract consist of:
- Data type (UInt, Boolean, Array, Struct, Mapping, Address)
- Class like structure
- Functions
- Event
- If/Else
- Loops (While/For)
- Inheritance
- Import
Deployment
To make our smart contract into deployment, there is a few necessary steps on how it works.
First, Creation of Smart Contract. Smart Contract is the very high level language like Solidity(Syntax like JavaScript).
Once the Smart Contract is done, it will be compiled into bytecode which is a very low level codes that can be understand by machine, which runs on EVM.
Then, the byte code will send over the network. These transactions has no receiver and contains only data. Deploy the contract to the network and give it an address.
Interaction
Once the contract is deployed, we can interact with the contract.
We send a data field while sending an transaction.
On client side, it make use of Application Binary Interface (ABI) which is used to interact of the contract. ABI is in JSON format, which contains all the necessary information to interact with the contract.
Smart Contract are immutable (meaning it should be unchanged over time)
REFRENCE
- https://en.bitcoin.it/wiki/Genesis_block
- https://en.bitcoin.it/wiki/Proof_of_work
- https://blockgeeks.com/guides/smart-contracts/

