arbitrated_pool

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

Variables

This section is empty.

Functions

func ArbitratedPoolFeeSat

func ArbitratedPoolFeeSat(size int, rate FeeSatPerKB) (uint64, error)

func BuildArbitratedPoolFinalState

func BuildArbitratedPoolFinalState(input StateInput) (*tx.Transaction, error)

func BuildArbitratedPoolLock

func BuildArbitratedPoolLock(roles ArbitratedPoolRoles) (*script.Script, error)

BuildArbitratedPoolLock 构建固定为 [Buyer, Seller, Arbiter] 的 2-of-3 脚本。

func BuildArbitratedPoolOpeningState

func BuildArbitratedPoolOpeningState(fundingTxID []byte, poolOutputIndex uint32, poolAmount uint64, roles ArbitratedPoolRoles, lockTime uint32, rate FeeSatPerKB) (*tx.Transaction, error)

func BuildArbitratedPoolState

func BuildArbitratedPoolState(input StateInput) (*tx.Transaction, error)

BuildArbitratedPoolState 固定输出 [Buyer, Seller],Arbiter 没有资金输出。

func MergeArbitratedPoolBuyerArbiterSignatures

func MergeArbitratedPoolBuyerArbiterSignatures(state *tx.Transaction, poolAmount uint64, roles ArbitratedPoolRoles, buyerSignature, arbiterSignature []byte) (*tx.Transaction, error)

func MergeArbitratedPoolBuyerSellerSignatures

func MergeArbitratedPoolBuyerSellerSignatures(state *tx.Transaction, poolAmount uint64, roles ArbitratedPoolRoles, buyerSignature, sellerSignature []byte) (*tx.Transaction, error)

func MergeArbitratedPoolSellerArbiterSignatures

func MergeArbitratedPoolSellerArbiterSignatures(state *tx.Transaction, poolAmount uint64, roles ArbitratedPoolRoles, sellerSignature, arbiterSignature []byte) (*tx.Transaction, error)

func SignArbitratedPoolAsArbiter

func SignArbitratedPoolAsArbiter(state *tx.Transaction, poolAmount uint64, roles ArbitratedPoolRoles, key *ec.PrivateKey) ([]byte, error)

func SignArbitratedPoolAsBuyer

func SignArbitratedPoolAsBuyer(state *tx.Transaction, poolAmount uint64, roles ArbitratedPoolRoles, key *ec.PrivateKey) ([]byte, error)

func SignArbitratedPoolAsSeller

func SignArbitratedPoolAsSeller(state *tx.Transaction, poolAmount uint64, roles ArbitratedPoolRoles, key *ec.PrivateKey) ([]byte, error)

func VerifyArbitratedPoolArbiterSignature

func VerifyArbitratedPoolArbiterSignature(state *tx.Transaction, poolAmount uint64, roles ArbitratedPoolRoles, signature []byte) (bool, error)

func VerifyArbitratedPoolBuyerSignature

func VerifyArbitratedPoolBuyerSignature(state *tx.Transaction, poolAmount uint64, roles ArbitratedPoolRoles, signature []byte) (bool, error)

func VerifyArbitratedPoolSellerSignature

func VerifyArbitratedPoolSellerSignature(state *tx.Transaction, poolAmount uint64, roles ArbitratedPoolRoles, signature []byte) (bool, error)

Types

type ArbitratedPoolRoles

type ArbitratedPoolRoles struct {
	Buyer   *ec.PublicKey
	Seller  *ec.PublicKey
	Arbiter *ec.PublicKey
}

ArbitratedPoolRoles 固定承载 2-of-3 池的业务角色。

type FeeSatPerKB

type FeeSatPerKB uint64

type FundingTxResult

type FundingTxResult struct {
	Tx              *tx.Transaction
	PoolAmount      uint64
	PoolOutputIndex uint32
	Fee             uint64
}

func BuildArbitratedPoolFundingTx

func BuildArbitratedPoolFundingTx(utxos []libs.UTXO, poolAmount uint64, buyerPrivateKey *ec.PrivateKey, roles ArbitratedPoolRoles, isMain bool, feeRate float64) (*FundingTxResult, error)

BuildArbitratedPoolFundingTx 使用 Buyer UTXO 创建 2-of-3 仲裁池。

type StateInput

type StateInput struct {
	Protocol      string
	Version       uint32
	PreviousRawTx []byte
	// PreviousSourceOutput 在标准 raw transaction 不包含源输出元数据时显式提供源输出。
	PreviousSourceOutput *tx.TransactionOutput
	Sequence             uint32
	LockTime             *uint32
	BuyerAmount          uint64
	SellerAmount         uint64
	PoolAmount           uint64
	Roles                ArbitratedPoolRoles
	FeeRate              FeeSatPerKB
	PaymentProof         []byte
}

Jump to

Keyboard shortcuts

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