-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
554 additions
and
9 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
37 changes: 36 additions & 1 deletion
37
...gin-content-docs/current/blockchain/bitcoin-basics/transaction/confirmations.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,39 @@ | ||
--- | ||
sidebar_position: 8 | ||
--- | ||
# 交易确认数 | ||
|
||
# 交易确认数 | ||
|
||
介绍比特币交易确认数的概念及其重要性。 | ||
|
||
## 什么是交易确认数 | ||
|
||
交易确认数(Confirmations)是指一笔比特币交易被包含在区块中后,区块链上又增加了多少个区块。每新增一个区块,确认数增加1。确认数是衡量交易在区块链上被认可和不可篡改的程度。 | ||
|
||
## 交易确认数的作用 | ||
|
||
### 1. 增强交易安全性 | ||
|
||
确认数越多,交易被篡改的可能性越低。通常,6次确认被认为是安全的,意味着交易几乎不可逆。 | ||
|
||
### 2. 确定交易有效性 | ||
|
||
确认数提供了对交易有效性的信任度。较少确认数的交易可能被逆转,因此商家和用户通常会等待一定数量的确认以确保交易的可靠性。 | ||
|
||
### 3. 防止双花攻击 | ||
|
||
通过等待多次确认,可以有效防止双花攻击,即同一笔比特币被多次使用。 | ||
|
||
## 如何查询交易确认数 | ||
|
||
使用比特币核心客户端的命令行接口(CLI)也可以查询交易确认数。 | ||
|
||
```bash | ||
mvc-cli gettransaction <txid> | ||
``` | ||
|
||
返回的结果中包含"confirmations"字段,表示该交易的确认数。 | ||
|
||
## 总结 | ||
|
||
交易确认数是衡量比特币交易被认可和不可篡改的重要指标。了解确认数的作用和如何查询,有助于确保交易的安全性和可靠性。 |
71 changes: 71 additions & 0 deletions
71
...saurus-plugin-content-docs/current/blockchain/bitcoin-basics/transaction/fee.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,75 @@ | ||
--- | ||
sidebar_position: 5 | ||
--- | ||
|
||
# 交易手续费率 | ||
|
||
介绍比特币交易手续费率,如何计算。 | ||
|
||
## 什么是交易手续费率 | ||
|
||
比特币交易手续费率是指用户为确认交易而支付的费用与交易大小(以字节为单位)之比。它通常以聪/字节(satoshis/byte)表示。手续费率直接影响交易被矿工确认的优先级,较高的手续费率通常会导致交易更快被确认。 | ||
|
||
## 交易手续费率的计算 | ||
|
||
### 1. 计算交易大小 | ||
|
||
交易大小指的是交易数据的总字节数。比特币交易由输入、输出和其他字段组成,每个字段的大小不同。可以使用比特币钱包或在线工具来计算交易大小。 | ||
|
||
#### 示例 | ||
|
||
假设有一个比特币交易如下: | ||
|
||
- 输入:148字节 | ||
- 输出:34字节 | ||
- 其他字段:10字节 | ||
|
||
总交易大小 = 148 + 34 + 10 = 192字节 | ||
|
||
### 2. 确定总手续费 | ||
|
||
总手续费是用户愿意为确认交易而支付的总金额,单位为聪(satoshis)。 | ||
|
||
#### 示例 | ||
|
||
假设用户愿意支付的总手续费为19,200聪。 | ||
|
||
### 3. 计算手续费率 | ||
|
||
手续费率 = 总手续费 / 交易大小 | ||
|
||
#### 示例 | ||
|
||
手续费率 = 19,200聪 / 192字节 = 100聪/字节 | ||
|
||
## 影响手续费率的因素 | ||
|
||
### 1. 网络拥堵 | ||
|
||
当比特币网络拥堵时,未确认交易积压较多,用户需要支付更高的手续费率以获得优先确认。 | ||
|
||
### 2. 交易大小 | ||
|
||
较大的交易需要更多的字节数,因此即使总手续费相同,交易大小不同的交易其手续费率也会不同。 | ||
|
||
### 3. 矿工偏好 | ||
|
||
矿工通常优先处理手续费率较高的交易,因此用户在高流量时期支付更高的手续费率以确保交易被迅速确认。 | ||
|
||
## 如何选择合适的手续费率 | ||
|
||
### 1. 使用钱包推荐 | ||
|
||
大多数比特币钱包会根据当前网络状况推荐合适的手续费率。用户可以选择默认推荐值或手动调整。 | ||
|
||
### 2. 在线工具和资源 | ||
|
||
用户可以使用在线资源,如比特币手续费估算器,查看当前网络的建议手续费率。 | ||
|
||
### 3. 自定义设置 | ||
|
||
对于时间敏感的交易,可以选择较高的手续费率以确保快速确认;对于不急于确认的交易,可以选择较低的手续费率,节省成本。 | ||
|
||
## 总结 | ||
|
||
交易手续费率是比特币交易中影响交易确认速度的关键因素。通过计算交易大小和确定总手续费,用户可以计算合适的手续费率。了解影响手续费率的因素和如何选择合适的费率,有助于优化交易成本和确认速度。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
...-plugin-content-docs/current/blockchain/bitcoin-basics/transaction/lock-time.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,81 @@ | ||
--- | ||
sidebar_position: 4 | ||
--- | ||
|
||
# Lock Time(时间锁) | ||
|
||
介绍时间锁字段的概念。 | ||
|
||
## 什么是时间锁(LockTime) | ||
|
||
时间锁(LockTime)是比特币交易中的一个字段,用于设置交易何时可以被加入区块链。它通过指定一个时间点或区块高度,规定交易在达到该条件前不能被确认。LockTime字段位于交易数据结构的末尾,使用4字节表示。 | ||
|
||
## 时间锁的作用 | ||
|
||
### 1. 延迟交易 | ||
|
||
时间锁允许创建在未来某个时间或区块高度后才会被确认的交易。它适用于需要延迟执行的交易场景。 | ||
|
||
### 2. 增强灵活性 | ||
|
||
时间锁为交易的执行时间提供了灵活性,允许用户设置交易在特定时间或事件发生后才生效。这在支付计划和合约执行中尤为有用。 | ||
|
||
## 时间锁的类型 | ||
|
||
### 1. 绝对时间锁(Absolute LockTime) | ||
|
||
绝对时间锁指定一个具体的时间点或区块高度。在交易创建时,LockTime字段设置为该时间点或区块高度。交易只能在网络时间超过指定时间或区块高度后被矿工打包确认。 | ||
|
||
### 2. 相对时间锁(Relative LockTime) | ||
|
||
相对时间锁通过BIP 68引入,允许交易输入设置一个相对时间锁定,要求交易在前一个交易确认后经过一定时间或区块数才可被确认。相对时间锁使得更复杂的支付方案和智能合约成为可能。 | ||
|
||
## 时间锁的实现 | ||
|
||
### 1. 设置时间锁 | ||
|
||
时间锁可以通过设置交易的LockTime字段实现。LockTime可以设置为特定的UNIX时间戳(秒)或区块高度: | ||
|
||
- 小于500,000,000的值表示区块高度。 | ||
- 大于等于500,000,000的值表示UNIX时间戳。 | ||
|
||
### 2. 验证时间锁 | ||
|
||
在交易验证过程中,节点会检查当前区块高度或网络时间是否满足LockTime条件。只有当条件满足时,交易才会被确认并加入区块。 | ||
|
||
### 示例 | ||
|
||
以下是一个设置LockTime的交易示例: | ||
|
||
```json | ||
{ | ||
"txid": "exampletxid", | ||
"version": 2, | ||
"locktime": 500000, | ||
// 表示在区块高度500000之后才能被确认 | ||
"vin": [ | ||
... | ||
], | ||
"vout": [ | ||
... | ||
] | ||
} | ||
``` | ||
|
||
## 时间锁的应用场景 | ||
|
||
### 1. 延迟支付 | ||
|
||
时间锁可以用于设置延迟支付场景,例如分期付款或定期支付。 | ||
|
||
### 2. 安全保障 | ||
|
||
在双花攻击防护中,通过时间锁可以确保资金在一定时间内不可用,从而提供额外的安全保障。 | ||
|
||
### 3. 智能合约 | ||
|
||
时间锁在智能合约中起到了关键作用,允许设计更加复杂的交易和支付方案,如时间锁定合约和多重签名合约。 | ||
|
||
## 总结 | ||
|
||
时间锁(LockTime)是比特币交易中用于控制交易确认时间的关键字段。它通过设置绝对或相对的时间或区块高度,提供了延迟执行交易和增强灵活性的功能。理解时间锁的工作原理和应用场景,有助于深入掌握比特币交易机制及其在去中心化系统中的应用。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.