<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title>meisw's blog</title>
		<link>http://meisw.wdlinux.cn//</link>
		<description>工作,学习,生活,这里将会有一些记录.     备用域名:http://meisw.wdlinux.cn</description>
		<copyright>Copyright (C) 2004 Security Angel Team [S4T] All Rights Reserved.</copyright>
		<generator>SaBlog-X Version 1.6 Build 20080806</generator>
		<lastBuildDate>Sun, 20 Sep 2026 23:57:15 +0000</lastBuildDate>
		<ttl>30</ttl>
		<item>
			<guid>http://meisw.wdlinux.cn//show-1048-1.html</guid>
			<title>比特币交易的数据结构与签名类型</title>
			<author>admin</author>
			<description><![CDATA[<p>&nbsp;</p>
<h1 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px; font-size: 36px; color: rgb(85, 85, 85); font-weight: 500; line-height: 1.1; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 30px; line-height: 1.1;">简介</span></h1>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">交易(Transaction)是比特币系统的信息载体，最小单元。而块(Block)就是将这些基础单元打包装箱，贴上封条，并串联起来。巨大算力保障了块的安全，也就保障了单个交易的安全。</p>
<h2 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px; font-size: 30px; color: rgb(85, 85, 85); font-weight: 500; line-height: 1.1; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><a name="t2" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>类型</h2>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">交易有三种常见类型：产量交易(Generation)，合成地址交易(Script Hash)，通用地址交易(Pubkey Hash)。该分类并非严格意义的，只是根据交易的输入输出做的简单区分。</p>
<h2 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px; font-size: 30px; color: rgb(85, 85, 85); font-weight: 500; line-height: 1.1; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><a name="t3" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>Generation TX</h2>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">每个Block都对应一个产量交易(Generation TX)，该类交易是没有输入交易的，挖出的新币是所有币的源头。</p>
<h2 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px; font-size: 30px; color: rgb(85, 85, 85); font-weight: 500; line-height: 1.1; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><a name="t4" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>Script Hash TX</h2>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">该类交易目前不是很常见，大部分人可能没有听说过，但是非常有意义。未来应该会在某些场合频繁使用。该类交易的接受地址不是通常意义的地址，而是一个合成地址，以3开头（对，以3开头的也是<a href="http://8btc.com/article-135-1.html" rel="nofollow" class="relatedlink" target="_blank" style="box-sizing: border-box; outline: 0px; text-decoration-line: none; word-break: break-all; border-bottom: 1px solid rgb(0, 0, 255); color: rgb(68, 68, 68) !important;">比特币地址</a>！）。三对公私钥，可以生成一个合成地址。在生成过程时指定n of 3中的n，n范围是[1, 3]，若n=1，则仅需一个私钥签名即可花费该地址的币，若n=3，则需要三把私钥依次签名才可以。</p>
<h2 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px; font-size: 30px; color: rgb(85, 85, 85); font-weight: 500; line-height: 1.1; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><a name="t5" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>Pubkey Hash TX</h2>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">该类是最常见的交易类型，由N个输入、M个输出构成。</p>
<h2 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px; font-size: 30px; color: rgb(85, 85, 85); font-weight: 500; line-height: 1.1; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><a name="t6" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>数据结构</h2>
<div style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 0px; word-break: break-all; color: rgb(74, 74, 74); font-family: &quot;Microsoft Yahei&quot;, &quot;Hiragino Sans GB&quot;, Helvetica, &quot;Helvetica Neue&quot;, 微软雅黑, Tahoma, Arial, sans-serif; font-size: 16px; line-height: 30px;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; color: rgb(85, 85, 85); font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial; line-height: 20px;">交易中存放的是货币所有权的流转信息，所有权登记在比特币地址上(Public Key)。这些信息是全网公开的，以明文形式存储（比特币系统里的所有数据都是明文的），只有当需要转移货币所有权时，才需要用私钥签名来验证。</span></div>
<div style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 0px; word-break: break-all; color: rgb(74, 74, 74); font-family: &quot;Microsoft Yahei&quot;, &quot;Hiragino Sans GB&quot;, Helvetica, &quot;Helvetica Neue&quot;, 微软雅黑, Tahoma, Arial, sans-serif; font-size: 16px; line-height: 30px;">
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, SimHei, Verdana, Arial, sans-serif !important;"><a href="http://8btc.com/data/attachment/portal/201508/13/184109jjr6n99cqo7c761c.jpg" rel="nofollow" target="_blank" style="box-sizing: border-box; outline: 0px; color: rgb(102, 102, 102); text-decoration-line: none; word-break: break-all;"><img src="http://8btc.com/data/attachment/portal/201508/13/184109jjr6n99cqo7c761c.jpg" alt="" style="box-sizing: border-box; outline: rgb(7, 130, 193) solid 1px; max-width: 100%; padding: 1px; margin: 0px; border: none; word-break: break-all; cursor: zoom-in; vertical-align: top;" /></a></p>
</div>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">&nbsp;</p>
<table style="box-sizing: border-box; outline: 0px; border-collapse: collapse; border-spacing: 0px; width: 852px; margin-bottom: 24px; word-break: break-all; font-size: 14px; color: rgb(85, 85, 85); font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial; line-height: 20px;">
    <thead style="box-sizing: border-box; outline: 0px; word-break: break-all;">
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); word-break: break-all;">
            <th style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; font-weight: normal; text-align: left; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; background-color: rgb(239, 243, 245);">字段大小</th>
            <th style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; font-weight: normal; text-align: left; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; background-color: rgb(239, 243, 245);">描述</th>
            <th style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; font-weight: normal; text-align: left; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; background-color: rgb(239, 243, 245);">数据类型</th>
            <th style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; font-weight: normal; text-align: left; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; background-color: rgb(239, 243, 245);">解释</th>
        </tr>
    </thead>
    <tbody style="box-sizing: border-box; outline: 0px; border: 0px; word-break: break-all;">
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); word-break: break-all;">
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">4</td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">version, 版本</td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">uint32_t</td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">交易数据结构的版本号</td>
        </tr>
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); background-color: rgb(247, 247, 247); word-break: break-all;">
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">1+</td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">tx_in count, 输入数量</td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">var_int</td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">输入交易的数量</td>
        </tr>
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); word-break: break-all;">
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">41+</td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">tx_in</td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">tx_in[]</td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">输入交易的数组，每个输入&gt;=41字节</td>
        </tr>
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); background-color: rgb(247, 247, 247); word-break: break-all;">
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">1+</td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">tx_out count, 输出数量</td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">var_int</td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">输出地址的数量</td>
        </tr>
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); word-break: break-all;">
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">9+</td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">tx_out</td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">tx_out[]</td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">输入地址的数组，每个输入&gt;=9字节</td>
        </tr>
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); background-color: rgb(247, 247, 247); word-break: break-all;">
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">4</td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">lock_time, 锁定时间</td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">uint32_t</td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">见下方解释</td>
        </tr>
    </tbody>
</table>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">lock_time是一个多意字段，表示在某个高度的Block之前或某个时间点之前该交易处于锁定态，无法收录进Block。</p>
<table style="box-sizing: border-box; outline: 0px; border-collapse: collapse; border-spacing: 0px; width: 852px; margin-bottom: 24px; word-break: break-all; font-size: 14px; color: rgb(85, 85, 85); font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial; line-height: 20px;">
    <thead style="box-sizing: border-box; outline: 0px; word-break: break-all;">
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); word-break: break-all;">
            <th style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; font-weight: normal; text-align: left; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; background-color: rgb(239, 243, 245);">值</th>
            <th style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; font-weight: normal; text-align: left; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; background-color: rgb(239, 243, 245);">含义</th>
        </tr>
    </thead>
    <tbody style="box-sizing: border-box; outline: 0px; border: 0px; word-break: break-all;">
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); word-break: break-all;">
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">0</td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">立即生效</td>
        </tr>
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); background-color: rgb(247, 247, 247); word-break: break-all;">
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">&lt; 500000000</td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">含义为Block高度，处于该Block之前为锁定（不生效）</td>
        </tr>
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); word-break: break-all;">
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">&gt;= 500000000</td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px;">含义为Unix<a href="http://8btc.com/article-165-1.html" rel="nofollow" class="relatedlink" target="_blank" style="box-sizing: border-box; outline: 0px; text-decoration-line: none; word-break: break-all; border-bottom: 1px solid rgb(0, 0, 255); color: rgb(68, 68, 68) !important;">时间戳</a>，处于该时刻之前为锁定（不生效）</td>
        </tr>
    </tbody>
