Professional Documents
Culture Documents
Ethereum takes blockchain one step ahead. It allows to make smart contracts, Dapps, defy and more.
Smart contracts need to access external data and external computation outside of blockchain using
Oracles.
Chainlink is the most powerful decentralized oracle network and allows us to build hybrid smart
contracts which allows us to use external computation and external data.
Getting data inside the blockchain using oracle creates a single point of failure and makes the
network centralized. This is the biggest issue in Blockchain.
If real world data is brought into a smart contract, then its called a hybrid smart contract.
Decentralized
There is no central authority. There are independent nodes which connect and make up the whole
blockchain environment. Banks do shady stuff, freeze your accounts, don’t give you loans and can do
anything with your money. Robbin Hood Case (read about it!!)
Everything which happens on blockchain can be seen. Of course there is annomousity but everything
still has a record.
Banks take 3-5 days for a transaction to proceed. It takes a few minutes to do it on blockchain
depending on the type of blockchain.
Can’t hack. Data can’t be tempered. If the servers of bank go down, all data will be lost. In blockchain
all nodes have complete record of data, so data can’t be lost.
Smart contract depends on maths and don’t require any trust of any sort.
Gas
Gas price is in Wei or Gwei. It’s the cost of gas per unit. More computation means more gas used.
We can’t set the gas price to minimum because of block size issue(will be discussed later). Higher
gasprice means that the calculation will be validated asap.
Mining
The problems miners have to solve is to come up with a Nonce that gives the Hash 4 zeroes in the
beginning. The Hash is calculated by the SHA256 hashing function(data goes in, hash comes out).
After we click the mine button, the nonce changes and a new hash comes out which has 4 zeros in
the start.
Genesis Block
The first block in the blockchain is called genesis block. Its previous hash is zero.
The hash of the block is linked to the next block by the Previous field. So if you change the data, the
hash is changed and the previous column doesn’t match and thus as a result the whole blockchain
becomes invalid. This is the reason why blockchain is immutable and can’t be tampered.
(The hash is calculated by the block, nonce, data and previous fields)
By changing the data, the hash is changed. The prev field is also updated and thus the hash doesnot
start with four zeros anymore.
However it is possible to mine the whole blockchain again so that a new hash is calculated for each
block (hash starts with 4 zeroes.)
Whenever we make a transaction, it is signed by the private key to generate a message signature.
The message signature can then be verified to see if it came from the correct public key.
The normal websites run on a centralized server(Facebook has its own server for storing data so does
Google). Blockchain runs on decentralized nodes (each person can has its own copy of blockchain).
In normal world, if a company server goes down or its hacked or is bribed, the whole system goes
down. However, in blockchain, each person has its own copy. So if only one node survive, the whole
blockchain is preserved and if one node acts maliciously then it can be voted out as its final hash
won’t match the rest of the nodes.
Consensus
Consensus is the mechanism used to agree on the state of blockchain. (if a blockchain misbaheves It
can be voted out).
_name will be thrown after function execution. Storage variable names there.