Versions in this module Expand all Collapse all v1 v1.0.1 Feb 1, 2023 v1.0.0 Jan 29, 2023 Changes in this version + const ArgonKeyLength + const ArgonMemory + const ArgonSaltLength + const ArgonThreads + const ArgonTime + const BITCOIN_CASH_RETARGET_ALGORITHM_HEIGHT + const BLOCKS_UNTIL_NEW_SERIES + const BLOCKS_UNTIL_TRANSACTIONS_PER_BLOCK_DOUBLING + const COINBASE_MATURITY + const CUDA_ENABLED + const CheckpointsEnabled + const DEFAULT_CRUZBIT_PORT + const GenesisBlockJson + const INITIAL_MAX_TRANSACTIONS_PER_BLOCK + const INITIAL_TARGET + const LatestCheckpointHeight + const MAIN + const MAX_FUTURE_SECONDS + const MAX_INBOUND_PEER_CONNECTIONS + const MAX_INBOUND_PEER_CONNECTIONS_FROM_SAME_HOST + const MAX_MEMO_LENGTH + const MAX_NUMBER + const MAX_OUTBOUND_PEER_CONNECTIONS + const MAX_PROTOCOL_MESSAGE_LENGTH + const MAX_TIP_AGE + const MAX_TRANSACTIONS_PER_BLOCK + const MAX_TRANSACTIONS_PER_BLOCK_EXCEEDED_AT_HEIGHT + const MAX_TRANSACTIONS_TO_INCLUDE_PER_BLOCK + const MAX_TRANSACTION_QUEUE_LENGTH + const NUM_BLOCKS_FOR_MEDIAN_TMESTAMP + const OPENCL_ENABLED + const ORPHAN + const Protocol + const RETARGET_INTERVAL + const RETARGET_SMA_WINDOW + const RETARGET_TIME + const SIDE + const Server + const TARGET_SPACING + const UNKNOWN + var Checkpoints map[int64]string = map[int64]string + var PeerUpgrader = websocket.Upgrader + var Seeders = [...]string + func CheckpointCheck(id BlockID, height int64) error + func CudaInit() int + func CudaMinerMine(minerNum int, startNonce int64) int64 + func CudaMinerUpdate(minerNum int, headerBytes []byte, ...) int64 + func HandlePortForward(port uint16, fwd bool) (string, bool, error) + func IsInitialBlockDownload(ledger Ledger, blockStore BlockStorage) (bool, int64, error) + func OpenCLInit() int + func OpenCLMinerMine(minerNum int, startNonce int64) int64 + func OpenCLMinerUpdate(minerNum int, headerBytes []byte, ...) int64 + type BalanceCache struct + func NewBalanceCache(ledger Ledger) *BalanceCache + func (b *BalanceCache) Apply(tx *Transaction) (bool, error) + func (b *BalanceCache) Balances() map[[ed25519.PublicKeySize]byte]int64 + func (b *BalanceCache) Reset() + func (b *BalanceCache) Undo(tx *Transaction) error + type BalanceMessage struct + Balance int64 + BlockID *BlockID + Error string + Height int64 + PublicKey ed25519.PublicKey + type BalancesMessage struct + Balances []PublicKeyBalance + BlockID *BlockID + Error string + Height int64 + type Block struct + Header *BlockHeader + Transactions []*Transaction + func NewBlock(previous BlockID, height int64, target, chainWork BlockID, ...) (*Block, error) + func (b *Block) AddTransaction(id TransactionID, tx *Transaction) error + func (b Block) CheckPOW(id BlockID) bool + func (b Block) ID() (BlockID, error) + type BlockHeader struct + ChainWork BlockID + HashListRoot TransactionID + Height int64 + Nonce int64 + Previous BlockID + Target BlockID + Time int64 + TransactionCount int32 + func (header *BlockHeader) IDFast(minerNum int) (*big.Int, int64) + func (header BlockHeader) Compare(theirHeader *BlockHeader, thisWhen, theirWhen int64) bool + func (header BlockHeader) ID() (BlockID, error) + type BlockHeaderHasher struct + func NewBlockHeaderHasher() *BlockHeaderHasher + func (h *BlockHeaderHasher) Update(minerNum int, header *BlockHeader) (*big.Int, int64) + type BlockHeaderMessage struct + BlockHeader *BlockHeader + BlockID *BlockID + type BlockID [32]byte + func (id *BlockID) SetBigInt(i *big.Int) *BlockID + func (id *BlockID) UnmarshalJSON(b []byte) error + func (id BlockID) GetBigInt() *big.Int + func (id BlockID) MarshalJSON() ([]byte, error) + func (id BlockID) String() string + type BlockMessage struct + Block *Block + BlockID *BlockID + type BlockQueue struct + func NewBlockQueue() *BlockQueue + func (b *BlockQueue) Add(id BlockID, who string) bool + func (b *BlockQueue) Exists(id BlockID) bool + func (b *BlockQueue) Len() int + func (b *BlockQueue) Peek() (BlockID, bool) + func (b *BlockQueue) Remove(id BlockID, who string) bool + type BlockStorage interface + GetBlock func(id BlockID) (*Block, error) + GetBlockBytes func(id BlockID) ([]byte, error) + GetBlockHeader func(id BlockID) (*BlockHeader, int64, error) + GetTransaction func(id BlockID, index int) (*Transaction, *BlockHeader, error) + Store func(id BlockID, block *Block, now int64) error + type BlockStorageDisk struct + func NewBlockStorageDisk(dirPath, dbPath string, readOnly, compress bool) (*BlockStorageDisk, error) + func (b *BlockStorageDisk) Close() error + func (b BlockStorageDisk) GetBlock(id BlockID) (*Block, error) + func (b BlockStorageDisk) GetBlockBytes(id BlockID) ([]byte, error) + func (b BlockStorageDisk) GetBlockHeader(id BlockID) (*BlockHeader, int64, error) + func (b BlockStorageDisk) GetTransaction(id BlockID, index int) (*Transaction, *BlockHeader, error) + func (b BlockStorageDisk) Store(id BlockID, block *Block, now int64) error + type BranchType int + type DNSSeeder struct + func NewDNSSeeder(peerStore PeerStorage, port int) *DNSSeeder + func (d *DNSSeeder) Run() + func (d *DNSSeeder) Shutdown() + type FilterAddMessage struct + PublicKeys []ed25519.PublicKey + type FilterBlockMessage struct + BlockID BlockID + Header *BlockHeader + Transactions []*Transaction + type FilterLoadMessage struct + Filter []byte + Type string + type FilterResultMessage struct + Error string + type FilterTransactionQueueMessage struct + Error string + Transactions []*Transaction + type FindCommonAncestorMessage struct + BlockIDs []BlockID + type GetBalanceMessage struct + PublicKey ed25519.PublicKey + type GetBalancesMessage struct + PublicKeys []ed25519.PublicKey + type GetBlockByHeightMessage struct + Height int64 + type GetBlockHeaderByHeightMessage struct + Height int64 + type GetBlockHeaderMessage struct + BlockID BlockID + type GetBlockMessage struct + BlockID BlockID + type GetPublicKeyTransactionsMessage struct + EndHeight int64 + Limit int + PublicKey ed25519.PublicKey + StartHeight int64 + StartIndex int + type GetTransactionMessage struct + TransactionID TransactionID + type GetWorkMessage struct + Memo string + PublicKeys []ed25519.PublicKey + type HashWithRead interface + Read func(out []byte) (n int, err error) + type HashrateMonitor struct + func NewHashrateMonitor(hashUpdateChan chan int64) *HashrateMonitor + func (h *HashrateMonitor) Run() + func (h *HashrateMonitor) Shutdown() + type IRC struct + func NewIRC() *IRC + func (i *IRC) Connect(genesisID BlockID, port int, addrChan chan<- string) error + func (i *IRC) Run() + func (i *IRC) Shutdown() + type InvBlockMessage struct + BlockIDs []BlockID + type Ledger interface + Balance func() (int64, error) + ConnectBlock func(id BlockID, block *Block) ([]TransactionID, error) + DisconnectBlock func(id BlockID, block *Block) ([]TransactionID, error) + GetBlockIDForHeight func(height int64) (*BlockID, error) + GetBranchType func(id BlockID) (BranchType, error) + GetChainTip func() (*BlockID, int64, error) + GetPublicKeyBalance func(pubKey ed25519.PublicKey) (int64, error) + GetPublicKeyBalanceAt func(pubKey ed25519.PublicKey, height int64) (int64, error) + GetPublicKeyBalances func(pubKeys []ed25519.PublicKey) (map[[ed25519.PublicKeySize]byte]int64, *BlockID, int64, error) + GetPublicKeyTransactionIndicesRange func(pubKey ed25519.PublicKey, startHeight, endHeight int64, startIndex, limit int) ([]BlockID, []int, int64, int, error) + GetTransactionIndex func(id TransactionID) (*BlockID, int, error) + SetBranchType func(id BlockID, branchType BranchType) error + type LedgerDisk struct + func NewLedgerDisk(dbPath string, readOnly, prune bool, blockStore BlockStorage) (*LedgerDisk, error) + func (l LedgerDisk) Balance() (int64, error) + func (l LedgerDisk) Close() error + func (l LedgerDisk) ConnectBlock(id BlockID, block *Block) ([]TransactionID, error) + func (l LedgerDisk) DisconnectBlock(id BlockID, block *Block) ([]TransactionID, error) + func (l LedgerDisk) GetBlockIDForHeight(height int64) (*BlockID, error) + func (l LedgerDisk) GetBranchType(id BlockID) (BranchType, error) + func (l LedgerDisk) GetChainTip() (*BlockID, int64, error) + func (l LedgerDisk) GetPublicKeyBalance(pubKey ed25519.PublicKey) (int64, error) + func (l LedgerDisk) GetPublicKeyBalanceAt(pubKey ed25519.PublicKey, height int64) (int64, error) + func (l LedgerDisk) GetPublicKeyBalances(pubKeys []ed25519.PublicKey) (map[[ed25519.PublicKeySize]byte]int64, *BlockID, int64, error) + func (l LedgerDisk) GetPublicKeyTransactionIndicesRange(pubKey ed25519.PublicKey, startHeight, endHeight int64, startIndex, limit int) ([]BlockID, []int, int64, int, error) + func (l LedgerDisk) GetTransactionIndex(id TransactionID) (*BlockID, int, error) + func (l LedgerDisk) SetBranchType(id BlockID, branchType BranchType) error + type Message struct + Body interface{} + Type string + type Miner struct + func NewMiner(pubKeys []ed25519.PublicKey, memo string, blockStore BlockStorage, ...) *Miner + func (m *Miner) Run() + func (m *Miner) Shutdown() + type NewTx struct + Source string + Transaction *Transaction + TransactionID TransactionID + type Peer struct + func NewPeer(conn *websocket.Conn, genesisID BlockID, peerStore PeerStorage, ...) *Peer + func (p *Peer) Connect(ctx context.Context, addr, nonce, myAddr string) (int, error) + func (p *Peer) OnClose(closeHandler func()) + func (p *Peer) Run() + func (p *Peer) Shutdown() + type PeerAddressesMessage struct + Addresses []string + type PeerManager struct + func NewPeerManager(genesisID BlockID, peerStore PeerStorage, blockStore BlockStorage, ...) *PeerManager + func (p *PeerManager) Run() + func (p *PeerManager) Shutdown() + type PeerStorage interface + Delete func(addr string) error + Get func(count int) ([]string, error) + GetSince func(count int, when int64) ([]string, error) + OnConnectAttempt func(addr string) error + OnConnectFailure func(addr string) error + OnConnectSuccess func(addr string) error + OnDisconnect func(addr string) error + Store func(addr string) (bool, error) + type PeerStorageDisk struct + func NewPeerStorageDisk(dbPath string) (*PeerStorageDisk, error) + func (p *PeerStorageDisk) Close() error + func (p *PeerStorageDisk) Delete(addr string) error + func (p *PeerStorageDisk) Get(count int) ([]string, error) + func (p *PeerStorageDisk) GetSince(count int, when int64) ([]string, error) + func (p *PeerStorageDisk) OnConnectAttempt(addr string) error + func (p *PeerStorageDisk) OnConnectFailure(addr string) error + func (p *PeerStorageDisk) OnConnectSuccess(addr string) error + func (p *PeerStorageDisk) OnDisconnect(addr string) error + func (p *PeerStorageDisk) Store(addr string) (bool, error) + type Processor struct + func NewProcessor(genesisID BlockID, blockStore BlockStorage, txQueue TransactionQueue, ...) *Processor + func (p *Processor) ProcessBlock(id BlockID, block *Block, from string) error + func (p *Processor) ProcessTransaction(id TransactionID, tx *Transaction, from string) error + func (p *Processor) RegisterForNewTransactions(ch chan<- NewTx) + func (p *Processor) RegisterForTipChange(ch chan<- TipChange) + func (p *Processor) Run() + func (p *Processor) Shutdown() + func (p *Processor) UnregisterForNewTransactions(ch chan<- NewTx) + func (p *Processor) UnregisterForTipChange(ch chan<- TipChange) + type PublicKeyBalance struct + Balance int64 + PublicKey ed25519.PublicKey + type PublicKeyTransactionsMessage struct + Error string + FilterBlocks []*FilterBlockMessage + PublicKey ed25519.PublicKey + StartHeight int64 + StopHeight int64 + StopIndex int + type PushTransactionMessage struct + Transaction *Transaction + type PushTransactionResultMessage struct + Error string + TransactionID TransactionID + type Signature []byte + type SubmitWorkMessage struct + Header *BlockHeader + WorkID int32 + type SubmitWorkResultMessage struct + Error string + WorkID int32 + type TipChange struct + Block *Block + BlockID BlockID + Connect bool + More bool + Source string + type TipHeaderMessage struct + BlockHeader *BlockHeader + BlockID *BlockID + TimeSeen int64 + type Transaction struct + Expires int64 + From ed25519.PublicKey + Matures int64 + Memo string + Nonce int32 + Series int64 + Signature Signature + Time int64 + To ed25519.PublicKey + func NewTransaction(from, to ed25519.PublicKey, matures, expires, height int64, memo string) *Transaction + func (tx *Transaction) Sign(privKey ed25519.PrivateKey) error + func (tx Transaction) Contains(pubKey ed25519.PublicKey) bool + func (tx Transaction) ID() (TransactionID, error) + func (tx Transaction) IsCoinbase() bool + func (tx Transaction) IsExpired(height int64) bool + func (tx Transaction) IsMature(height int64) bool + func (tx Transaction) Verify() (bool, error) + type TransactionID [32]byte + func (id *TransactionID) UnmarshalJSON(b []byte) error + func (id TransactionID) MarshalJSON() ([]byte, error) + func (id TransactionID) String() string + type TransactionMessage struct + BlockID *BlockID + Height int64 + Transaction *Transaction + TransactionID TransactionID + type TransactionQueue interface + Add func(id TransactionID, tx *Transaction) (bool, error) + AddBatch func(ids []TransactionID, txs []*Transaction, height int64) error + Exists func(id TransactionID) bool + ExistsSigned func(id TransactionID, signature Signature) bool + Get func(limit int) []*Transaction + Len func() int + RemoveBatch func(ids []TransactionID, height int64, more bool) error + type TransactionQueueMemory struct + func NewTransactionQueueMemory(ledger Ledger) *TransactionQueueMemory + func (t *TransactionQueueMemory) Add(id TransactionID, tx *Transaction) (bool, error) + func (t *TransactionQueueMemory) AddBatch(ids []TransactionID, txs []*Transaction, height int64) error + func (t *TransactionQueueMemory) Exists(id TransactionID) bool + func (t *TransactionQueueMemory) ExistsSigned(id TransactionID, signature Signature) bool + func (t *TransactionQueueMemory) Get(limit int) []*Transaction + func (t *TransactionQueueMemory) Len() int + func (t *TransactionQueueMemory) RemoveBatch(ids []TransactionID, height int64, more bool) error + type Wallet struct + func NewWallet(walletDbPath string, recover bool) (*Wallet, error) + func (w *Wallet) AddFilter(pubKey ed25519.PublicKey) error + func (w *Wallet) AddKey(pubKey ed25519.PublicKey, privKey ed25519.PrivateKey) error + func (w *Wallet) Connect(addr string, genesisID BlockID, tlsVerify bool) error + func (w *Wallet) GetBalance(pubKey ed25519.PublicKey) (int64, int64, error) + func (w *Wallet) GetBalances(pubKeys []ed25519.PublicKey) ([]PublicKeyBalance, int64, error) + func (w *Wallet) GetKeys() ([]ed25519.PublicKey, error) + func (w *Wallet) GetPrivateKey(pubKey ed25519.PublicKey) (ed25519.PrivateKey, error) + func (w *Wallet) GetPublicKeyTransactions(pubKey ed25519.PublicKey, startHeight, endHeight int64, startIndex, limit int) (startH, stopH int64, stopIndex int, fb []*FilterBlockMessage, err error) + func (w *Wallet) GetTipHeader() (BlockID, BlockHeader, error) + func (w *Wallet) GetTransaction(id TransactionID) (*Transaction, *BlockID, int64, error) + func (w *Wallet) IsConnected() bool + func (w *Wallet) NewKeys(count int) ([]ed25519.PublicKey, error) + func (w *Wallet) Run() + func (w *Wallet) Send(from, to ed25519.PublicKey, matures, expires int64, memo string) (TransactionID, error) + func (w *Wallet) SetFilter() error + func (w *Wallet) SetFilterBlockCallback(callback func(*FilterBlockMessage)) + func (w *Wallet) SetPassphrase(passphrase string) (bool, error) + func (w *Wallet) SetTransactionCallback(callback func(*Transaction)) + func (w *Wallet) Shutdown() error + func (w *Wallet) VerifyKey(pubKey ed25519.PublicKey) error + type WorkMessage struct + Error string + Header *BlockHeader + MinTime int64 + WorkID int32