</table>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">若该笔交易的所有输入交易的sequence字段，均为INT32最大值(0xffffffff)，则忽略lock_time字段。否则，该交易在未达到Block高度或达到某个时刻之前，是不会被收录进Block中的。</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">示例</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">为了演示方便，我们读取稍早期的块数据，以高度116219 Block为例。</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 1em; line-height: 1.5;"># ~ bitcoind getblock 0000000000007c639f2cbb23e4606a1d022fa4206353b9d92e99f5144bd74611&nbsp;</span><br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
{<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;hash&rdquo; : &ldquo;0000000000007c639f2cbb23e4606a1d022fa4206353b9d92e99f5144bd74611&Prime;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;confirmations&rdquo; : 144667,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;size&rdquo; : 1536,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;height&rdquo; : 116219,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;version&rdquo; : 1,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;merkleroot&rdquo; : &ldquo;587fefd748f899f84d0fa1d8a3876fdb406a4bb8f54a31445cb72564701daea6&Prime;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;tx&rdquo; : [<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;be8f08d7f519eb863a68cf292ca51dbab7c9b49f50a96d13f2db32e432db363e&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;a387039eca66297ba51ef2da3dcc8a0fc745bcb511e20ed9505cc6762be037bb&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;2bd83162e264abf59f9124ca517050065f8c8eed2a21fbf85d454ee4e0e4c267&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;028cfae228f8a4b0caee9c566bd41aed36bcd237cdc0eb18f0331d1e87111743&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;3a06b6615756dc3363a8567fbfa8fe978ee0ba06eb33fd844886a0f01149ad62&quot;<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
],<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;time&rdquo; : 1301705313,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;nonce&rdquo; : 1826107553,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;bits&rdquo; : &ldquo;1b00f339&Prime;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;difficulty&rdquo; : 68977.78463021,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;previousblockhash&rdquo; : &ldquo;00000000000010d549135eb39bd3bbb1047df8e1512357216e8a85c57a1efbfb&rdquo;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;nextblockhash&rdquo; : &ldquo;000000000000e9fcc59a6850f64a94476a30f5fe35d6d8c4b4ce0b1b04103a77&Prime;<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
}<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
该Block里面有5笔交易，第一笔为Generation TX，解析出来看一下具体内容：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 1em; line-height: 1.5;"># ~ bitcoind getrawtransaction be8f08d7f519eb863a68cf292ca51dbab7c9b49f50a96d13f2db32e432db363e 1</span><br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
{<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;hex&rdquo; : &ldquo;01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff070439f3001b0134ffffffff014034152a010000004341045b3aaa284d169c5ae2d20d0b0673468ed3506aa8fea5976eacaf1ff304456f6522fbce1a646a24005b8b8e771a671f564ca6c03e484a1c394bf96e2a4ad01dceac00000000&Prime;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;txid&rdquo; : &ldquo;be8f08d7f519eb863a68cf292ca51dbab7c9b49f50a96d13f2db32e432db363e&rdquo;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;version&rdquo; : 1,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;locktime&rdquo; : 0,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;vin&rdquo; : [<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
{<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;<a href="http://8btc.com/article-108-1.html" rel="nofollow" class="relatedlink" target="_blank" style="box-sizing: border-box; outline: 0px; text-decoration-line: none; word-break: break-all; border-bottom: 1px solid rgb(0, 0, 255); color: rgb(68, 68, 68) !important;">coinbase</a>&quot; : &quot;0439f3001b0134&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;sequence&quot; : 4294967295<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
}<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
],<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;vout&rdquo; : [<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
{<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;value&quot; : 50.01000000,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;n&quot; : 0,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;scriptPubKey&quot; : {<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;asm&quot; : &quot;045b3aaa284d169c5ae2d20d0b0673468ed3506aa8fea5976eacaf1ff304456f6522fbce1a646a24005b8b8e771a671f564ca6c03e484a1c394bf96e2a4ad01dce OP_CHECKSIG&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;hex&quot; : &quot;41045b3aaa284d169c5ae2d20d0b0673468ed3506aa8fea5976eacaf1ff304456f6522fbce1a646a24005b8b8e771a671f564ca6c03e484a1c394bf96e2a4ad01dceac&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;reqSigs&quot; : 1,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;type&quot; : &quot;pubkey&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;addresses&quot; : [<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;1LgZTvoTJ6quJNCURmBUaJJkWWQZXkQnDn&quot;<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
]<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
}<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
}<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
],<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;blockhash&rdquo; : &ldquo;0000000000007c639f2cbb23e4606a1d022fa4206353b9d92e99f5144bd74611&Prime;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;confirmations&rdquo; : 145029,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;time&rdquo; : 1301705313,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;blocktime&rdquo; : 1301705313<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
}<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
Generation TX的输入不是一个交易，而带有coinbase字段的结构。该字段的值由挖出此Block的人填写，这是一种&ldquo;特权&rdquo;：可以把信息写入货币系统（大家很喜欢用系统中的数据结构字段名来命名站点，例如blockchain、coinbase等，这些词的各种后缀域名都被抢注一空）。<a href="http://8btc.com/article-25-1.html" rel="nofollow" class="relatedlink" target="_blank" style="box-sizing: border-box; outline: 0px; text-decoration-line: none; word-break: break-all; border-bottom: 1px solid rgb(0, 0, 255); color: rgb(68, 68, 68) !important;">中本聪</a>在比特币的第一个交易中的写入的coinbase值是：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 1em; line-height: 1.5;">&ldquo;coinbase&rdquo;:&rdquo;04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73&Prime;</span><br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
将该段16进制转换为ASCII字符，就是那段著名的创世块留言：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 1em; line-height: 1.5;">The Times 03/Jan/2009 Chancellor on brink of second bailout for banks</span><br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
接下来展示的是一个三个输入、两个输出的普通交易：<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
# ~ bitcoind getrawtransaction 028cfae228f8a4b0caee9c566bd41aed36bcd237cdc0eb18f0331d1e87111743 1<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
{<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;hex&rdquo; : &ldquo;0100000003c9f3b07ebfca68fd1a6339d0808fbb013c90c6095fc93901ea77410103489ab7000000008a473044022055bac1856ecbc377dd5e869b1a84ed1d5228c987b098c095030c12431a4d5249022055523130a9d0af5fc27828aba43b464ecb1991172ba2a509b5fbd6cac97ff3af0141048aefd78bba80e2d1686225b755dacea890c9ca1be10ec98173d7d5f2fefbbf881a6e918f3b051f8aaaa3fcc18bbf65097ce8d30d5a7e5ef8d1005eaafd4b3fbeffffffffc9f3b07ebfca68fd1a6339d0808fbb013c90c6095fc93901ea77410103489ab7010000008a47304402206b993231adec55e6085e75f7dc5ca6c19e42e744cd60abaff957b1c352b3ef9a022022a22fec37dfa2c646c78d9a0753d56cb4393e8d0b22dc580ef1aa6cccef208d0141042ff65bd6b3ef04253225405ccc3ab2dd926ff2ee48aac210819698440f35d785ec3cec92a51330eb0c76cf49e9e474fb9159ab41653a9c1725c031449d31026affffffffc98620a6c40fc7b3a506ad79af339541762facd1dd80ff0881d773fb72b230da010000008b483045022040a5d957e087ed61e80f1110bcaf4901b5317c257711a6cbc54d6b98b6a8563f02210081e3697031fe82774b8f44dd3660901e61ac5a99bff2d0efc83ad261da5b4f1d014104a7d1a57e650613d3414ebd59e3192229dc09d3613e547bdd1f83435cc4ca0a11c679d96456cae75b1f5563728ec7da1c1f42606db15bf554dbe8a829f3a8fe2fffffffff0200bd0105000000001976a914634228c26cf40a02a05db93f2f98b768a8e0e61b88acc096c7a6030000001976a9147514080ab2fcac0764de3a77d10cb790c71c74c288ac00000000&Prime;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;txid&rdquo; : &ldquo;028cfae228f8a4b0caee9c566bd41aed36bcd237cdc0eb18f0331d1e87111743&Prime;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;version&rdquo; : 1,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;locktime&rdquo; : 0,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;vin&rdquo; : [<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
{<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;txid&quot; : &quot;b79a4803014177ea0139c95f09c6903c01bb8f80d039631afd68cabf7eb0f3c9&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;vout&quot; : 0,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;scriptSig&quot; : {<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;asm&quot; : &quot;3044022055bac1856ecbc377dd5e869b1a84ed1d5228c987b098c095030c12431a4d5249022055523130a9d0af5fc27828aba43b464ecb1991172ba2a509b5fbd6cac97ff3af01 048aefd78bba80e2d1686225b755dacea890c9ca1be10ec98173d7d5f2fefbbf881a6e918f3b051f8aaaa3fcc18bbf65097ce8d30d5a7e5ef8d1005eaafd4b3fbe&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;hex&quot; : &quot;473044022055bac1856ecbc377dd5e869b1a84ed1d5228c987b098c095030c12431a4d5249022055523130a9d0af5fc27828aba43b464ecb1991172ba2a509b5fbd6cac97ff3af0141048aefd78bba80e2d1686225b755dacea890c9ca1be10ec98173d7d5f2fefbbf881a6e918f3b051f8aaaa3fcc18bbf65097ce8d30d5a7e5ef8d1005eaafd4b3fbe&quot;<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
},<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;sequence&quot; : 4294967295<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
},<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
{<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;txid&quot; : &quot;b79a4803014177ea0139c95f09c6903c01bb8f80d039631afd68cabf7eb0f3c9&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;vout&quot; : 1,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;scriptSig&quot; : {<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;asm&quot; : &quot;304402206b993231adec55e6085e75f7dc5ca6c19e42e744cd60abaff957b1c352b3ef9a022022a22fec37dfa2c646c78d9a0753d56cb4393e8d0b22dc580ef1aa6cccef208d01 042ff65bd6b3ef04253225405ccc3ab2dd926ff2ee48aac210819698440f35d785ec3cec92a51330eb0c76cf49e9e474fb9159ab41653a9c1725c031449d31026a&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;hex&quot; : &quot;47304402206b993231adec55e6085e75f7dc5ca6c19e42e744cd60abaff957b1c352b3ef9a022022a22fec37dfa2c646c78d9a0753d56cb4393e8d0b22dc580ef1aa6cccef208d0141042ff65bd6b3ef04253225405ccc3ab2dd926ff2ee48aac210819698440f35d785ec3cec92a51330eb0c76cf49e9e474fb9159ab41653a9c1725c031449d31026a&quot;<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
},<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;sequence&quot; : 4294967295<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
},<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
{<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;txid&quot; : &quot;da30b272fb73d78108ff80ddd1ac2f76419533af79ad06a5b3c70fc4a62086c9&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;vout&quot; : 1,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;scriptSig&quot; : {<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;asm&quot; : &quot;3045022040a5d957e087ed61e80f1110bcaf4901b5317c257711a6cbc54d6b98b6a8563f02210081e3697031fe82774b8f44dd3660901e61ac5a99bff2d0efc83ad261da5b4f1d01 04a7d1a57e650613d3414ebd59e3192229dc09d3613e547bdd1f83435cc4ca0a11c679d96456cae75b1f5563728ec7da1c1f42606db15bf554dbe8a829f3a8fe2f&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;hex&quot; : &quot;483045022040a5d957e087ed61e80f1110bcaf4901b5317c257711a6cbc54d6b98b6a8563f02210081e3697031fe82774b8f44dd3660901e61ac5a99bff2d0efc83ad261da5b4f1d014104a7d1a57e650613d3414ebd59e3192229dc09d3613e547bdd1f83435cc4ca0a11c679d96456cae75b1f5563728ec7da1c1f42606db15bf554dbe8a829f3a8fe2f&quot;<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
},<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;sequence&quot; : 4294967295<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
}<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
],<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;vout&rdquo; : [<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
{<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;value&quot; : 0.84000000,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;n&quot; : 0,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;scriptPubKey&quot; : {<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;asm&quot; : &quot;OP_DUP OP_HASH160 634228c26cf40a02a05db93f2f98b768a8e0e61b OP_EQUALVERIFY OP_CHECKSIG&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;hex&quot; : &quot;76a914634228c26cf40a02a05db93f2f98b768a8e0e61b88ac&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;reqSigs&quot; : 1,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;type&quot; : &quot;pubkeyhash&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;addresses&quot; : [<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;1A3q9pDtR4h8wpvyb8SVpiNPpT8ZNbHY8h&quot;<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
]<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
}<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
},<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
{<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;value&rdquo; : 156.83000000,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;n&rdquo; : 1,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;scriptPubKey&rdquo; : {<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;asm&rdquo; : &ldquo;OP_DUP OP_HASH160 7514080ab2fcac0764de3a77d10cb790c71c74c2 OP_EQUALVERIFY OP_CHECKSIG&rdquo;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;hex&rdquo; : &ldquo;76a9147514080ab2fcac0764de3a77d10cb790c71c74c288ac&rdquo;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;reqSigs&rdquo; : 1,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;type&rdquo; : &ldquo;pubkeyhash&rdquo;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;addresses&rdquo; : [<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;1Bg44FZsoTeYteRykC1XHz8facWYKhGvQ8&quot;<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
]<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
}<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
}<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
],<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;blockhash&rdquo; : &ldquo;0000000000007c639f2cbb23e4606a1d022fa4206353b9d92e99f5144bd74611&Prime;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;confirmations&rdquo; : 147751,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;time&rdquo; : 1301705313,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;blocktime&rdquo; : 1301705313<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
}<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
字段hex记录了所有相关信息，后面显示的是hex解析出来的各类字段信息。下面把逐个分解hex内容（hex可以从上面的直接看到）：<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
01000000 // 版本号，UINT32<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
03 // Tx输入数量，变长INT。3个输入。</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">/*** 第一组Input Tx ***/<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
// Tx Hash，固定32字节<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
c9f3b07ebfca68fd1a6339d0808fbb013c90c6095fc93901ea77410103489ab7<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
00000000 // 消费的Tx位于前向交易输出的第0个，UINT32，固定4字节<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
8a // 签名的长度, 0x8A = 138字节<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
// 138字节长度的签名，含有两个部分：公钥+签名<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
47 // 公钥长度，0&times;47 = 71字节<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
3044022055bac1856ecbc377dd5e869b1a84ed1d5228c987b098c095030c12431a4d5249022055523130a9d0af5fc27828aba43b464ecb1991172ba2a509b5fbd6cac97ff3af01<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
41 // 签名长度，0&times;41 = 65字节<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
048aefd78bba80e2d1686225b755dacea890c9ca1be10ec98173d7d5f2fefbbf881a6e918f3b051f8aaaa3fcc18bbf65097ce8d30d5a7e5ef8d1005eaafd4b3fbe<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
ffffffff // sequence，0xffffffff = 4294967295， UINT32, 固定4字节</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">/*** 第二组Input Tx。与上同理，省略分解 ***/<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
c9f3b07ebfca68fd1a6339d0808fbb013c90c6095fc93901ea77410103489ab7010000008a47304402206b993231adec55e6085e75f7dc5ca6c19e42e744cd60abaff957b1c352b3ef9a022022a22fec37dfa2c646c78d9a0753d56cb4393e8d0b22dc580ef1aa6cccef208d0141042ff65bd6b3ef04253225405ccc3ab2dd926ff2ee48aac210819698440f35d785ec3cec92a51330eb0c76cf49e9e474fb9159ab41653a9c1725c031449d31026affffffff</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">/*** 第三组Input Tx ***/<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
c98620a6c40fc7b3a506ad79af339541762facd1dd80ff0881d773fb72b230da010000008b483045022040a5d957e087ed61e80f1110bcaf4901b5317c257711a6cbc54d6b98b6a8563f02210081e3697031fe82774b8f44dd3660901e61ac5a99bff2d0efc83ad261da5b4f1d014104a7d1a57e650613d3414ebd59e3192229dc09d3613e547bdd1f83435cc4ca0a11c679d96456cae75b1f5563728ec7da1c1f42606db15bf554dbe8a829f3a8fe2fffffffff</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">02 // Tx输出数量，变长INT。两个输出。</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">/*** 第一组输出 ***/<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
00bd010500000000 // 输出的币值，UINT64，8个字节。字节序需翻转，~= 0x000000000501bd00 = 84000000 satoshi<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
19 // 输出目的地址字节数, 0&times;19 = 25字节，由一些操作码与数值构成<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
// 目标地址<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
// 0&times;76 -&gt; OP_DUP(stack ops)<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
// 0xa9 -&gt; OP_HASH160(crypto)<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
// 0&times;14 -&gt; 长度，0&times;14 = 20字节<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
76 a9 14<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
// 地址的HASH160值，20字节<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
634228c26cf40a02a05db93f2f98b768a8e0e61b<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
// 0&times;88 -&gt; OP_EQUALVERIFY(bit logic)<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
// 0xac -&gt; OP_CHECKSIG(crypto)<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
88 ac</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">/*** 第二组输出 ***/<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
c096c7a603000000<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
19<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
76 a9 14 7514080ab2fcac0764de3a77d10cb790c71c74c2 88 ac</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">00000000 // lock_time，UINT32，固定4字节<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
Tx Hash，俗称交易ID，由hex得出：Tx Hash =&nbsp;<a href="http://8btc.com/article-136-1.html" rel="nofollow" class="relatedlink" target="_blank" style="box-sizing: border-box; outline: 0px; text-decoration-line: none; word-break: break-all; border-bottom: 1px solid rgb(0, 0, 255); color: rgb(68, 68, 68) !important;">SHA256</a>(SHA256(hex))。由于每个交易只能成为下一个的输入，有且仅有一次，那么不存在输入完全相同的交易，那么就不存在相同的Tx Hash（SHA256碰撞概率极小，所以无需考虑Hash碰撞的问题，就像无需考虑地址私钥被别人撞到一样）。</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">即便如此，在系统里依然产生了相同的Tx Hash，是某位矿工兄弟挖出Block后，打包Block时忘记修改Generation Tx coinbase字段的值，币量相同且输出至相同的地址，那么就构造了两个完全一模一样的交易，分别位于两个Block的第一个位置。这个对系统不会产生什么问题，但只要花费其中一笔，另一个也被花费了。相同的Generation Tx相当于覆盖了另一个，白白损失了挖出的币。该交易ID为e3bf3d07d4b0375638d5f1db5255fe07ba2c4cb067cd81b84ee974b6585fb468，第一次出现在#91722，第二次出现在#91880。</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><img class="alignnone size-full wp-image-5742" alt="b01dc7da-3edf-11e3-86eb-d015037e9440" src="http://7fvhfe.com1.z0.glb.clouddn.com/@/wp-content/uploads/2013/11/b01dc7da-3edf-11e3-86eb-d015037e9440.png" style="box-sizing: border-box; outline: 0px; max-width: 100%; margin: 0px; word-break: break-all; cursor: zoom-in; vertical-align: middle; border: 0px;" /></p>
<h2 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px; font-size: 30px; color: rgb(85, 85, 85); font-weight: 500; line-height: 1.1; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><a name="t7" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>交易签名</h2>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">签名是对所有权的验证，节点收到交易广播后，会对交易进行验证，通过后则收录进内存、打包进Block，否则，丢弃之。签名就类似传统纸质合同盖章、签字过程，合法转移所有权的保证手段。</p>
<h2 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px; font-size: 30px; color: rgb(85, 85, 85); font-weight: 500; line-height: 1.1; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><a name="t8" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>签名类型</h2>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">由于一个交易的输入、输出都可能具有多个，那么签名也具有多种类型，目前共三类：SIGHASH_ALL, SIGHASH_NONE, SIGHASH_SINGLE。</p>
<h2 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px; font-size: 30px; color: rgb(85, 85, 85); font-weight: 500; line-height: 1.1; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><a name="t9" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>SIGHASH_ALL</h2>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">该签名类型为默认类型，也是目前绝大部分交易采用的，顾名思义即签名整单交易。首先，组织所有输出、输入，就像上文分解Hex过程一样，每个输入都对应一个签名，暂时留空，其他包括sequence等字段均须填写，这样就形成了一个完整的交易Hex（只缺签名字段）。然后，每一个输入均需使用私钥对该段数据进行签名，签名完成后各自填入相应的位置，N个输入N个签名。简单理解就是：对于该笔单子，认可且只认可的这些输入、输出，并同意花费我的那笔输入。</p>
<h2 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px; font-size: 30px; color: rgb(85, 85, 85); font-weight: 500; line-height: 1.1; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><a name="t10" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>SIGHASH_NONE</h2>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">该签名类型是最自由松散的，仅对输入签名，不对输出签名，输出可以任意指定。某人对某笔币签名后交给你，你可以在任意时刻填入任意接受地址，广播出去令其生效。简单理解就是：我同意花费我的那笔钱，至于给谁，我不关心。</p>
<h2 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px; font-size: 30px; color: rgb(85, 85, 85); font-weight: 500; line-height: 1.1; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><a name="t11" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>SIGHASH_SINGLE</h2>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">该签名类型其次自由松散，仅对自己的输入、输出签名，并留空sequence字段。其输入的次序对应其输出的次序，比如输入是第3个，那么签名的输出也是第三个。简单理解就是：我同意花费我的那笔钱，且只能花费到我认可的输出，至于单子里的其他输入、输出，我不关心。</p>
<h2 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px; font-size: 30px; color: rgb(85, 85, 85); font-weight: 500; line-height: 1.1; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><a name="t12" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>交易的构造、签名与广播</h2>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">上篇介绍了交易结构、签名等，为了更直观的认识比特币，借助bitcoind演示手动构造并广播交易的完整过程。</p>
<h2 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px; font-size: 30px; color: rgb(85, 85, 85); font-weight: 500; line-height: 1.1; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><a name="t13" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>普通交易</h2>
<h3 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px; font-size: 24px; color: rgb(85, 85, 85); font-weight: 500; line-height: 1.1; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><a name="t14" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>1. 找出未花费的币（unspent output）</h3>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">通过命令：listunspent [minconf=1] [maxconf=9999999] [&quot;address&quot;,...]列出某个地址未花费的币(交易)，minconf/maxconf表示该笔收入交易的确认数范围，如果需要列出还未确认的交易，需将minconf设置为0。</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">执行：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 1em; line-height: 1.5;">bitcoind listunspent 0 100 &lsquo;[&quot;1Lab618UuWjLmVA1Q64tHZXcLoc4397ZX3&quot;]&lsquo;</span><br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
输出：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 1em; line-height: 1.5;">[</span><br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
{<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;txid&quot; : &quot;296ea7bf981b44999d689853d17fe0ceb852a8a34e68fcd19f0a41e589132156&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;vout&quot; : 0,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;address&quot; : &quot;1Lab618UuWjLmVA1Q64tHZXcLoc4397ZX3&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;account&quot; : &quot;&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;scriptPubKey&quot; : &quot;76a914d6c492056f3f99692b56967a42b8ad44ce76b67a88ac&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;amount&quot; : 0.19900000,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;confirmations&quot; : 1<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
}<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
]<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
我们找到该地址的一个未花费交易，位于交易296ea7bf981b4499&hellip;9f0a41e589132156的第0个位置。</p>
<h3 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px; font-size: 24px; color: rgb(85, 85, 85); font-weight: 500; line-height: 1.1; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><a name="t15" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>2. 创建待发送交易</h3>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">创建待发送交易，由命令：createrawtransaction [{&quot;txid&quot;:txid,&quot;vout&quot;:n},...] {address:amount,&hellip;}来完成。我们将 0.1 BTC发送至 1Q8s4qDRbCbFypG5AFNR9tFC57PStkPX1x ，并支付 0.0001 BTC做为矿工费。输入交易的额度为 0.199 ，输出为 0.1 + 0.0001 = 0.1001 ，那么还剩余： 0.199 &ndash; 0.1001 = 0.0989 ，将此作为找零发回给自己。</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">执行：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">bitcoind createrawtransaction \<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&lsquo;[{&quot;txid&quot;:&quot;296ea7bf981b44999d689853d17fe0ceb852a8a34e68fcd19f0a41e589132156&quot;,&quot;vout&quot;:0}]&lsquo; \<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&lsquo;{&ldquo;1Q8s4qDRbCbFypG5AFNR9tFC57PStkPX1x&rdquo;:0.1, &ldquo;1Lab618UuWjLmVA1Q64tHZXcLoc4397ZX3&Prime;:0.0989}&rsquo;<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
输出：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 1em; line-height: 1.5;">010000000156211389e5410a9fd1fc684ea3a852b8cee07fd15398689d99441b98bfa76e290000000000ffffffff0280969800000000001976a914fdc7990956642433ea75cabdcc0a9447c5d2b4ee88acd0e89600000000001976a914d6c492056f3f99692b56967a42b8ad44ce76b67a88ac00000000</span><br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
通过命令：decoderawtransaction&nbsp;，可以将此段十六进制字符串解码。</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">执行：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 1em; line-height: 1.5;">bitcoind decoderawtransaction &rsquo;010000000156211389e5410a9fd1fc684ea3a852b8cee07fd15398689d99441b98bfa76e290000000000ffffffff0280969800000000001976a914fdc7990956642433ea75cabdcc0a9447c5d2b4ee88acd0e89600000000001976a914d6c492056f3f99692b56967a42b8ad44ce76b67a88ac00000000&prime;</span><br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
输出：<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
{<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;txid&rdquo; : &ldquo;54f773a3fdf7cb3292fc76b46c97e536348b3a0715886dbfd2f60e115fb3a8f0&Prime;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;version&rdquo; : 1,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;locktime&rdquo; : 0,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;vin&rdquo; : [<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
{<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;txid&quot; : &quot;296ea7bf981b44999d689853d17fe0ceb852a8a34e68fcd19f0a41e589132156&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;vout&quot; : 0,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;scriptSig&quot; : {<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;asm&quot; : &quot;&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;hex&quot; : &quot;&quot;<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
},<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;sequence&quot; : 4294967295<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
}<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
],<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;vout&rdquo; : [<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
{<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;value&quot; : 0.10000000,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;n&quot; : 0,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;scriptPubKey&quot; : {<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;asm&quot; : &quot;OP_DUP OP_HASH160 fdc7990956642433ea75cabdcc0a9447c5d2b4ee OP_EQUALVERIFY OP_CHECKSIG&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;hex&quot; : &quot;76a914fdc7990956642433ea75cabdcc0a9447c5d2b4ee88ac&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;reqSigs&quot; : 1,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;type&quot; : &quot;pubkeyhash&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;addresses&quot; : [<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;1Q8s4qDRbCbFypG5AFNR9tFC57PStkPX1x&quot;<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
]<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
}<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
},<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
{<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;value&rdquo; : 0.09890000,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;n&rdquo; : 1,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;scriptPubKey&rdquo; : {<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;asm&rdquo; : &ldquo;OP_DUP OP_HASH160 d6c492056f3f99692b56967a42b8ad44ce76b67a OP_EQUALVERIFY OP_CHECKSIG&rdquo;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;hex&rdquo; : &ldquo;76a914d6c492056f3f99692b56967a42b8ad44ce76b67a88ac&rdquo;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;reqSigs&rdquo; : 1,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;type&rdquo; : &ldquo;pubkeyhash&rdquo;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;addresses&rdquo; : [<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;1Lab618UuWjLmVA1Q64tHZXcLoc4397ZX3&quot;<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
]<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
}<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
}<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
]<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
}<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
至此，一个&ldquo;空白交易&rdquo;就构造好了，尚未使用私钥对交易进行签名，字段scriptSig是留空的，无签名的交易是无效的。此时的Tx ID并不是最终的Tx ID，填入签名后Tx ID会发生变化。</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">在手动创建交易时，务必注意输入、输出的值，非常容易犯错的是忘记构造找零输出（如非必要勿手动构造交易）。曾经有人构造交易时忘记找零，发生了支付 200 BTC 的矿工费的人间惨剧，所幸的是收录该笔交易的Block由著名挖矿团队&ldquo;烤猫（Friedcat）&rdquo;挖得，该团队非常厚道的退回了多余费用。</p>
<h3 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px; font-size: 24px; color: rgb(85, 85, 85); font-weight: 500; line-height: 1.1; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><a name="t16" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>3. 签名</h3>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">交易签名使用命令：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 1em; line-height: 1.5;">signrawtransaction&nbsp;\</span><br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
[{&quot;txid&quot;:txid,&quot;vout&quot;:n,&quot;scriptPubKey&quot;:hex,&quot;redeemScript&quot;:hex},...] [,...] \<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
[sighashtype=&quot;ALL&quot;]<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
第一个参数是创建的待签名交易的十六进制字符串；<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
第二个参数有点类似创建交易时的参数，不过需要多出一个公钥字段scriptPubKey，其他节点验证交易时是通过公钥和签名来完成的，所以要提供公钥；如果是合成地址，则需要提供redeemScript；<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
第三个参数是即将花费的币所在地址的私钥，用来对交易进行签名，如果该地址私钥已经导入至bitcoind中，则无需显式提供；<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
最后一个参数表示签名类型，在上一篇里，介绍了三种交易签名类型；<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
签名之前需要找到scriptPubKey，提取输入交易信息即可获取(也可以根据其公钥自行计算)，由命令：getrawtransaction&nbsp;[verbose=0]完成。</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">执行：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 1em; line-height: 1.5;">bitcoind getrawtransaction 296ea7bf981b44999d689853d17fe0ceb852a8a34e68fcd19f0a41e589132156 1</span><br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
输出：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 1em; line-height: 1.5;">{</span><br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;hex&rdquo; : &ldquo;01000000010511331f639e974283d3909496787a660583dc88f41598d177e225b5f352314a000000006c493046022100be8c796122ec598295e6dfd6664a20a7e20704a17f76d3d925c9ec421ca60bc1022100cf9f2d7b9f24285f7c119c91f24521e5483f6b141de6ee55658fa70116ee04d4012103cad07f6de0b181891b5291a5bc82b228fe6509699648b0b53556dc0057eeb5a4ffffffff0160a62f01000000001976a914d6c492056f3f99692b56967a42b8ad44ce76b67a88ac00000000&Prime;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;txid&rdquo; : &ldquo;296ea7bf981b44999d689853d17fe0ceb852a8a34e68fcd19f0a41e589132156&Prime;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;version&rdquo; : 1,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;locktime&rdquo; : 0,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;vin&rdquo; : [<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
{<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;txid&quot; : &quot;4a3152f3b525e277d19815f488dc8305667a78969490d38342979e631f331105&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;vout&quot; : 0,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;scriptSig&quot; : {<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;asm&quot; : &quot;3046022100be8c796122ec598295e6dfd6664a20a7e20704a17f76d3d925c9ec421ca60bc1022100cf9f2d7b9f24285f7c119c91f24521e5483f6b141de6ee55658fa70116ee04d401 03cad07f6de0b181891b5291a5bc82b228fe6509699648b0b53556dc0057eeb5a4&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;hex&quot; : &quot;493046022100be8c796122ec598295e6dfd6664a20a7e20704a17f76d3d925c9ec421ca60bc1022100cf9f2d7b9f24285f7c119c91f24521e5483f6b141de6ee55658fa70116ee04d4012103cad07f6de0b181891b5291a5bc82b228fe6509699648b0b53556dc0057eeb5a4&quot;<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
},<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;sequence&quot; : 4294967295<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
}<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
],<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;vout&rdquo; : [<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
{<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;value&quot; : 0.19900000,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;n&quot; : 0,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;scriptPubKey&quot; : {<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;asm&quot; : &quot;OP_DUP OP_HASH160 d6c492056f3f99692b56967a42b8ad44ce76b67a OP_EQUALVERIFY OP_CHECKSIG&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;hex&quot; : &quot;76a914d6c492056f3f99692b56967a42b8ad44ce76b67a88ac&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;reqSigs&quot; : 1,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;type&quot; : &quot;pubkeyhash&quot;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;addresses&quot; : [<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&quot;1Lab618UuWjLmVA1Q64tHZXcLoc4397ZX3&quot;<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
]<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
}<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
}<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
],<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;blockhash&rdquo; : &ldquo;000000000000000488f18f7659acd85b2bd06a5ed2c4439eea74a8b968d16656&Prime;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;confirmations&rdquo; : 19,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;time&rdquo; : 1383235737,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;blocktime&rdquo; : 1383235737<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
}<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
scriptPubKey位于&rdquo;vout&rdquo;[0]&ndash;&gt;&ldquo;scriptPubKey&rdquo;&ndash;&gt;&ldquo;hex&rdquo;，即： 76a914d6c492056f3f99692b56967a42b8ad44ce76b67a88ac 。</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">签名使用<a href="http://8btc.com/article-140-1.html" rel="nofollow" class="relatedlink" target="_blank" style="box-sizing: border-box; outline: 0px; text-decoration-line: none; word-break: break-all; border-bottom: 1px solid rgb(0, 0, 255); color: rgb(68, 68, 68) !important;">ECDSA</a>算法，对其，&ldquo;空白交易&rdquo;签名之，执行：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 1em; line-height: 1.5;">bitcoind signrawtransaction \</span><br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;010000000156211389e5410a9fd1fc684ea3a852b8cee07fd15398689d99441b98bfa76e290000000000ffffffff0280969800000000001976a914fdc7990956642433ea75cabdcc0a9447c5d2b4ee88acd0e89600000000001976a914d6c492056f3f99692b56967a42b8ad44ce76b67a88ac00000000&Prime; \<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&lsquo;[{&quot;txid&quot;:&quot;296ea7bf981b44999d689853d17fe0ceb852a8a34e68fcd19f0a41e589132156&quot;,&quot;vout&quot;:0,&quot;scriptPubKey&quot;:&quot;76a914d6c492056f3f99692b56967a42b8ad44ce76b67a88ac&quot;}]&lsquo;<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
输出：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 1em; line-height: 1.5;">{</span><br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;hex&rdquo; : &ldquo;010000000156211389e5410a9fd1fc684ea3a852b8cee07fd15398689d99441b98bfa76e29000000008c493046022100f9da4f53a6a4a8317f6e7e9cd9a7b76e0f5e95dcdf70f1b1e2b3548eaa3a6975022100858d48aed79da8873e09b0e41691f7f3e518ce9a88ea3d03f7b32eb818f6068801410477c075474b6798c6e2254d3d06c1ae3b91318ca5cc62d18398697208549f798e28efb6c55971a1de68cca81215dd53686c31ad8155cdc03563bf3f73ce87b4aaffffffff0280969800000000001976a914fdc7990956642433ea75cabdcc0a9447c5d2b4ee88acd0e89600000000001976a914d6c492056f3f99692b56967a42b8ad44ce76b67a88ac00000000&Prime;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;complete&rdquo; : true<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
}<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
签名后，签名值会填入上文所述的空字段中，从而得到一个完整的交易。可通过上文介绍的命令decoderawtransaction&nbsp;解码查看之。</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">最后一步，就是将其广播出去，等待网络传播至所有节点，约10~60秒广播至全球节点，取决与你的节点的网络连接状况。稍后一些时刻，就会进入Block中。广播由命令sendrawtransaction&nbsp;来完成。如果没有运行节点，可以通过公共节点的API进行广播，例如：blockchain.info/pushtx。</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">执行：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 1em; line-height: 1.5;">bitcoind sendrawtransaction \</span><br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;010000000156211389e5410a9fd1fc684ea3a852b8cee07fd15398689d99441b98bfa76e29000000008c493046022100f9da4f53a6a4a8317f6e7e9cd9a7b76e0f5e95dcdf70f1b1e2b3548eaa3a6975022100858d48aed79da8873e09b0e41691f7f3e518ce9a88ea3d03f7b32eb818f6068801410477c075474b6798c6e2254d3d06c1ae3b91318ca5cc62d18398697208549f798e28efb6c55971a1de68cca81215dd53686c31ad8155cdc03563bf3f73ce87b4aaffffffff0280969800000000001976a914fdc7990956642433ea75cabdcc0a9447c5d2b4ee88acd0e89600000000001976a914d6c492056f3f99692b56967a42b8ad44ce76b67a88ac00000000&Prime;<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
输出：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 1em; line-height: 1.5;">b5f8da1ea9e02ec3cc0765f9600f49945e94ed4b0c88ed0648896bf3e213205d</span><br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
返回的是Transaction Hash值，即该交易的ID。至此，交易构造、签名、发送的完整过程完成了。</p>
<h2 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px; font-size: 30px; color: rgb(85, 85, 85); font-weight: 500; line-height: 1.1; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><a name="t17" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>合成地址交易</h2>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">合成地址以3开头，可以实现多方管理资产，极大提高安全性，也可以轻松实现基于比特币原生的三方交易担保支付。一个M-of-N的模式：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 1em; line-height: 1.5;">m {pubkey}&hellip;{pubkey} n OP_CHECKMULTISIG</span><br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
M和N需满足：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">1&lt;=N&lt;=3<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
1&lt;=M&lt;=N<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
可以是1 of 1，1 of 2，2 of 3等组合，通常选择N=3：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">1 of 3，最大程度私钥冗余。防丢私钥损失，3把私钥中任意一把即可签名发币，即使丢失2把都可以保障不受损失；<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
2 of 3，提高私钥冗余度的同时解决单点信任问题。3把私钥任意2把私钥可签名发币，三方不完全信任的情形，即中介交易中，非常适用；<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
3 of 3，最大程度解决资金信任问题，无私钥冗余。必须3把私钥全部签名才能发币，适用多方共同管理重要资产，但任何一方遗失私钥均造成严重损失；<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
合成地址的交易构造、签名、发送过程与普通交易类似，这里只介绍如何创建一个合成地址。大神Gavin Andresen已经演示过，下面内容摘自其gist.</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">首先，需要三对公钥、私钥。公钥创建地址、私钥用于签名。</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 1em; line-height: 1.5;"># No.1</span><br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
0491bba2510912a5bd37da1fb5b1673010e43d2c6d812c514e91bfa9f2eb129e1c183329db55bd868e209aac2fbc02cb33d98fe74bf23f0c235d6126b1d8334f86 / 5JaTXbAUmfPYZFRwrYaALK48fN6sFJp4rHqq2QSXs8ucfpE4yQU<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
# No.2<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
04865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac09ef122b1a986818a7cb624532f062c1d1f8722084861c5c3291ccffef4ec6874 / 5Jb7fCeh1Wtm4yBBg3q3XbT6B525i17kVhy3vMC9AqfR6FH2qGk<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
# No.3<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
048d2455d2403e08708fc1f556002f1b6cd83f992d085097f9974ab08a28838f07896fbab08f39495e15fa6fad6edbfb1e754e35fa1c7844c41f322a1863d46213 / 5JFjmGo5Fww9p8gvx48qBYDJNAzR9pmH5S389axMtDyPT8ddqmw<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
使用命令：createmultisig&nbsp;&lt;&rsquo;[&quot;key&quot;,&quot;key&quot;]&lsquo;&gt;来合成，其中key为公钥，创建地址时仅需公钥。创建类型是2 of 3.</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;">输入：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 1em; line-height: 1.5;">bitcoind createmultisig 2 \</span><br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&lsquo;[&quot;0491bba2510912a5bd37da1fb5b1673010e43d2c6d812c514e91bfa9f2eb129e1c183329db55bd868e209aac2fbc02cb33d98fe74bf23f0c235d6126b1d8334f86&quot;,&quot;04865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac09ef122b1a986818a7cb624532f062c1d1f8722084861c5c3291ccffef4ec6874&quot;,&quot;048d2455d2403e08708fc1f556002f1b6cd83f992d085097f9974ab08a28838f07896fbab08f39495e15fa6fad6edbfb1e754e35fa1c7844c41f322a1863d46213&quot;]&lsquo;<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
输出：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(85, 85, 85); line-height: 20px; text-align: justify; word-break: break-all; font-family: &quot;Microsoft YaHei&quot;, &quot;Helvetica Neue&quot;, Helvetica, Arial;"><span style="box-sizing: border-box; outline: 0px; word-break: break-all; font-size: 1em; line-height: 1.5;">{</span><br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;address&rdquo; : &ldquo;3QJmV3qfvL9SuYo34YihAf3sRCW3qSinyC&rdquo;,<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
&ldquo;redeemScript&rdquo; : &ldquo;52410491bba2510912a5bd37da1fb5b1673010e43d2c6d812c514e91bfa9f2eb129e1c183329db55bd868e209aac2fbc02cb33d98fe74bf23f0c235d6126b1d8334f864104865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac09ef122b1a986818a7cb624532f062c1d1f8722084861c5c3291ccffef4ec687441048d2455d2403e08708fc1f556002f1b6cd83f992d085097f9974ab08a28838f07896fbab08f39495e15fa6fad6edbfb1e754e35fa1c7844c41f322a1863d4621353ae&rdquo;<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
}<br style="box-sizing: border-box; outline: 0px; word-break: break-all;" />
得到的合成地址是：3QJmV3qfvL9SuYo34YihAf3sRCW3qSinyC，该地址没有公钥，仅有redeemScript，作用与公钥相同。后续的构造、签名、发送过程与上文普通地址交易类似，略去。</p>]]></description>
			<link>http://meisw.wdlinux.cn//show-1048-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-60-1.html">比特币</category>
			<pubDate>2018-08-18 20:18</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-1047-1.html</guid>
			<title>比特币交易签名过程详解</title>
			<author>admin</author>
			<description><![CDATA[<p>&nbsp;<span style="color: rgb(79, 79, 79); font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; font-size: 16px; text-align: justify;">最近在研究比特币交易签名计算，网上没有完整介绍签名过程的例子。本文力图提供一个完整例子，详细介绍比特币签名的计算过程。</span></p>
<h1 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px; font-size: 28px; color: rgb(79, 79, 79); line-height: 36px; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;"><a name="t0" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>1. 比特币交易的格式</h1>
<h2 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px; font-size: 24px; color: rgb(79, 79, 79); line-height: 32px; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;"><a name="t1" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>交易数据格式</h2>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">大小　　 字段名称　　数据类型 　　　　描述</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">4字节　　协议版本 　　uint32_t　　　 明确这笔交易参照的规则协议的版本号</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">1-9字节　输入数量　　　var_int　　　被包含的输入交易的数量</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">不定 　　输入列表　　　tx_in[]　　　 一个或多个输入交易构成的数组</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">1-9字节　输出数量　　　var_int　　　被包含的输出交易的数量</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">不定　　 输出列表　　　tx_out[]　　　一个或多个输出交易构成的数组</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">4字节　　锁定时间　　 uint32_t　　　 一个UNIX时间戳或区块号</p>
<h2 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px 0cm; font-size: 24px; color: rgb(79, 79, 79); line-height: 32px; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;"><a name="t2" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>tx_in 格式</h2>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">其中tx_in 包括：</p>
<table border="1" cellspacing="0" style="box-sizing: border-box; outline: 0px; border-collapse: collapse; border-spacing: 0px; width: 852px; margin-bottom: 24px; word-break: break-all; color: rgb(51, 51, 51); font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; font-size: 14px;">
    <tbody style="box-sizing: border-box; outline: 0px; border: 0px; word-break: break-all;">
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); word-break: break-all;">
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 42.3pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">字段尺寸</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 100.8pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">描述</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 69.3pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">数据类型</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 202.4pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">说明</p>
            </td>
        </tr>
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); background-color: rgb(247, 247, 247); word-break: break-all;">
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 42.3pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">36</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 100.8pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">previous_output</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 69.3pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">outpoint</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 202.4pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">对前一输出的引用</p>
            </td>
        </tr>
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); word-break: break-all;">
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 42.3pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">1+</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 100.8pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">script length</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 69.3pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">var_int</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 202.4pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">signature script 的长度</p>
            </td>
        </tr>
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); background-color: rgb(247, 247, 247); word-break: break-all;">
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 42.3pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">?</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 100.8pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">signature script</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 69.3pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">uchar[]</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 202.4pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">用于确认交易授权的计算脚本</p>
            </td>
        </tr>
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); word-break: break-all;">
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 42.3pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">4</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 100.8pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">sequence</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 69.3pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">unit32_t</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 202.4pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">Used for locktime or disabled(0xFFFFFFFF)</p>
            </td>
        </tr>
    </tbody>
