chain_utils

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
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 ClientDualFeePoolSpendTXUpdateSign

func ClientDualFeePoolSpendTXUpdateSign(
	tx *tx.Transaction,
	clientPrivateKey *ec.PrivateKey,
	serverPublicKey *ec.PublicKey,
) (*[]byte, error)

双端费用池,分配资金, 客户端签名 client -> server 修改金额和版本号

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 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 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 提供金额

Types

type BuildStep1Response

type BuildStep1Response struct {
	Tx     *tx.Transaction
	Amount uint64
	Index  int
}

func BuildDualFeePoolBaseTx

func BuildDualFeePoolBaseTx(
	clientUtxo *[]libs.UTXO,

	clientPrivateKey *ec.PrivateKey,
	serverPublicKey *ec.PublicKey,
	isMain bool,
	feeRate float64,
) (*BuildStep1Response, error)

p2pkh to 2t2多签, 不找零

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL