Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Advanced Blockchain Topics

Advanced Blockchain Topics

Ulugbek Miniyarov

March 15, 2018
Tweet

More Decks by Ulugbek Miniyarov

Other Decks in Technology

Transcript

  1. Agenda • Blockchain Explorer • Peer-to-Peer Network (DNS Seeds) •

    Node Roles (Full node, Miner, SPV) • SPV & Merkle Tree • Mining ◦ Rigs (CPU, GPU, FPGA, Cloud, ASIC) ◦ ASIC Resistancy ◦ Post-Quantum Safe Hashing ◦ Pools • Bitcoin Hashrate vs Supercomputers • 51% Attack • Block Limit • Softfork, Hardfork • Mempool • Proof-of-Stake • Bitcoin Script • Multi-signature Addresses • Lightning Network & Payment Channels • Notes on Altcoins ◦ Ethereum ◦ Ripple ◦ Bitcoin Cash ◦ Litecoin ◦ IOTA ◦ Cardano • Enuygun Wallet ◦ No Coinbase Reward ◦ Initial input should reference a bank transaction ◦ Payas checks bank transaction ◦ Checks Merkle Tree hash before spending
  2. Blockchain Explorer Blockchain Explorer is an online browser which displays

    block details, transaction details and histories of address balances. Popular explorers: • Bitcoin: blockchain.info • Ethereum: etherscan.io • Ripple: xrpcharts.ripple.com Other explorers of altcoins can be found on: CoinMarketCap.com
  3. Peer-to-Peer Network Bitcoin uses simple broadcast network to propagate transaction

    & blocks Nodes are connected to each other directly Hardcoded DNS Seeds used to discover other peers DNS reply can contain multiple node IP addresses Nodes are also used to discover other nodes List of Hardcoded DNS Seeds: https://github.com/bitcoin/bitcoin/blob/master/src/chainparams.cpp#L128
  4. Node Roles • Full node ◦ Keeps full version of

    blockchain and validate blocks and verify transactions. Also help other peers to discover each other • Miner node ◦ Runs on powerful machines to mine new blocks • Simplified Payment Verification node ◦ SPV nodes don’t need to keep full version of blockchain, but they are still able to verify transactions (a subset of transactions, i.e that were sent to specific address). To achieve this SPV nodes use a full node on the network. These nodes are ideal for Mobile Apps
  5. SPV & Merkle Tree As of March 2018 full node

    size is > 160 GB. Anyone who participates to Bitcoin network should download & re-index to verify all transactions are valid. Satoshi Nakamoto had foreseen the size problem and published SPV in its original bitcoin white paper. SPV does not need full node database, but needs to connect to verify any specific transaction To verify a transaction validity with minimum effort SPV uses Merkle Tree
  6. Mining The process of finding The Nonce to generate required

    hash target. The ideal mining rig should consume less power and calculate more hashes. Mining can be performed using the following rigs: • CPU ◦ Early Bitcoin miners used CPU to mine new blocks. It’s now infeasible. But some altcoins still support CPU mining • GPU ◦ Faster than CPU since it has more ALUs than CPU • FPGA ◦ Field-Programmable Gate Array consumes lower energy with relatively high hashrates. More viable than GPU • ASIC ◦ Application-specific Integrated Circuit is a microchip designed for a specific purpose. In case for Bitcoin, it calculates SHA256. The power it consumes while calculating hashed makes it the most ideal for Bitcoin mining. • Cloud Mining ◦ Mining contractors provide cloud hardware specified with contract.
  7. ASIC Resistancy Since miners who use ASIC make it infeasible

    for miners who mine using CPU/GPU/FPGA, altcoins like Ethereum (Ethash), Litecoin (Scrypt), Monero (Cryptonight) use hashing algorithms that make ASIC usage impossible by needing a lot of memory for hash calculation. This makes ASIC chips require memory and thus making it impossible to mine faster than other rigs
  8. Post-Quantum Safe Hashing Quantum computing theoretically makes calculations faster by

    O(n) -> O(√n). For instance, SHA-258 has 2^256 hashes, in quantum computing it will have 2^128, reduced by half. Since there are 2 states in Quantum Physics, it makes ideal to be used in binary system (0 and 1). To make hashing quantum safe, ternary system is used (0, 1 and -1).
  9. Mining Pools Currently Bitcoin hashrate is so high that its

    probability to mine on your own is near to impossible. One gets more chance of getting mining reward in a pool. Pools have an operator who prepares the block to be mined. Thus mined block reward goes to pool operator. Later pool operator divides reward among pool by the hashrate of every group attendant. To determine hashrate of attendants pool operator sends lower hash target than Bitcoin network. Thus if the pool is lucky an attendant may find a target that is equal or higher than required by network.
  10. Bitcoin Hashrate vs Supercomputers The Tianhe-2 uses 32,000 Intel Xeon

    E5-2692 CPUs to operate. At 50MH/s each, that’s 1,600,000 MH/s or 1,600 GH/s or 1.6 TH/s of Bitcoin hashing power. This supercomputer consumes 17.6MW of power, 24MW if you include the cooling. (from the wiki). The Bitmain S9 Bitcoin ASIC produces 13.5TH/s and uses 1300 watts of power. This shows that the S9 is between 8 and 12 times faster at Bitcoin mining than the second fastest supercomputer in the world. It’s also over 18,000 times more efficient. https://en.wikipedia.org/wiki/Tianhe-2 https://shop.bitmain.com/antminer_s9_asic_bitcoin_miner.htm?
  11. 51% Attack In Bitcoin blockchain the longest chain wins the

    validity. Chains with less block are orphaned. Any person or group with a hashrate power of 51% can mine blocks faster than the other half of the network. This gives the attacker ability to re-mine latest blocks to produce longer chain. Thus invalidating transactions of orphaned blocks.
  12. Block Limit Block Limit of 1MB is introduced by Satoshi

    Nakamoto quietly Jul, 2010. It is considered to be added to prevent DoS attacks. Since every node on the network accepts blocks with max 1 MB transactions in it, it is impossible to increase it without hard-forking.
  13. Softfork, Hardfork All network is agreed upon certain rules. In

    Softfork new rules are introduced with Backward-Compatibility, meaning nodes with old rules are still able to validate new blocks. In Hardfork new rules are not acceptable by old nodes. This breaking change splits network, resulting in a new blockchain. Example for this is Bitcoin Cash. BCash’s breaking change was in increasing Block Limit to 8MB, allowing more transactions in one block.
  14. Mempool All new transactions go to memory pool (mempool) and

    waits for miners to put in a mined block In order to maximize profits, miners typically give priority to transactions paying at a higher Fee Level
  15. Proof-of-Stake In contrast to Proof-of-Work where miners would brute-force target

    bits, in Proof-of-Stake no mining is needed. Instead the creator of next block is chosen via various combinations of random selection and wealth (the stake). The advantages of PoS are: energy efficiency, faster block creation. Other types of block proofing: • Proof-of-Importance: similar to stake, each node is given an importance • Proof-of-Burn: Miners should prove that they burned some coins, sent to unspendable address
  16. Bitcoin Script Transactions in Bitcoin blockchain are valid if input

    unlocks referenced output. The unlocking is done through using Bitcoin Scripts. Bitcoin Script is a simple programming language. The code is just a sequence of data and operators. • Example: 5 2 OP_ADD 7 OP_EQUAL (Adds 5 and 2, if result is equal to 7, outputs true) Full nodes execute transaction script to verify transaction validity. Referenced Output (scriptSig) Transaction Input (scriptPubKey) OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG <sig> <pubKey>
  17. Multi-signature Addresses Multi-signature addresses allow transactions to be spent only

    if M-of-N signatures are present. For instance, if an output is locked with multi-signature address of 3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy which is generated using 3 private keys, at least 2-of-3 signatures of private keys is required to spend this output.
  18. Lightning Network & Payment Channels Proposed implementation of Hashed Timeclock

    Contract with Bi-directional payment channels. Also allowing payments between channels. Key features: • Instant Payments • No third-party trust • Reduced blockchain load (off-chain) • Cross blockchains (altcoins & sidechains) • Sub-satoshi payments
  19. Notes on Altcoins • Ethereum ◦ Main difference of Ethereum

    blockchain from Bitcoin blockchain is its ability to provide easy Smart Contract creation with contract programming language Solidity. ◦ Bitcoin Script is Turing-incomplete, meaning does not support looping, whereas Solidity supports looping but to avoid misuse, Contract runner should pay gas amount. • Ripple ◦ Ripple is a centralized network with instant transaction verifications. It is mainly used amond banks as an alternative to Swift . • Bitcoin Cash ◦ BCash is hardfork of Bitcoin with a Block size of 8MB • Litecoin ◦ Can also be thought as a hardfork of Bitcoin but using Scrypt instead of SHA-256 • IOTA ◦ IOTA does not use blockchains. Instead it uses Directed Acyclic Graph and calls it Tangle. ◦ Each new transaction has to verify 2 previous transactions selected on random. • Cardano ◦ Can be thought as an upgrade to Ethereum with better Smart Contract support and scalability
  20. ENUYGUN Wallet • No Coinbase Reward • Initial input should

    reference a bank transaction • Payas checks bank transaction • Checks Merkle Tree hash before spending
  21. Thank you References: • https://bitcoin.org/bitcoin.pdf • https://CoinMarketCap.com • https://blockchain.info •

    https://github.com/bitcoin/bitcoin/ • https://jeiwan.cc/ • https://en.bitcoin.it/wiki/Main_Page