</table>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">&nbsp;</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">OutPoint结构的构成：</p>
<table border="1" cellspacing="0" style="box-sizing: border-box; outline: 0px; border-collapse: collapse; border-spacing: 0px; width: 852px; margin-bottom: 24px; word-break: break-all; color: rgb(51, 51, 51); font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; font-size: 14px;">
    <tbody style="box-sizing: border-box; outline: 0px; border: 0px; word-break: break-all;">
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); word-break: break-all;">
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; width: 63.55pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; font-weight: 700; word-break: break-all;">字段尺寸</span></p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; width: 2cm;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; font-weight: 700; word-break: break-all;">描述</span></p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; width: 63.8pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; font-weight: 700; word-break: break-all;">数据类型</span></p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; width: 230.75pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; font-weight: 700; word-break: break-all;">说明</span></p>
            </td>
        </tr>
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); background-color: rgb(247, 247, 247); word-break: break-all;">
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; width: 63.55pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">32</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; width: 2cm;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">hash</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; width: 63.8pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">char[32]</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; width: 230.75pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">引用的交易的散列</p>
            </td>
        </tr>
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); word-break: break-all;">
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; width: 63.55pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">4</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; width: 2cm;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">index</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; width: 63.8pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">uint32_t</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; width: 230.75pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;"><span style="box-sizing: border-box; outline: 0px; font-weight: 700; word-break: break-all;">指定输出的索引，第一笔输出的索引是0，以此类推</span></p>
            </td>
        </tr>
    </tbody>
