SlideShare a Scribd company logo
区块链技术分享
区块链工作原理
Anqiren
• 什么是区块链
• 区块链块结构
• 区块链工作原理
• 比特币交易过程
• 区块链上的资产
• 区块链解决的问题
• 区块链的弊端
什么是区块链
• 为比特币而设计的一种特殊的数据结构。
• 基于密码学中椭圆曲线数字签名算法(ECDSA)
来实现去中心化(P2P)的系统。
• 它由矿工通过挖矿活动来维护,交易者使用。
什么是区块链
区块1 ...... 区块n 区块n+1
• 什么是区块链
• 区块链块结构
• 区块链工作原理
• 比特币交易过程
• 区块链上的资产
• 区块链解决的问题
• 区块链的弊端
区块链块结构
版本号:4byte
父区块哈希:32byte
merkle root:32byte
时间戳:4byte
难度值:4byte
Nonce:4byte
包体:nbyte,存放按时间
戳顺序排列的交易信息。
交
易
计
数
器
:
1~9byte
包
大
小
:
4byte
区块链块结构
• 父区块哈希:计算出的目前区块链中最后一个区
块头的哈希值。是形成链式结构的关键。
区块链块结构
• Merkle root:由区块主体中所有交易的哈希值再
逐级两两哈希计算出来的一个数值。
区块链块结构
• 难度值、nonce:难度值是一个特解区间,nonce
又称之为幸运数字。
• 包大小:目前每个包的大小被限制在1M之内
• 通过改变nonce值,并通过计算区块头SHA256值
来寻求满足要求的特解。
• 什么是区块链
• 区块链块结构
• 区块链工作原理
• 比特币交易过程
• 区块链上的资产
• 区块链解决的问题
• 区块链的弊端
区块链工作原理
• 区块链网络结构(目前的比特币网络)
区块链工作原理
• 矿工的挖矿活动(mining):全网所有矿工通过
计算区块头SHA256值寻求满足难度要求的特解,
来争取当前区块记账权的过程,并获取系统或交
易者的报酬。
• 什么是区块链
• 区块链块结构
• 区块链工作原理
• 比特币交易过程
• 区块链上的资产
• 区块链解决的问题
• 区块链的弊端
比特币交易过程
• A账户转1.23比特币给B账户
• 1、创建一条交易单,填入收款人B、付款人A、
1.23比特币来自于何处等信息。用B的公钥加密,
A的私钥签名。
• 2、把交易单广播到比特币P2P网络里(全网广
播最终所有人都可以收到)。
• 3、矿工把一段时间(平均10分钟)内收到的n
条交易记录(包括A转给B的)打包成一个区块。
比特币交易过程
• 4、矿工算填好数据头,并计算区块头SHA256满
足难度要求的特解(通过改变区块头中的nonce
值,来反复计算区块头SHA256,直到找到一个
小于难度要求的的SHA256值)。
• 5、如果找到了合适的nonce值(靠运气&计算
力),则直接把该区块广播到P2P网络,请求其
他矿工确认。
• 6、其他矿工收到该请求则立即停下手头工作来
判定该区块是否合法(区块合法、A有足够的钱、
并且这笔钱没有支付给别人)。
比特币交易过程
• 7、如果该区块合法,则未算出的矿工把该区块
添加到区块链的主链上,并舍弃自己之前的工作。
否则不予以确认,并继续工作。
• 8、B从P2P网络上不断收到确认信息,当B收到
的确认信息足够多时,就可以确定A的确发出了
这笔交易,之后B就可以自由使用这笔钱了。
• 什么是区块链
• 区块链块结构
• 区块链工作原理
• 比特币交易过程
• 区块链上的资产
• 区块链解决的问题
• 区块链的弊端
区块链上的资产
• 账户:一个账户就是一对公私钥。公钥广播给所
有人,私钥自己保管好。
• 私钥是账户的唯一凭证。
• 一个人的账户数量无限制。
• 什么是区块链
• 区块链块结构
• 区块链工作原理
• 比特币交易过程
• 区块链上的资产
• 区块链解决的问题
• 区块链的弊端
区块链解决的问题
• 去中心化
整个网络不再依赖某一个中心服务器。
• 解决去中心化之后的信任问题
通过数学原理解决信任问题,不需要信任任
何一个节点,但是结果可信。
• 什么是区块链
• 区块链块结构
• 区块链工作原理
• 比特币交易过程
• 区块链上的资产
• 区块链解决的问题
• 区块链的弊端
区块链的弊端
• 交易频率低(最高7笔每秒),不宜大规模应用。
• 区块链的体积会越来越大,最终导致拥有完整区
块链的节点会变少。
• 高能耗,每天矿工需要消耗非常高的电能来挖矿。
• 等待确认时间长,每一笔交易平均要等十分钟才
能有一个确认,一般要6确认之后才可靠。
区块链Q&A
• 区块链记录了所有交易记录,体积不会变得越来
越大?
• 矿工们都在并行工作,加上网络延迟,区块链会
不会分叉?
• 区块链某个矿工擅自修改交易记录怎么办?
• 比特币会越来越多吗?
区块链Q&A
• 比特币挖完之后矿工没奖励罢工了怎么办?
• 转账错了能撤销吗?
• 同一笔钱花给两个人怎么办?
• 为什么交易频率这么低?
• 这么多矿工随时加入退出,怎么控制生成块的速度
的?
区块链Q&A
谢谢

