Documentation ¶
Index ¶
- Constants
- func GetBech32AccountPubKey(key *btcec.PrivateKey) (common.PubKey, error)
- type Client
- func (c *Client) BroadcastTx(txOut stypes.TxOutItem, payload []byte) (string, error)
- func (c *Client) ConfirmationCountReady(txIn types.TxIn) bool
- func (c *Client) FetchMemPool(height int64) (types.TxIn, error)
- func (c *Client) FetchTxs(height, chainHeight int64) (types.TxIn, error)
- func (c *Client) GetAccount(pkey common.PubKey, height *big.Int) (common.Account, error)
- func (c *Client) GetAccountByAddress(string, *big.Int) (common.Account, error)
- func (c *Client) GetAddress(poolPubKey common.PubKey) string
- func (c *Client) GetChain() common.Chain
- func (c *Client) GetConfig() config.BifrostChainConfiguration
- func (c *Client) GetConfirmationCount(txIn types.TxIn) int64
- func (c *Client) GetHeight() (int64, error)
- func (c *Client) IsBlockScannerHealthy() bool
- func (c *Client) OnObservedTxIn(txIn types.TxInItem, blockHeight int64)
- func (c *Client) RegisterPublicKey(pkey common.PubKey) error
- func (c *Client) ReportSolvency(bitcoinBlockHeight int64) error
- func (c *Client) ShouldReportSolvency(height int64) bool
- func (c *Client) SignTx(tx stypes.TxOutItem, ddchainHeight int64) ([]byte, []byte, *stypes.TxInItem, error)
- func (c *Client) Start(globalTxsQueue chan types.TxIn, globalErrataQueue chan types.ErrataBlock, ...)
- func (c *Client) Stop()
- type KeySignWrapper
- type TssSignable
Constants ¶
const ( BlockCacheSize = 144 MaximumConfirmation = 99999999 MaxAsgardAddresses = 100 // EstimateAverageTxSize for DDChain the estimate tx size is hard code to 1000 here , as most of time it will spend 1 input, have 3 output // which is average at 250 vbytes , however asgard will consolidate UTXOs , which will take up to 1000 vbytes EstimateAverageTxSize = 1000 MaxMempoolScanPerTry = 500 )
BlockCacheSize the number of block meta that get store in storage.
const ( // SatsPervBytes it should be enough , this one will only be used if signer can't find any previous UTXO , and fee info from local storage. SatsPervBytes = 25 // MinUTXOConfirmation UTXO that has less confirmation then this will not be spent , unless it is yggdrasil MinUTXOConfirmation = 1 )
Variables ¶
This section is empty.
Functions ¶
func GetBech32AccountPubKey ¶
func GetBech32AccountPubKey(key *btcec.PrivateKey) (common.PubKey, error)
GetBech32AccountPubKey convert the given private key to
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client observes bitcoin chain and allows to sign and broadcast tx
func NewClient ¶
func NewClient(ddKeys *ddclient.Keys, cfg config.BifrostChainConfiguration, server *tssp.TssServer, bridge ddclient.DdchainBridge, m *metrics.Metrics) (*Client, error)
NewClient generates a new Client
func (*Client) BroadcastTx ¶
BroadcastTx will broadcast the given payload to BTC chain
func (*Client) ConfirmationCountReady ¶
ConfirmationCountReady will be called by observer before send the txIn to ddchain confirmation counting is on block level , refer to https://medium.com/coinmonks/1confvalue-a-simple-pow-confirmation-rule-of-thumb-a8d9c6c483dd for detail
func (*Client) FetchMemPool ¶
FetchMemPool retrieves txs from mempool
func (*Client) GetAccount ¶
GetAccount returns account with balance for an address
func (*Client) GetAccountByAddress ¶
func (*Client) GetAddress ¶
GetAddress returns address from pubkey
func (*Client) GetConfig ¶
func (c *Client) GetConfig() config.BifrostChainConfiguration
GetConfig - get the chain configuration
func (*Client) GetConfirmationCount ¶
GetConfirmationCount return the number of blocks the tx need to wait before processing in DDChain
func (*Client) IsBlockScannerHealthy ¶
func (*Client) OnObservedTxIn ¶
OnObservedTxIn gets called from observer when we have a valid observation For bitcoin chain client we want to save the utxo we can spend later to sign
func (*Client) RegisterPublicKey ¶
RegisterPublicKey register the given pubkey to bitcoin wallet
func (*Client) ReportSolvency ¶
func (*Client) ShouldReportSolvency ¶
ShouldReportSolvency based on the given block height , should the client report solvency to DDNode
func (*Client) SignTx ¶
func (c *Client) SignTx(tx stypes.TxOutItem, ddchainHeight int64) ([]byte, []byte, *stypes.TxInItem, error)
SignTx builds and signs the outbound transaction. Returns the signed transaction, a serialized checkpoint on error, a corresponding observation tx, and an error.
type KeySignWrapper ¶
type KeySignWrapper struct {
// contains filtered or unexported fields
}
KeySignWrapper is a wrap of private key and also tss instance it also implement the txscript.Signable interface, and will decide which method to use based on the pubkey
func NewKeySignWrapper ¶
func NewKeySignWrapper(privateKey *btcec.PrivateKey, tssKeyManager tss.DdchainKeyManager) (*KeySignWrapper, error)
NewKeySignWrapper create a new instance of Keysign Wrapper
func (*KeySignWrapper) GetSignable ¶
func (w *KeySignWrapper) GetSignable(poolPubKey common.PubKey) txscript.Signable
GetSignable based on the given poolPubKey
type TssSignable ¶
type TssSignable struct {
// contains filtered or unexported fields
}
TssSignable is a signable implementation backed by tss
func NewTssSignable ¶
func NewTssSignable(pubKey common.PubKey, manager tss.DdchainKeyManager) (*TssSignable, error)
NewTssSignable create a new instance of TssSignable
func (*TssSignable) GetPubKey ¶
func (ts *TssSignable) GetPubKey() *btcec.PublicKey