Skip to Content
精通区块链
book

精通区块链

by Lorne Lantz, Daniel Cawrey
March 2022
Intermediate to advanced
293 pages
5h 31m
Chinese
China Electric Power Press Ltd.
Content preview from 精通区块链
32 | 第 2 章
比特币中的公钥只用于生成比特币地址。地址本质上是公钥的压缩版本,使
其更容易阅读一些。比特币地址可以与任何人共享,通常用在请求别人向该
地址发送比特币时。
比特币中的私钥是
256
位的随机数,这个数字由一个随机数发生器生成。私
钥以十六进制格式显示。一旦用户拥有了私钥,就可以与公钥配对,以解锁
比特币地址。一切都是以私钥作为起点。由私钥开始,用户可以生成公钥和
比特币地址。为了方便理解,图
2-1
说明了比特币地址的生成过程,以及每
一步使用了哪些加密算法。
私钥 公钥 公钥哈希 比特币地址
补前缀00
图
2
-
1
:从私钥生成比特币地址的过程
如你所见,将私钥通过
ECDSA secp256k1
函数生成公钥。公钥哈希是公钥经
过加密算法
SHA256
和
RIPEMD160
函数处理得到。比特币地址是将公钥哈
希左侧补
00
,并输入到
Base58Check
函数处理得到。
2.2 UTXO
模型
比特币交易遵循一种独特的会计类型,称为未花费的交易输出(
unspent
transaction output
,
UTXO
)。一笔比特币交易最少包含一个输入列表和一个
输出列表。每个输入都表示了一个资金来源的比特币地址,以及该地址过去
收到的未消费交易。类似的,每个输出都表示了接收资金的比特币地址和该
地址将收到的金额。输入和输出之间的差额会作为交易手续费,被比特币矿
工获得。每一个输入还包含可证明该比特币地址所有者已经授权该交易的数
字签名。图
2-2
展示了一笔比特币交易的例子。
加密货币的基础知识 | 33
输入
输出
图
2
-
2
:比特币区块浏览器中显示的一笔示例交易 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

人工智能技术与大数据

人工智能技术与大数据

Posts & Telecom Press, Anand Deshpande, Manish Kumar
Python数据分析(第2版)

Python数据分析(第2版)

Posts & Telecom Press, Armando Fandango
编写整洁的Python代码(第2版)

编写整洁的Python代码(第2版)

Posts & Telecom Press, Mariano Anaya
机器学习流水线实战

机器学习流水线实战

Hannes Hapke, Catherine Nelson

Publisher Resources

ISBN: 9787519863166