Documentation ¶
Index ¶
- Constants
- func DefaultP2PKScript(btcadr string) ([]byte, error)
- func FillP2PKsign(result *Tx, used []*UTXO) error
- func NewP2PKunsign(fee uint64, coins UTXOs, locktime uint32, sends ...*Send) (*Tx, []*UTXO, error)
- func Reverse(bs []byte) []byte
- type MicroPayee
- type MicroPayer
- type PubInfo
- type Send
- type Tx
- type TxIn
- type TxOut
- type UTXO
- type UTXOs
Constants ¶
const (
//Unit is unit to convert BTC to satoshi
Unit = 100000000
)
Variables ¶
This section is empty.
Functions ¶
func DefaultP2PKScript ¶
DefaultP2PKScript returns default p2pk script.
func FillP2PKsign ¶
FillP2PKsign embeds sign script to result Tx.
func NewP2PKunsign ¶
NewP2PKunsign creates msg.Tx from send infos without signing tx.. last index of sends must be refund address, and its amount must be 0..
Types ¶
type MicroPayee ¶
type MicroPayee mpay
MicroPayee is struct for payee of micropayment.
func NewMicroPayee ¶
func NewMicroPayee(payer *address.PublicKey, payee *address.PrivateKey, amount uint64, fee uint64) *MicroPayee
NewMicroPayee returns struct for payee.
func (*MicroPayee) CheckBond ¶
func (m *MicroPayee) CheckBond(refund, bond *Tx) error
CheckBond checks and sets bond tx.
func (*MicroPayee) Filter ¶
func (m *MicroPayee) Filter() ([]byte, []byte)
Filter returns redeem script and its hash, which payee should wait for..
func (*MicroPayee) IncrementedTx ¶
func (m *MicroPayee) IncrementedTx(amount uint64, sign []byte) (*Tx, error)
IncrementedTx returns an incremented tx..
func (*MicroPayee) SignRefund ¶
func (m *MicroPayee) SignRefund(refund *Tx, locktime uint32) ([]byte, error)
SignRefund sings refund tx.
type MicroPayer ¶
type MicroPayer mpay
MicroPayer is struct for payer of micropayment.
func NewMicroPayer ¶
func NewMicroPayer(payer *address.PrivateKey, payee *address.PublicKey, amount uint64, fee uint64) *MicroPayer
NewMicroPayer returns struct for payer.
func (*MicroPayer) CreateBond ¶
CreateBond returns bond and refund tx for sign.
func (*MicroPayer) SignIncremented ¶
func (m *MicroPayer) SignIncremented(amount uint64) ([]byte, error)
SignIncremented signs incremented tx..
func (*MicroPayer) SignRefund ¶
func (m *MicroPayer) SignRefund(refund *Tx, sign []byte) error
SignRefund signs refund..
type PubInfo ¶
type PubInfo struct { Pubs []*address.PublicKey Amount uint64 Fee uint64 M byte // contains filtered or unexported fields }
PubInfo is infor of public key in M of N multisig.
func (*PubInfo) SignMultisig ¶
func (p *PubInfo) SignMultisig(priv *address.PrivateKey, locktime uint32, sends ...*Send) ([]byte, error)
SignMultisig signs multisig transaction by priv.
type Tx ¶
type Tx struct { Version uint32 TxIn []*TxIn `len:"prefix"` TxOut []*TxOut `len:"prefix"` Locktime uint32 }
Tx describes a bitcoin transaction,
func NewP2PK ¶
NewP2PK creates msg.Tx from send infos. last index of sends must be refund address, and its amount must be 0..