More Related Content

What's hot

What's hot (20)

Understanding Blockchain Security
Understanding Blockchain SecurityUnderstanding Blockchain Security
Understanding Blockchain Security
 
Understanding Proof of Work (PoW) and Proof of Stake (PoS) Algorithms
Understanding Proof of Work (PoW) and Proof of Stake (PoS) AlgorithmsUnderstanding Proof of Work (PoW) and Proof of Stake (PoS) Algorithms
Understanding Proof of Work (PoW) and Proof of Stake (PoS) Algorithms
 
Bitcoin
BitcoinBitcoin
Bitcoin
 
Blockchain - Use Cases
Blockchain - Use CasesBlockchain - Use Cases
Blockchain - Use Cases
 
Bit coin
Bit coinBit coin
Bit coin
 
The Blockchain - The Technology behind Bitcoin
The Blockchain - The Technology behind Bitcoin The Blockchain - The Technology behind Bitcoin
The Blockchain - The Technology behind Bitcoin
 
Distributed systems and blockchain technology
Distributed systems and blockchain technologyDistributed systems and blockchain technology
Distributed systems and blockchain technology
 
Blockchain in IoT and Other Considerations by Dinis Guarda
Blockchain in IoT and Other Considerations by Dinis GuardaBlockchain in IoT and Other Considerations by Dinis Guarda
Blockchain in IoT and Other Considerations by Dinis Guarda
 
Blockchain and Cryptocurrencies
Blockchain and CryptocurrenciesBlockchain and Cryptocurrencies
Blockchain and Cryptocurrencies
 
Bitcoin technology
Bitcoin technologyBitcoin technology
Bitcoin technology
 
Blockchain Introduction Presentation
Blockchain Introduction PresentationBlockchain Introduction Presentation
Blockchain Introduction Presentation
 
BLOCKCHAIN
BLOCKCHAINBLOCKCHAIN
BLOCKCHAIN
 
Consensus Algorithms - Nakov @ jProfessionals - Jan 2018
Consensus Algorithms - Nakov @ jProfessionals - Jan 2018Consensus Algorithms - Nakov @ jProfessionals - Jan 2018
Consensus Algorithms - Nakov @ jProfessionals - Jan 2018
 
Introduction to Blockchain
Introduction to BlockchainIntroduction to Blockchain
Introduction to Blockchain
 
Bitcoin presentation slides
Bitcoin presentation slidesBitcoin presentation slides
Bitcoin presentation slides
 
Blockchain
BlockchainBlockchain
Blockchain
 
Blockchain and Bitcoin
Blockchain and BitcoinBlockchain and Bitcoin
Blockchain and Bitcoin
 
Understanding blockchain
Understanding blockchainUnderstanding blockchain
Understanding blockchain
 
How does blockchain work
How does blockchain workHow does blockchain work
How does blockchain work
 
Bitcoin Final Year Seminar Report
Bitcoin Final Year Seminar ReportBitcoin Final Year Seminar Report
Bitcoin Final Year Seminar Report
 

Similar to 区块链原理

金融革命?談區塊鏈上的去中心化金融應用
金融革命?談區塊鏈上的去中心化金融應用金融革命?談區塊鏈上的去中心化金融應用
金融革命?談區塊鏈上的去中心化金融應用
Yao-Wei Ou
 
