Introduction to Fin Tech Dr Meng Han BLOCKCHAIN
Introduction to Fin. Tech Dr. Meng Han BLOCKCHAIN EVOLUTION FROM BITCOIN TO SMART CONTRACTS THANKS FOR EUGENE LUZGIN
Some Cryptography prerequisites Popular hashing algorithms: SHA-256 Script
Cryptographic signature verification
Transactions • We define an electronic coin as a chain of digital signatures. Each owner transfers the coin to the next by digitally signing a hash of the previous transaction and the public key of the next owner and adding these to the end of the coin. A payee can verify the signatures to verify the chain of ownership:
The double-spend problem • The problem of course is the payee can't verify that one of the owners did not double-spend the coin. • A common solution is to introduce a trusted central authority, or mint, that checks every transaction for double spending.
The solution: Timestamp Server • A timestamp server works by taking a hash of a block of items to be timestamped and widely publishing the hash. • The timestamp proves that the data must have existed at the time, obviously, in order to get into the hash. • Each timestamp includes the previous timestamp in its hash, forming a chain, with each additional timestamp reinforcing the ones before it.
Proof-of-Work • The proof-of-work involves scanning for a nonce value that when hashed with a combined hash of all transactions in a block the resulting hash begins with a number of zero bits:
Trust by majority decision making • Proof-of-work is essentially one-CPU-one-vote. • The majority decision is represented by the longest chain, which has the greatest proof-of-work effort invested in it. • If a majority of CPU power is controlled by honest nodes, the honest chain will grow the fastest and outpace any competing chains. • To modify a past block, an attacker would have to redo the proof-of-work of the block and all blocks after it and then catch up with and surpass the work of the honest nodes.
Network • 1) New transactions are broadcast to all nodes. • 2) Each node collects new transactions into a block. • 3) Each node works on finding a difficult proof-of-work for its block. • 4) When a node finds a proof-of-work, it broadcasts the block to all nodes. • 5) Nodes accept the block only if all transactions in it are valid and not already spent. • 6) Nodes express their acceptance of the block by working on creating the next block in the chain, using the hash of the accepted block as the previous hash.
Network nodes logic • Nodes always consider the longest chain to be the correct one and will keep working on extending it. • If two nodes broadcast different versions of the next block simultaneously, some nodes may receive one or the other first. • In that case, they work on the first one they received, but save the other branch in case it becomes longer. • The tie will be broken when the next proof of-work is found and one branch becomes longer; the nodes that were working on the other branch will then switch to the longer one.
Incentive • By convention, the first transaction in a block is a special transaction that starts a new coin owned by the creator of the block. • This adds an incentive for nodes to support the network, and provides a way to initially distribute coins into circulation, since there is no central authority to issue them. • The steady addition of a constant of amount of new coins is analogous to gold miners expending resources to add gold to circulation. In our case, it is CPU time and electricity that is expended.
Simplified Payment Verification • A user only needs to keep a copy of the block headers of the longest proof-of-work chain, which he can get by querying network nodes until he's convinced he has the longest chain. • He can't check the transaction for himself, but by linking it to a place in the chain, he can see that a network node has accepted it, and blocks added after it further confirm the network has accepted it:
Privacy • The traditional banking model achieves a level of privacy by limiting access to information to the parties involved and the trusted third party. • The necessity to announce all transactions publicly precludes this method, but privacy can still be maintained by breaking the flow of information in another place: by keeping public keys anonymous.
Tragedy of The Commons • “The tragedy of the commons is an economic problem in which every individual tries to reap the greatest benefit from a given resource. • As the demand for the resource overwhelms the supply, every individual who consumes an additional unit directly harms others who can no longer enjoy the benefits. • Generally, the resource of interest is easily available to all individuals; the tragedy of the commons occurs when individuals neglect the well-being of society in the pursuit of personal gain. ” - Investopedia
Tragedy of The Commons for Bitcoin • As complexity of mining operation increases – the mining profits will drop or become negative even for large Bitcoin mining farms. • New faster mining hardware comes out before you can barely pay off your existing mining hardware. • Once Bitcoin price stops growing or drops combined with complexity increases will drive miners to switch to a different coin mining or stop operations. • Gradually as miners leave the network – the security of the network will decrease making 51% attack more likely. Alternatively ever increasing transaction costs are making Bitcoin impractical for micropayments.
Comparative speed of transactions/second 1800 1667 1600 1400 1200 1000 800 600 400 200 0 193 3, 5 20 Bitcoin Ethereum Pay. Pal Visa
Proof of Stake (Po. S) is a category of consensus algorithms for public blockchains that depend on a validator's economic stake in the network.
Benefits of Proof of Stake No need to consume large quantities of electricity in order to secure a blockchain. Because of the lack of high electricity consumption, there is not as much need to issue as many new coins in order to motivate participants to keep participating in the network. Proof of stake opens the door to a wider array of techniques that use game-theoretic mechanism design in order to better discourage centralized cartels. Ability to use economic penalties to make various forms of 51% attacks vastly more expensive to carry out than proof of work - to paraphrase Vlad Zamfir, "it's as though your ASIC farm burned down if you participated in a 51% attack".
Ethereum – 1 st Smart Platform
What are Ethereum benefits
The Ethereum Virtual Machine • The Ethereum Virtual Machine or EVM is the runtime environment for smart contracts in Ethereum. It is not only sandboxed but actually completely isolated, which means that code running inside the EVM has no access to network, filesystem or other processes. • Smart contracts even have limited access to other smart contracts. • There are two kinds of accounts in Ethereum which share the same address space: External accounts that are controlled by publicprivate key pairs (i. e. humans) and contract accounts which are controlled by the code stored together with the account. • EVM supports transactions between accounts (contract or external). • Each transaction consumes Gas – a small fraction of Ether. • Each account has a persistent memory area which is called storage. Storage is a key-value store that maps 256 -bit words to 256 -bit words.
Smart Contracts – distributed programs implemented in Solidity language https: //solidity. readthedocs. io/en/develop/solidity-by-example. html
Ethereum is still Po. W Blockchain • However working on Proof of Stake algorithm. Read more: https: //github. com/ethereum/wiki/Proof-of-Stake-FAQ Switching from Po. W to Po. S is not trivial however and may require a hard fork. Solidity is not trivial language to learn and write. So far mostly used for ICO distributions. All operations (read/write) on Ethereum Blockchain cost money (Gas) limiting it’s potential applications to payment smart contracts only.
Tragedy of The Commons for Ethereum • The lack of incentives to work on core protocols is reflected in the large number of people working on Ethereum tokens vs. the small number working on Ethereum itself. • If you contribute to the core Ethereum codebase at best you • 1) own a bunch of ETH personally and the price of them goes up a bit or • 2) need to join the Ethereum Foundation and get paid some amount that wouldn’t match the economics of a successful token launch. • As a result, Ethereum is starting to suffer from a tragedy of the commons problem: while lots of people own ETH and would benefit from Ethereum improving, the economic reward for any single individual improving it is low. https: //medium. com/@FEhrsam/funding-the-evolution-of-blockchains 87 d 160988481
Ethereum became platform for ICOs
25 http: //ksuweb. kennesaw. edu/~mhan 9/
- Slides: 26