</table>
<h2 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px 0cm; font-size: 24px; color: rgb(79, 79, 79); line-height: 32px; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;"><a name="t3" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>tx_out的构成：</h2>
<table border="1" cellspacing="0" style="box-sizing: border-box; outline: 0px; border-collapse: collapse; border-spacing: 0px; width: 852px; margin-bottom: 24px; word-break: break-all; color: rgb(51, 51, 51); font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun; font-size: 14px;">
    <tbody style="box-sizing: border-box; outline: 0px; border: 0px; word-break: break-all;">
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); word-break: break-all;">
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 42.3pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">字段尺寸</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 64.8pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">描述</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 69.85pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">数据类型</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 237.85pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">说明</p>
            </td>
        </tr>
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); background-color: rgb(247, 247, 247); word-break: break-all;">
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 42.3pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">8</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 64.8pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">value</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 69.85pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">uint64_t</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 237.85pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">交易的比特币数量(单位是0.00000001)</p>
            </td>
        </tr>
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); word-break: break-all;">
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 42.3pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">1+</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 64.8pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">pk_script</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 69.85pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">var_int</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 237.85pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">pk_script的长度</p>
            </td>
        </tr>
        <tr style="box-sizing: border-box; outline: 0px; border-width: 1px 0px 0px; border-right-style: initial; border-bottom-style: initial; border-left-style: initial; border-right-color: initial; border-bottom-color: initial; border-left-color: initial; border-image: initial; border-top-style: solid; border-top-color: rgb(221, 221, 221); background-color: rgb(247, 247, 247); word-break: break-all;">
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 42.3pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">?</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 64.8pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">pk_script</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 69.85pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">uchar[]</p>
            </td>
            <td style="box-sizing: border-box; outline: 0px; padding: 8px; margin: 0px; word-break: break-all; border: 1px solid rgb(221, 221, 221); color: rgb(79, 79, 79); line-height: 22px; vertical-align: top; width: 237.85pt;">
            <p style="box-sizing: border-box; outline: 0px; margin-bottom: 0px; margin-left: 0cm; line-height: 22px; word-break: break-all;">Usually contains the public key as a Bitcoin script setting up conditions to claim this output</p>
            </td>
        </tr>
    </tbody>
