arbitrated_pool

package
v4.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: 12 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)

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 FeeSatPerKB) (*FundingTxResult, error)

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

type StateInput

type StateInput struct {
	Protocol             string
	Version              uint32
	PreviousRawTx        []byte
	PreviousSourceOutput *tx.TransactionOutput
	Sequence             uint32
	LockTime             *uint32
	BuyerAmount          *uint64
	SellerAmount         uint64
	ArbiterAmount        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