投資還是投機?帶你入門虛擬貨幣與區塊鏈
投資還是投機?帶你入門虛擬貨幣與區塊鏈投資還是投機?帶你入門虛擬貨幣與區塊鏈
投資還是投機?帶你入門虛擬貨幣與區塊鏈
Yao-Wei Ou
 
Wot2013云计算架构师峰会 -陈轶飞2
Wot2013云计算架构师峰会 -陈轶飞2Wot2013云计算架构师峰会 -陈轶飞2
Wot2013云计算架构师峰会 -陈轶飞2
dotCloud
 
WOT Cloud Computing Architect Summit
WOT Cloud Computing Architect SummitWOT Cloud Computing Architect Summit
WOT Cloud Computing Architect Summit
Docker, Inc.
 

Similar to 区块链原理 (20)

金融革命?談區塊鏈上的去中心化金融應用
金融革命?談區塊鏈上的去中心化金融應用金融革命?談區塊鏈上的去中心化金融應用
金融革命?談區塊鏈上的去中心化金融應用
 
投資還是投機?帶你入門虛擬貨幣與區塊鏈
投資還是投機?帶你入門虛擬貨幣與區塊鏈投資還是投機?帶你入門虛擬貨幣與區塊鏈
投資還是投機?帶你入門虛擬貨幣與區塊鏈
 
区块链技术创新应用
区块链技术创新应用区块链技术创新应用
区块链技术创新应用
 
Blockchain Demystified
Blockchain Demystified Blockchain Demystified
Blockchain Demystified
 
區塊鏈創新基地 - 區塊鏈
區塊鏈創新基地 - 區塊鏈區塊鏈創新基地 - 區塊鏈
區塊鏈創新基地 - 區塊鏈
 
A tour of ethereum ecosystem
A tour of ethereum ecosystemA tour of ethereum ecosystem
A tour of ethereum ecosystem
 
Digital wallets functions & security
Digital wallets functions & securityDigital wallets functions & security
Digital wallets functions & security
 
Blockchain 2.0 : Smart Contract 的美麗與哀愁
Blockchain 2.0 : Smart Contract 的美麗與哀愁Blockchain 2.0 : Smart Contract 的美麗與哀愁
Blockchain 2.0 : Smart Contract 的美麗與哀愁
 
Viabtc
ViabtcViabtc
Viabtc
 
Introduction bytom architecture 2018
Introduction bytom architecture 2018Introduction bytom architecture 2018
Introduction bytom architecture 2018
 
架構設計-資料存取的選擇
架構設計-資料存取的選擇架構設計-資料存取的選擇
架構設計-資料存取的選擇
 
20161125_新趨勢報告_Blockchain
20161125_新趨勢報告_Blockchain20161125_新趨勢報告_Blockchain
20161125_新趨勢報告_Blockchain
 
區塊鏈懂不懂
區塊鏈懂不懂區塊鏈懂不懂
區塊鏈懂不懂
 
关于Bitworld的一些话题222
关于Bitworld的一些话题222关于Bitworld的一些话题222
关于Bitworld的一些话题222
 
Wot2013云计算架构师峰会 -陈轶飞2
Wot2013云计算架构师峰会 -陈轶飞2Wot2013云计算架构师峰会 -陈轶飞2
Wot2013云计算架构师峰会 -陈轶飞2
 
Comment System of 56.com
Comment System of 56.comComment System of 56.com
Comment System of 56.com
 
比特币钱包应用 Bitcoin wallet dearcoin
比特币钱包应用 Bitcoin wallet dearcoin比特币钱包应用 Bitcoin wallet dearcoin
比特币钱包应用 Bitcoin wallet dearcoin
 
blockchain&cryptocurrency
blockchain&cryptocurrencyblockchain&cryptocurrency
blockchain&cryptocurrency
 
WOT Cloud Computing Architect Summit
WOT Cloud Computing Architect SummitWOT Cloud Computing Architect Summit
WOT Cloud Computing Architect Summit
 
從碼農的角度來剖析區塊鏈 @新竹碼農
從碼農的角度來剖析區塊鏈 @新竹碼農從碼農的角度來剖析區塊鏈 @新竹碼農
從碼農的角度來剖析區塊鏈 @新竹碼農
 

区块链原理