Documentation
¶
Overview ¶
Package node is the Algorand node itself, with functions exposed to the frontend
Index ¶
- type AlgorandFullNode
- func (node *AlgorandFullNode) BroadcastSignedTxGroup(txgroup []transactions.SignedTxn) error
- func (node *AlgorandFullNode) Config() config.Local
- func (node *AlgorandFullNode) ExtendPeerList(peers ...string)
- func (node *AlgorandFullNode) GenesisHash() crypto.Digest
- func (node *AlgorandFullNode) GenesisID() string
- func (node *AlgorandFullNode) GetPendingTransaction(txID transactions.Txid) (res TxnWithStatus, found bool)
- func (node *AlgorandFullNode) GetPendingTxnsFromPool() ([]transactions.SignedTxn, error)
- func (node *AlgorandFullNode) GetPrioWeight(addr basics.Address) uint64
- func (node *AlgorandFullNode) GetTransaction(addr basics.Address, txID transactions.Txid, minRound basics.Round, ...) (TxnWithStatus, bool)
- func (node *AlgorandFullNode) GetTransactionByID(txid transactions.Txid, rnd basics.Round) (TxnWithStatus, error)
- func (node *AlgorandFullNode) HasCaughtUp() bool
- func (node *AlgorandFullNode) Indexer() (*indexer.Indexer, error)
- func (node *AlgorandFullNode) IsArchival() bool
- func (node *AlgorandFullNode) IsCatchingUp() bool
- func (node *AlgorandFullNode) IsInitialCatchupComplete() bool
- func (node *AlgorandFullNode) Ledger() *data.Ledger
- func (node *AlgorandFullNode) ListTxns(addr basics.Address, minRound basics.Round, maxRound basics.Round) ([]TxnWithStatus, error)
- func (node *AlgorandFullNode) ListeningAddress() (string, bool)
- func (node *AlgorandFullNode) MakePrioResponse(challenge string) []byte
- func (node *AlgorandFullNode) NewPrioChallenge() string
- func (node *AlgorandFullNode) OnNewBlock(block bookkeeping.Block, delta ledger.StateDelta)
- func (node *AlgorandFullNode) PoolStats() PoolStats
- func (node *AlgorandFullNode) ReplacePeerList(peers ...string)
- func (node *AlgorandFullNode) SetLastLiveRound(round basics.Round)
- func (node *AlgorandFullNode) Start()
- func (node *AlgorandFullNode) Status() (s StatusReport, err error)
- func (node *AlgorandFullNode) Stop()
- func (node *AlgorandFullNode) SuggestedFee() basics.MicroAlgos
- func (node *AlgorandFullNode) Uint64() uint64
- func (node *AlgorandFullNode) VerifyPrioResponse(challenge string, response []byte) (addr basics.Address, err error)
- type PoolStats
- type StatusReport
- type TxnWithStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlgorandFullNode ¶
type AlgorandFullNode struct {
// contains filtered or unexported fields
}
AlgorandFullNode specifies and implements a full Algorand node.
func MakeFull ¶
func MakeFull(log logging.Logger, rootDir string, cfg config.Local, phonebookDir string, genesis bookkeeping.Genesis) (*AlgorandFullNode, error)
MakeFull sets up an Algorand full node (i.e., it returns a node that participates in consensus)
func (*AlgorandFullNode) BroadcastSignedTxGroup ¶
func (node *AlgorandFullNode) BroadcastSignedTxGroup(txgroup []transactions.SignedTxn) error
BroadcastSignedTxGroup broadcasts a transaction group that has already been signed.
func (*AlgorandFullNode) Config ¶
func (node *AlgorandFullNode) Config() config.Local
Config returns a copy of the node's Local configuration
func (*AlgorandFullNode) ExtendPeerList ¶
func (node *AlgorandFullNode) ExtendPeerList(peers ...string)
ExtendPeerList dynamically adds a peer to a node's peer list.
func (*AlgorandFullNode) GenesisHash ¶
func (node *AlgorandFullNode) GenesisHash() crypto.Digest
GenesisHash returns the hash of the genesis configuration.
func (*AlgorandFullNode) GenesisID ¶
func (node *AlgorandFullNode) GenesisID() string
GenesisID returns the ID of the genesis node.
func (*AlgorandFullNode) GetPendingTransaction ¶
func (node *AlgorandFullNode) GetPendingTransaction(txID transactions.Txid) (res TxnWithStatus, found bool)
GetPendingTransaction looks for the required txID in the recent ledger blocks, in the txpool, and in the txpool's status cache. It returns the SignedTxn (with status information), and a bool to indicate if the transaction was found.
func (*AlgorandFullNode) GetPendingTxnsFromPool ¶
func (node *AlgorandFullNode) GetPendingTxnsFromPool() ([]transactions.SignedTxn, error)
GetPendingTxnsFromPool returns a snapshot of every pending transactions from the node's transaction pool in a slice. Transactions are sorted in decreasing order. If no transactions, returns an empty slice.
func (*AlgorandFullNode) GetPrioWeight ¶
func (node *AlgorandFullNode) GetPrioWeight(addr basics.Address) uint64
GetPrioWeight implements the network.NetPrioScheme interface
func (*AlgorandFullNode) GetTransaction ¶
func (node *AlgorandFullNode) GetTransaction(addr basics.Address, txID transactions.Txid, minRound basics.Round, maxRound basics.Round) (TxnWithStatus, bool)
GetTransaction looks for the required txID within with a specific account withing a range of rounds (inclusive) and returns the SignedTxn and true iff it finds the transaction.
func (*AlgorandFullNode) GetTransactionByID ¶
func (node *AlgorandFullNode) GetTransactionByID(txid transactions.Txid, rnd basics.Round) (TxnWithStatus, error)
GetTransactionByID gets transaction by ID
func (*AlgorandFullNode) HasCaughtUp ¶
func (node *AlgorandFullNode) HasCaughtUp() bool
HasCaughtUp (implements NodeContext) returns true if we have completely caught up at least once
func (*AlgorandFullNode) Indexer ¶
func (node *AlgorandFullNode) Indexer() (*indexer.Indexer, error)
Indexer returns a pointer to nodes indexer
func (*AlgorandFullNode) IsArchival ¶
func (node *AlgorandFullNode) IsArchival() bool
IsArchival returns true the node is an archival node, false otherwise
func (*AlgorandFullNode) IsCatchingUp ¶
func (node *AlgorandFullNode) IsCatchingUp() bool
IsCatchingUp (implements NodeContext) returns true if our sync routine is currently running
func (*AlgorandFullNode) IsInitialCatchupComplete ¶
func (node *AlgorandFullNode) IsInitialCatchupComplete() bool
IsInitialCatchupComplete (implements NodeContext) returns true if the initial sync has completed (doesn't mean it succeeded)
func (*AlgorandFullNode) Ledger ¶
func (node *AlgorandFullNode) Ledger() *data.Ledger
Ledger exposes the node's ledger handle to the algod API code
func (*AlgorandFullNode) ListTxns ¶
func (node *AlgorandFullNode) ListTxns(addr basics.Address, minRound basics.Round, maxRound basics.Round) ([]TxnWithStatus, error)
ListTxns returns SignedTxns associated with a specific account in a range of Rounds (inclusive). TxnWithStatus returns the round in which a particular transaction appeared, since that information is not part of the SignedTxn itself.
func (*AlgorandFullNode) ListeningAddress ¶
func (node *AlgorandFullNode) ListeningAddress() (string, bool)
ListeningAddress retrieves the node's current listening address, if any. Returns true if currently listening, false otherwise.
func (*AlgorandFullNode) MakePrioResponse ¶
func (node *AlgorandFullNode) MakePrioResponse(challenge string) []byte
MakePrioResponse implements the network.NetPrioScheme interface
func (*AlgorandFullNode) NewPrioChallenge ¶
func (node *AlgorandFullNode) NewPrioChallenge() string
NewPrioChallenge implements the network.NetPrioScheme interface
func (*AlgorandFullNode) OnNewBlock ¶
func (node *AlgorandFullNode) OnNewBlock(block bookkeeping.Block, delta ledger.StateDelta)
OnNewBlock implements the BlockListener interface so we're notified after each block is written to the ledger
func (*AlgorandFullNode) PoolStats ¶
func (node *AlgorandFullNode) PoolStats() PoolStats
PoolStats returns a PoolStatus structure reporting stats about the transaction pool
func (*AlgorandFullNode) ReplacePeerList ¶
func (node *AlgorandFullNode) ReplacePeerList(peers ...string)
ReplacePeerList replaces the current peer list with a different one
func (*AlgorandFullNode) SetLastLiveRound ¶
func (node *AlgorandFullNode) SetLastLiveRound(round basics.Round)
SetLastLiveRound is called to record observation of a round completion
func (*AlgorandFullNode) Start ¶
func (node *AlgorandFullNode) Start()
Start the node: connect to peers and run the agreement service while obtaining a lock. Doesn't wait for initial sync.
func (*AlgorandFullNode) Status ¶
func (node *AlgorandFullNode) Status() (s StatusReport, err error)
Status returns a StatusReport structure reporting our status as Active and with our ledger's LastRound
func (*AlgorandFullNode) Stop ¶
func (node *AlgorandFullNode) Stop()
Stop stops running the node. Once a node is closed, it can never start again.
func (*AlgorandFullNode) SuggestedFee ¶
func (node *AlgorandFullNode) SuggestedFee() basics.MicroAlgos
SuggestedFee returns the suggested fee per byte recommended to ensure a new transaction is processed in a timely fashion. Caller should set fee to max(MinTxnFee, SuggestedFee() * len(encoded SignedTxn))
func (*AlgorandFullNode) Uint64 ¶
func (node *AlgorandFullNode) Uint64() uint64
Uint64 implements the randomness by calling the crypto library.
func (*AlgorandFullNode) VerifyPrioResponse ¶
func (node *AlgorandFullNode) VerifyPrioResponse(challenge string, response []byte) (addr basics.Address, err error)
VerifyPrioResponse implements the network.NetPrioScheme interface
type StatusReport ¶
type StatusReport struct {
LastRound basics.Round
LastVersion protocol.ConsensusVersion
NextVersion protocol.ConsensusVersion
NextVersionRound basics.Round
NextVersionSupported bool
LastRoundTimestamp time.Time
SynchronizingTime time.Duration
CatchupTime time.Duration
HasSyncedSinceStartup bool
}
StatusReport represents the current basic status of the node
func (StatusReport) TimeSinceLastRound ¶
func (status StatusReport) TimeSinceLastRound() time.Duration
TimeSinceLastRound returns the time since the last block was approved (locally), or 0 if no blocks seen
type TxnWithStatus ¶
type TxnWithStatus struct {
Txn transactions.SignedTxn
// Zero indicates no confirmation
ConfirmedRound basics.Round
// PoolError indicates that the transaction was kicked out of this
// node's transaction pool (and specifies why that happened). An
// empty string indicates the transaction wasn't kicked out of this
// node's txpool due to an error.
PoolError string
// ApplyData is the transaction.ApplyData, if committed.
ApplyData transactions.ApplyData
}
TxnWithStatus represents information about a single transaction, in particular, whether it has appeared in some block yet or not, and whether it was kicked out of the txpool due to some error.