</table>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">&nbsp;</p>
<h1 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px; font-size: 28px; color: rgb(79, 79, 79); line-height: 36px; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;"><a name="t4" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>2. 签名计算：</h1>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">将其他输入的pkscript长度调整为0,并末尾加上四字节小端序的sighash_type，并进行两次sha256：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;"><img alt="" class="has" src="https://img-blog.csdn.net/20180716191800230?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2JlYmVzdDIwMTA=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" style="box-sizing: border-box; outline: 0px; max-width: 100%; margin: 0px; word-break: break-all; cursor: zoom-in;" /></p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">在对这个hash进行签名计算，得出签名数据（签名时不用再计算hash，直接调用ecdsa-sign-digest）</p>
<h1 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px 0cm; font-size: 28px; color: rgb(79, 79, 79); line-height: 36px; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;"><a name="t5" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>3. 计算示例</h1>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">使用electrum生成的未签名数据示例：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">0100000001b37b9eefc3fa245f5ce36cb51c2d18a2d16e19d20867b23130e00f5280ccf82d010000002401ff210395cf5234e602954cba693138f3ba94c1cde7337675f5a94931e6226802d74d16fdffffff02002d3101000000001976a91425dc469afb4654d27742e3669bb3f5812268f2a188ac9ec2c901000000001976a9142dbbbd8bcff08a549be21efae747592049c9dc2d88ac71221300</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">&nbsp;</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">签名后的数据：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">0100000001b37b9eefc3fa245f5ce36cb51c2d18a2d16e19d20867b23130e00f5280ccf82d010000006a47304402202008714016f7e01c1a0010d7e6eb0b1f100b5a9b7c65a0506d62c1fbb9790cb102203daf6363c4039a739036ce152817f73d31319f060bbf5f354a0eeaf9f7ed3cd001210395cf5234e602954cba693138f3ba94c1cde7337675f5a94931e6226802d74d16fdffffff02002d3101000000001976a91425dc469afb4654d27742e3669bb3f5812268f2a188ac9ec2c901000000001976a9142dbbbd8bcff08a549be21efae747592049c9dc2d88ac71221300</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">交易记录：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">https://www.blocktrail.com/tBTC/tx/8c6375e4509a186539dbbc2936feef7671f256969c917b633ec5db6b23c78ed1</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">&nbsp;</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">计算过程：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">协议版本：01000000</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">输入数量：01</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">输入列表：</p>
<ul style="box-sizing: border-box; outline: 0px; margin-right: 0px; margin-bottom: 24px; margin-left: 0px; list-style: none; word-break: break-all; color: rgb(51, 51, 51); font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">
    <li style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 0px 32px; list-style-type: disc; word-break: break-all;">32字节 前一次交易的hash</li>
