BLOCKCHAIN
BLOCKCHAIN
Hash function takes data as input and return a random string as output of standard length
Bitcoin uses the SHA-256 hash function
Block hash unique identifier for the block is the output of the hash function applied to :
• Previous block hash b t-1
• Content of the block B t
• Nonce of the block n
Each block needs to be solved by a node to be accepted in the blockchain the miner is rewarded
and updates the blockchain to solve a block a miner need to find the Nonce (n) random string
which once is hashed with H [ n; Bt ; b t-1 ] return a block hash with a target (or less) leading zero
POW achieves decentralized consensus and appear to be secure (never breached nowadays).
However requires huge computational power and energy 61 TWh per year
3 Main challenges:
Solution Public-key (Bitcoin use Elliptic curve digital signature algorithm) everybody
know because used to verify transaction
Private-key 256-bit number string of 64 characters from A-F or 0-9 known only by
the owner of the wallet.
Timestamp Once the miner solves the block a timestamp is assigned to the solved block
Longest-chain Rule Nodes accept only the longest available blockchain if a past
transaction is changed is unlikely that the new chain becomes longer than original one
required that the re-solving block is faster than all the miners together mining new block
Example of Fraud
1) Produce a valid block with the transaction to the shop and send it to network
2) At the same time produce another valid block where he send the coin to himself, but in
a private chain
3) Start validating new block in the private chain where it is the transaction with himself
4) Get the product from the shop because at the same time there is a public blockchain
where there is a valid transaction to the shop the shop once has seen the ‘’valid’’
transaction sent the product
5) Then he update the network with his private chain
6) If longer than the public chain the network accepts the one where is the fraud
transaction so the shop recognize the transaction and at the same time the same
amount of money is in his wallet
51% Attack However he does not have enough computational power to solve block
faster than the rest of the network the longest chain is the real one containing no
payment But He has more computational power than the network the fraud
transaction chain becomes longer than the public with the valid one and he update
the fraud chain to network once he received the product to the shop
Otherwise he could send the private chain to other nodes who could contribute to
extend the chain but in this way the one which survive is the block without a valid
transaction so the shop cannot find anywhere the payment
Is not the first node who solved the block that update the blockchain but the node who
validate is elected pseudo-randomly the election is based on :
The locked coins staked can be released after a period of time if the node behaved
honestly, otherwise it lost its stake
51% if the node hold more than 50% of the coin supply but it require an huge
amount of money to build this stake and if the system lose credibility the value of this
huge stake would be lost
32 nodes Proposers
Some nodes Validators
If proposers produce 2 different block in one epoch create a Fork Heaviest chain
rule the valid chain is the one with more attestations