btc

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: LGPL-3.0 Imports: 27 Imported by: 0

Documentation

Overview

* Copyright (C) 2021 The poly network Authors * This file is part of The poly network library. * * The poly network is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The poly network is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public License * along with The poly network . If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const (
	OP_RETURN_SCRIPT_FLAG   = byte(0xcc)
	BTC_TX_PREFIX           = "btctx"
	BTC_FROM_TX_PREFIX      = "btcfromtx"
	UTXOS                   = "utxos"
	STXOS                   = "stxos"
	MULTI_SIGN_INFO         = "multiSignInfo"
	MAX_FEE_COST_PERCENTS   = 1.0
	MAX_SELECTING_TRY_LIMIT = 1000000
	SELECTING_K             = 4.0
)

Variables

This section is empty.

Functions

func GetUtxoKey

func GetUtxoKey(scriptPk []byte) string

Types

type Args

type Args struct {
	ToChainID uint64
	Fee       int64
	Address   []byte
}

func (*Args) Deserialization

func (this *Args) Deserialization(source *common.ZeroCopySource) error

func (*Args) Serialization

func (this *Args) Serialization(sink *common.ZeroCopySink)

type BTCHandler

type BTCHandler struct {
}

func NewBTCHandler

func NewBTCHandler() *BTCHandler

func (*BTCHandler) MakeDepositProposal

func (this *BTCHandler) MakeDepositProposal(service *native.NativeService) (*crosscommon.MakeTxParam, error)

func (*BTCHandler) MakeTransaction

func (this *BTCHandler) MakeTransaction(service *native.NativeService, param *crosscommon.MakeTxParam,
	fromChainID uint64) error

func (*BTCHandler) MultiSign

func (this *BTCHandler) MultiSign(service *native.NativeService) error

type BtcFromInfo

type BtcFromInfo struct {
	FromTxHash  []byte
	FromChainID uint64
}

func (*BtcFromInfo) Deserialization

func (this *BtcFromInfo) Deserialization(source *common.ZeroCopySource) error

func (*BtcFromInfo) Serialization

func (this *BtcFromInfo) Serialization(sink *common.ZeroCopySink)

type BtcProof

type BtcProof struct {
	Tx           []byte
	Proof        []byte
	Height       uint32
	BlocksToWait uint64
}

func (*BtcProof) Deserialization

func (this *BtcProof) Deserialization(source *common.ZeroCopySource) error

func (*BtcProof) Serialization

func (this *BtcProof) Serialization(sink *common.ZeroCopySink)

type CoinSelector

type CoinSelector struct {
	// contains filtered or unexported fields
}

func (*CoinSelector) Select

func (selector *CoinSelector) Select() ([]*Utxo, uint64, uint64)

func (*CoinSelector) SimpleBnbSearch

func (selector *CoinSelector) SimpleBnbSearch(depth int, selection []*Utxo, sum uint64) ([]*Utxo, uint64, uint64)

func (*CoinSelector) SortedSearch

func (selector *CoinSelector) SortedSearch() ([]*Utxo, uint64, uint64)

type MultiSignInfo

type MultiSignInfo struct {
	MultiSignInfo map[string][][]byte
}

func (*MultiSignInfo) Deserialization

func (this *MultiSignInfo) Deserialization(source *common.ZeroCopySource) error

func (*MultiSignInfo) Serialization

func (this *MultiSignInfo) Serialization(sink *common.ZeroCopySink)

type OutPoint

type OutPoint struct {
	Hash  []byte
	Index uint32
}

func (*OutPoint) Deserialization

func (this *OutPoint) Deserialization(source *common.ZeroCopySource) error

func (*OutPoint) Serialization

func (this *OutPoint) Serialization(sink *common.ZeroCopySink)

func (*OutPoint) String

func (this *OutPoint) String() string

type Utxo

type Utxo struct {
	// Previous txid and output index
	Op *OutPoint

	// Block height where this tx was confirmed, 0 for unconfirmed
	AtHeight uint32 // TODO: del ??

	// The higher the better
	Value uint64

	// Output script
	ScriptPubkey []byte
}

func (*Utxo) Deserialization

func (this *Utxo) Deserialization(source *common.ZeroCopySource) error

func (*Utxo) Serialization

func (this *Utxo) Serialization(sink *common.ZeroCopySink)

type Utxos

type Utxos struct {
	Utxos []*Utxo
}

func (*Utxos) Deserialization

func (this *Utxos) Deserialization(source *common.ZeroCopySource) error

func (*Utxos) Len

func (this *Utxos) Len() int

func (*Utxos) Less

func (this *Utxos) Less(i, j int) bool

func (*Utxos) Serialization

func (this *Utxos) Serialization(sink *common.ZeroCopySink)

func (*Utxos) Swap

func (this *Utxos) Swap(i, j int)

Jump to

Keyboard shortcuts

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