</ul>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b37b9eefc3fa245f5ce36cb51c2d18a2d16e19d20867b23130e00f5280ccf82d</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">（默认是大端，要去网上查询详情的话，用的是小端</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">2df8cc80520fe03031b26708d2196ed1a2182d1cb56ce35c5f24fac3ef9e7bb3）</p>
<ul style="box-sizing: border-box; outline: 0px; margin-right: 0px; margin-bottom: 24px; margin-left: 0px; list-style: none; word-break: break-all; color: rgb(51, 51, 51); font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">
    <li style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 0px 32px; list-style-type: disc; word-break: break-all;">4字节 前一次交易的输出index : 01000000（序号从0开始）</li>
    <li style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 0px 32px; list-style-type: disc; word-break: break-all;">Pkscript 长度：VI （1字节）0x19（25字节）</li>
    <li style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 0px 32px; list-style-type: disc; word-break: break-all;">Pkscript：</li>
</ul>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">OP_DUP（76） OP_HASH160（a9） 20字节数据（14）</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">2dbbbd8bcff08a549be21efae747592049c9dc2d OP_EQUALVERIFY （88）OP_CHECKSIG（ac）</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">&nbsp;</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">1976a9142dbbbd8bcff08a549be21efae747592049c9dc2d88ac</p>
<ul style="box-sizing: border-box; outline: 0px; margin-right: 0px; margin-bottom: 24px; margin-left: 0px; list-style: none; word-break: break-all; color: rgb(51, 51, 51); font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">
    <li style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 0px 32px; list-style-type: disc; word-break: break-all;">Sequence： fdffffff</li>
