Documentation
¶
Index ¶
- Constants
- func BuildDualFeePoolSpendTX(A_Tx *tx.Transaction, totalAmount uint64, serverAmount uint64, ...) (*tx.Transaction, *[]byte, uint64, error)
- func BuildDualFeePoolSpendTXWithProof(A_Tx *tx.Transaction, totalAmount uint64, serverAmount uint64, ...) (*tx.Transaction, *[]byte, uint64, error)
- func ClientDualFeePoolSpendTXUpdateSign(tx *tx.Transaction, clientPrivateKey *ec.PrivateKey, ...) (*[]byte, error)
- func ClientVerifyServerSpendSig(transactionObject *tx.Transaction, totalAmount uint64, ...) (bool, error)
- func ClientVerifyServerUpdateSig(transactionObject *tx.Transaction, serverPublicKey *ec.PublicKey, ...) (bool, error)
- func DualPoolSpentScript(serverPublicKey *ec.PublicKey, clientPublicKey *ec.PublicKey) (*script.Script, error)
- func LoadTx(txHex string, locktime *uint32, sequenceNumber uint32, serverAmount uint64, ...) (*transaction.Transaction, error)
- func LoadTxWithProof(txHex string, locktime *uint32, sequenceNumber uint32, serverAmount uint64, ...) (*transaction.Transaction, error)
- func MergeDualPoolSigForSpendTx(txHex string, serverSignByte *[]byte, clientSignByte *[]byte) (*tx.Transaction, error)
- func ServerDualFeePoolSpendTXUpdateSign(tx *tx.Transaction, serverPrivateKey *ec.PrivateKey, ...) (*[]byte, error)
- func ServerVerifyClientSpendSig(transactionObject *tx.Transaction, totalAmount uint64, ...) (bool, error)
- func ServerVerifyClientUpdateSig(transactionObject *tx.Transaction, serverPublicKey *ec.PublicKey, ...) (bool, error)
- func SpendTXDualFeePoolClientSign(B_Tx *tx.Transaction, targetAmount uint64, clientPrivKey *ec.PrivateKey, ...) (*[]byte, error)
- func SpendTXServerSign(transactionObject *tx.Transaction, targetAmount uint64, ...) (*[]byte, error)
- func SubBuildDualFeePoolSpendTX(prevTxId string, totalAmount uint64, serverAmount uint64, endHeight uint32, ...) (*tx.Transaction, uint64, error)
- func SubBuildDualFeePoolSpendTXWithProof(prevTxId string, totalAmount uint64, serverAmount uint64, endHeight uint32, ...) (*tx.Transaction, uint64, error)
- type BuildStep1Response
Constants ¶
const FINAL_LOCKTIME uint32 = 0xffffffff
最终 locaktime
Variables ¶
This section is empty.
Functions ¶
func BuildDualFeePoolSpendTX ¶
func BuildDualFeePoolSpendTX( A_Tx *tx.Transaction, totalAmount uint64, serverAmount uint64, endHeight uint32, clientPrivateKey *ec.PrivateKey, serverPublicKey *ec.PublicKey, isMain bool, feeRate float64, ) (*tx.Transaction, *[]byte, uint64, error)
构建双端费用池花费交易 发起者 utxos, 服务器提供金额, 发起者私钥, 服务器地址 fee 是 server 提供,我只负责精确的金额
func BuildDualFeePoolSpendTXWithProof ¶
func BuildDualFeePoolSpendTXWithProof( A_Tx *tx.Transaction, totalAmount uint64, serverAmount uint64, endHeight uint32, clientPrivateKey *ec.PrivateKey, serverPublicKey *ec.PublicKey, isMain bool, feeRate float64, paymentProof []byte, ) (*tx.Transaction, *[]byte, uint64, error)
BuildDualFeePoolSpendTXWithProof 构建双端费用池付款交易,并支持可选二进制付款证明。
func ClientDualFeePoolSpendTXUpdateSign ¶
func ClientDualFeePoolSpendTXUpdateSign( tx *tx.Transaction, clientPrivateKey *ec.PrivateKey, serverPublicKey *ec.PublicKey, ) (*[]byte, error)
双端费用池,分配资金, 客户端签名 client -> server 修改金额和版本号
func ClientVerifyServerSpendSig ¶
func ClientVerifyServerSpendSig( transactionObject *tx.Transaction, totalAmount uint64, serverPublicKey *ec.PublicKey, clientPublicKey *ec.PublicKey, serverSignBytes *[]byte, ) (bool, error)
ClientVerifyServerSpendSig 用于在 B-Tx 上验证服务器签名。
func ClientVerifyServerUpdateSig ¶
func ClientVerifyServerUpdateSig( transactionObject *tx.Transaction, serverPublicKey *ec.PublicKey, clientPublicKey *ec.PublicKey, serverSignBytes *[]byte, ) (bool, error)
ClientVerifyServerUpdateSig 用于在更新后的 B-Tx 上验证服务器签名。
func DualPoolSpentScript ¶
func DualPoolSpentScript( serverPublicKey *ec.PublicKey, clientPublicKey *ec.PublicKey, ) (*script.Script, error)
构建双端费用池的花费脚本
func LoadTx ¶
func LoadTx( txHex string, locktime *uint32, sequenceNumber uint32, serverAmount uint64, serverPublicKey *ec.PublicKey, clientPublicKey *ec.PublicKey, targetAmount uint64, ) (*transaction.Transaction, error)
合成两个签名
func LoadTxWithProof ¶
func LoadTxWithProof( txHex string, locktime *uint32, sequenceNumber uint32, serverAmount uint64, serverPublicKey *ec.PublicKey, clientPublicKey *ec.PublicKey, targetAmount uint64, paymentProof []byte, ) (*transaction.Transaction, error)
LoadTxWithProof 在旧更新逻辑上追加“同步可选 proof OP_RETURN”的能力。 设计说明: - paymentProof=nil 时,沿用旧交易里的数据输出,不改动现有 proof; - paymentProof 非 nil 时,会把当前状态 proof 同步到交易最后一个 OP_RETURN 输出; - 这样 BFTP 可以把 proof state 作为共享库挂在状态交易上,而 MultisigPool 仍然保持通用。
func MergeDualPoolSigForSpendTx ¶
func MergeDualPoolSigForSpendTx( txHex string, serverSignByte *[]byte, clientSignByte *[]byte, ) (*tx.Transaction, error)
从创建花费脚本,客户端签名
func ServerDualFeePoolSpendTXUpdateSign ¶
func ServerDualFeePoolSpendTXUpdateSign( tx *tx.Transaction, serverPrivateKey *ec.PrivateKey, clientPublicKey *ec.PublicKey, ) (*[]byte, error)
双端费用池,分配资金, server 签名 client -> server 修改金额和版本号
func ServerVerifyClientSpendSig ¶
func ServerVerifyClientSpendSig( transactionObject *tx.Transaction, totalAmount uint64, serverPublicKey *ec.PublicKey, clientPublicKey *ec.PublicKey, clientSignBytes *[]byte, ) (bool, error)
ServerVerifyClientSpendSig 用于在 B-Tx 上验证客户端签名。
func ServerVerifyClientUpdateSig ¶
func ServerVerifyClientUpdateSig( transactionObject *tx.Transaction, serverPublicKey *ec.PublicKey, clientPublicKey *ec.PublicKey, clientSignBytes *[]byte, ) (bool, error)
ServerVerifyClientUpdateSig 用于在更新后的 B-Tx 上验证客户端签名。
func SpendTXDualFeePoolClientSign ¶
func SpendTXDualFeePoolClientSign(B_Tx *tx.Transaction, targetAmount uint64, clientPrivKey *ec.PrivateKey, serverPublicKey *ec.PublicKey) (*[]byte, error)
func SpendTXServerSign ¶
func SpendTXServerSign( transactionObject *tx.Transaction, targetAmount uint64, serverPrivateKey *ec.PrivateKey, clientPublicKey *ec.PublicKey, ) (*[]byte, error)
服务器 回签
func SubBuildDualFeePoolSpendTX ¶
func SubBuildDualFeePoolSpendTX( prevTxId string, totalAmount uint64, serverAmount uint64, endHeight uint32, clientPrivateKey *ec.PrivateKey, serverPublicKey *ec.PublicKey, isMain bool, feeRate float64, ) (*tx.Transaction, uint64, error)
多签 to client,server 提供金额
func SubBuildDualFeePoolSpendTXWithProof ¶
func SubBuildDualFeePoolSpendTXWithProof( prevTxId string, totalAmount uint64, serverAmount uint64, endHeight uint32, clientPrivateKey *ec.PrivateKey, serverPublicKey *ec.PublicKey, isMain bool, feeRate float64, paymentProof []byte, ) (*tx.Transaction, uint64, error)
SubBuildDualFeePoolSpendTXWithProof 构造双端费用池付款交易,并可追加付款证明 OP_RETURN。 proof 为空时不生成数据输出,保持旧交易结构与旧签名语义。
Types ¶
type BuildStep1Response ¶
type BuildStep1Response struct {
Tx *tx.Transaction
Amount uint64
Index int
}
func BuildDualFeePoolBaseTx ¶
func BuildDualFeePoolBaseTx( clientUtxo *[]libs.UTXO, feepoolAmount uint64, clientPrivateKey *ec.PrivateKey, serverPublicKey *ec.PublicKey, isMain bool, feeRate float64, ) (*BuildStep1Response, error)
p2pkh to 2t2多签, 不找零