</ul>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">输出数量：02</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">输出列表：</p>
<ul style="box-sizing: border-box; outline: 0px; margin-right: 0px; margin-bottom: 24px; margin-left: 0px; list-style: none; word-break: break-all; color: rgb(51, 51, 51); font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">
    <li style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 0px 32px; list-style-type: disc; word-break: break-all;">Value： 8字节 002d310100000000</li>
    <li style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 0px 32px; list-style-type: disc; word-break: break-all;">Pkscript长度 0x19 （25）</li>
    <li style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 0px 32px; list-style-type: disc; word-break: break-all;">Pkscript：76a91425dc469afb4654d27742e3669bb3f5812268f2a188ac</li>
    <li style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 0px 32px; list-style-type: disc; word-break: break-all;">Value：8字节 9ec2c90100000000</li>
    <li style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 0px 32px; list-style-type: disc; word-break: break-all;">Pkscript长度 0x19 （25）</li>
    <li style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 0px 32px; list-style-type: disc; word-break: break-all;">Pkscript：76a9142dbbbd8bcff08a549be21efae747592049c9dc2d88ac</li>
</ul>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">锁定时间：71221300</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">HashType ：01000000（四字节）</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">&nbsp;</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">两次hash值 （405c87d455f2f26e554c05b657769e2af253135367bcc69d4d772f873d39a23c）</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">进行2次sha256后，调用ecdsa_verify_digest计算签名，不需要在对2次sha256后的数据进行hash后再计算签名</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">签名值：r，s：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">2008714016f7e01c1a0010d7e6eb0b1f100b5a9b7c65a0506d62c1fbb9790cb1</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">3daf6363c4039a739036ce152817f73d31319f060bbf5f354a0eeaf9f7ed3cd0</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">Pubk为0395cf5234e602954cba693138f3ba94c1cde7337675f5a94931e6226802d74d16</p>]]></description>
			<link>http://meisw.wdlinux.cn//show-1047-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-60-1.html">比特币</category>
			<pubDate>2018-08-18 20:18</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-1046-1.html</guid>
			<title>比特币地址生成过程详解</title>
			<author>admin</author>
			<description><![CDATA[<p>&nbsp;</p>
<h1 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px; font-size: 28px; color: rgb(79, 79, 79); line-height: 36px; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">1. 比特币地址编码格式</h1>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">比特币地址采用base58 check格式编码</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">Base 58 check编码方法如下图所示：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;"><img alt="" class="has" src="https://img-blog.csdn.net/20180719143435581?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2JlYmVzdDIwMTA=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" style="box-sizing: border-box; outline: 0px; max-width: 100%; margin: 0px; word-break: break-all; cursor: zoom-in;" /></p>
<h1 style="box-sizing: border-box; outline: 0px; padding: 0px; margin: 8px 0px 16px 0cm; font-size: 28px; color: rgb(79, 79, 79); line-height: 36px; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;"><a name="t1" style="box-sizing: border-box; outline: 0px; color: rgb(78, 161, 219); cursor: pointer; word-break: break-all;"></a>2. 比特币地址计算详细过程</h1>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">比特币地址计算过程如下图所示：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;"><img alt="" class="has" src="https://img-blog.csdn.net/20180719143636418?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2JlYmVzdDIwMTA=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70" style="box-sizing: border-box; outline: 0px; max-width: 100%; margin: 0px; word-break: break-all; cursor: zoom-in;" /></p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">以普通公钥地址计算过程为例：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">1. 如未压缩公钥为：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">04 5c0de3b9c8ab18dd04e3511243ec2952002dbfadc864b9628910169d9b9b00ec243bcefdd4347074d44bd7356d6a53c495737dd96295e2a9374bf5f02ebfc176</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">2. 经过sha256和 ripemd160 hash计算后结果为</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">09c6e71118d8f12bec6b5c61884b35677c0a0ae3</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">3. base58check编码</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">3.1 添加前缀0x00结果为0009c6e71118d8f12bec6b5c61884b35677c0a0ae3</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">3.2 计算double sha256 结果为2a021f87fa371ae2a63dd44112bf3175039e9a96613734309ca87fda7862a301</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">取前四字节</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">3.3 前缀+DATA+checksum为：</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">0009c6e71118d8f12bec6b5c61884b35677c0a0ae32a021f</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">3.4 base58 编码结果为</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">Bitcoin Address (b58check) is:</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">1thMirt546nngXqyPEz532S8fLwbozud8</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">同样可以用压缩公钥</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">025c0de3b9c8ab18dd04e3511243ec2952002dbfadc864b9628910169d9b9b00ec</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">生成一个压缩公钥对应的地址</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">Compressed Bitcoin Address (b58check) is:</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">14cxpo3MBCYYWCgF74SWTdcmxipnGUsPw3</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">&nbsp;</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">所以一个私钥可以生成2个比特币的地址，公钥和压缩公钥都可以生成对应的比特币地址</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">&nbsp;</p>
<p style="box-sizing: border-box; outline: 0px; margin-bottom: 16px; margin-left: 0cm; font-size: 16px; color: rgb(79, 79, 79); line-height: 26px; text-align: justify; word-break: break-all; font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">参考文献：《精通比特币(第二版)》</p>]]></description>
			<link>http://meisw.wdlinux.cn//show-1046-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-60-1.html">比特币</category>
			<pubDate>2018-08-18 20:17</pubDate>
		</item>
		<item>
			<guid>http://meisw.wdlinux.cn//show-1045-1.html</guid>
			<title>比特币交易手续费详解</title>
			<author>admin</author>
			<description><![CDATA[<p>&nbsp;<span style="color: rgb(51, 51, 51); font-family: arial; font-size: 16px; text-align: justify;">人们经常说你可以免费将比特币发送到地球的任意角落，通常情况下的确可以免费转账，但是在某些情况下你必须支付手续费（Transaction Fees）才能完成转账， 在0.8.3版Bitcoin钱包中默认是0.0001比特币的转账手续费。 这个手续费是奖励给矿工的，以激励矿工继续挖矿为比特币提供足够的算力从而确保比特币网络的安全。目前矿工的主要收入是通过创造新的块（Block）来获得25BTC的奖励，但是这个奖励每4年减半，随着时间的推移比特币交易手续费奖励将逐渐取代创造新块的奖励。 什么情况下需要支付手续费？比特币手续费收取多少？手续费怎么算？ 比特币系统有一系列的网络规则，其中包含手续费规则，这一系列规则也就是&ldquo;客户端要做什么&rdquo;。当你使用Bitcoin客户端（钱包，Bitcoin-Qt）发送比特币的时候，整个过程大致分为以下步骤：</span></p>
<p style="margin-top: 22px; margin-bottom: 0px; font-size: 16px; line-height: 24px; color: rgb(51, 51, 51); text-align: justify; font-family: arial;">&nbsp;</p>
<p style="margin-top: 22px; margin-bottom: 0px; font-size: 16px; line-height: 24px; color: rgb(51, 51, 51); text-align: justify; font-family: arial;"><span class="bjh-p">1. 筹备你要发送的比特币。客户端负责收集你钱包（Bitcoin-Qt）里的比特币余额为支付做准备，因为你收到的每一笔比特币都存在你的钱包里面直到你花掉它们。 假如你收到3BTC与2BTC两次付款，它们在钱包的记录是相互独立的，即一个3BTC和一个2BTC，而不是合并为5BTC（钱包只记录交易明细，并不将余额合并，但是你在钱包的界面上可以看到总的余额），随着时间的推移你的钱包里会积累许多这样数量不等的比特币，所以当你发送比特币的时候钱包必须决定用哪些比特币最适合用来本次发送。 在一次交易中你得到的比特币称为&ldquo;输入（inputs）&rdquo;，支出的比特币称为&ldquo;输出（outputs）&rdquo;，在你的钱包里存在多个输入和输出。</span></p>
<p style="margin-top: 22px; margin-bottom: 0px; font-size: 16px; line-height: 24px; color: rgb(51, 51, 51); text-align: justify; font-family: arial;">&nbsp;</p>
<p style="margin-top: 22px; margin-bottom: 0px; font-size: 16px; line-height: 24px; color: rgb(51, 51, 51); text-align: justify; font-family: arial;"><span class="bjh-p">2. 阻止大量微额（dust）支付冲击网络。如果你的输出（outputs）小于0.01BTC（包括你钱包内部的资金变动）的话，你必须要支付0.0001的手续费，即使是你自己转给你自己。钱包在准备你的支付金额的时候有一个既定的规则，就是在众多输入（inputs）中筹备支付金额的时候尽量避免产生小于0.01BTC的金额变动（比如你要支付5.005BTC，钱包尽可能的选择3+2.005或者1+1+3.005，而不是5+0.005）。</span></p>
<p style="margin-top: 22px; margin-bottom: 0px; font-size: 16px; line-height: 24px; color: rgb(51, 51, 51); text-align: justify; font-family: arial;">&nbsp;</p>
<p style="margin-top: 22px; margin-bottom: 0px; font-size: 16px; line-height: 24px; color: rgb(51, 51, 51); text-align: justify; font-family: arial;"><span class="bjh-p">3. 数额越大、币龄（age）越高优先级越高。如果你发送金额太小或者是你的比特币刚开采出来不久，那么你的转账就不再免费之列。每一个交易都会分配一个优先级，这个优先级通过币的新旧程度、交易的字节数和交易的数量。具体来说，对于每一个输入（inputs）来讲，客户端会先将比特币的数量乘以这些币在块中存在的时间（币龄，age），然后将所有的乘积加起来除以此次交易的大小（以字节为单位），计算公式：priority = sum(input_value_in_base_units * input_age)/size_in_bytes，计算结果如果小于0.576，那么该交易就必须支付手续费。如果你确实大量的小额输入，又想免费转出，这时候你可以加一个数额大的、币龄大的比特币金额，就会将平均优先级提高，从而可以免费转出比特币。</span></p>
<p style="margin-top: 22px; margin-bottom: 0px; font-size: 16px; line-height: 24px; color: rgb(51, 51, 51); text-align: justify; font-family: arial;">&nbsp;</p>
<p style="margin-top: 22px; margin-bottom: 0px; font-size: 16px; line-height: 24px; color: rgb(51, 51, 51); text-align: justify; font-family: arial;"><span class="bjh-p">4. 每千字节的收费。在转账的最后客户端会检测本次转账的大小（以字节为单位），大小一般取决于输入和输出的数额大小，计算公式如下：148 * 输入数额 + 34 * 输出数额 + 10，如果该次转账的大小超过10000字节但是优先级符合免费的标准，那么仍然可以享受免费转账，否则需要支付手续费。没1000字节的费用默认是0.0001BTC，但是你也可以在客户端里进行追加，依次打开选项卡&ldquo;设置&gt;选项&gt;主要&rdquo;进行手续费的调整。如果你在设置的手续费小于0.0001BTC按0.0001算。</span></p>]]></description>
			<link>http://meisw.wdlinux.cn//show-1045-1.html</link>
			<category domain="http://meisw.wdlinux.cn//category-60-1.html">比特币</category>
			<pubDate>2018-08-18 20:17</pubDate>
		</item>
	</channel>
</rss>
