Documentation ¶
Index ¶
- Constants
- Variables
- type ElrondNodeFacade
- func (ef *ElrondNodeFacade) GenerateAndSendBulkTransactions(destination string, value *big.Int, nrTransactions uint64) error
- func (ef *ElrondNodeFacade) GenerateAndSendBulkTransactionsOneByOne(destination string, value *big.Int, nrTransactions uint64) error
- func (ef *ElrondNodeFacade) GenerateTransaction(senderHex string, receiverHex string, value *big.Int, data string) (*transaction.Transaction, error)
- func (ef *ElrondNodeFacade) GetAccount(address string) (*state.Account, error)
- func (ef *ElrondNodeFacade) GetBalance(address string) (*big.Int, error)
- func (ef *ElrondNodeFacade) GetCurrentPublicKey() string
- func (ef *ElrondNodeFacade) GetHeartbeats() ([]heartbeat.PubKeyHeartbeat, error)
- func (ef *ElrondNodeFacade) GetTransaction(hash string) (*transaction.Transaction, error)
- func (ef *ElrondNodeFacade) IsNodeRunning() bool
- func (ef *ElrondNodeFacade) RecentNotarizedBlocks(maxShardHeadersNum int) ([]*external.BlockHeader, error)
- func (ef *ElrondNodeFacade) RestApiPort() string
- func (ef *ElrondNodeFacade) RetrieveShardBlock(blockHash []byte) (*external.ShardBlockInfo, error)
- func (ef *ElrondNodeFacade) SendTransaction(nonce uint64, senderHex string, receiverHex string, value *big.Int, ...) (string, error)
- func (ef *ElrondNodeFacade) SetConfig(facadeConfig *config.FacadeConfig)
- func (ef *ElrondNodeFacade) SetLogger(log *logger.Logger)
- func (ef *ElrondNodeFacade) SetSyncer(syncer ntp.SyncTimer)
- func (ef *ElrondNodeFacade) SetTpsBenchmark(tpsBenchmark *statistics.TpsBenchmark)
- func (ef *ElrondNodeFacade) StartBackgroundServices(wg *sync.WaitGroup)
- func (ef *ElrondNodeFacade) StartNode() error
- func (ef *ElrondNodeFacade) StopNode() error
- func (ef *ElrondNodeFacade) TpsBenchmark() *statistics.TpsBenchmark
- type ExternalResolver
- type NodeWrapper
Constants ¶
const DefaultRestPort = "8080"
DefaultRestPort is the default port the REST API will start on if not specified
const DefaultRestPortOff = "off"
DefaultRestPortOff is the default value that should be passed if it is desired
to start the node without a REST endpoint available
Variables ¶
var ErrHeartbeatsNotActive = errors.New("heartbeat system not active")
ErrHeartbeatsNotActive signals that the heartbeat system is not active
Functions ¶
This section is empty.
Types ¶
type ElrondNodeFacade ¶
type ElrondNodeFacade struct {
// contains filtered or unexported fields
}
ElrondNodeFacade represents a facade for grouping the functionality for node, transaction and address
func NewElrondNodeFacade ¶
func NewElrondNodeFacade(node NodeWrapper, resolver ExternalResolver) *ElrondNodeFacade
NewElrondNodeFacade creates a new Facade with a NodeWrapper
func (*ElrondNodeFacade) GenerateAndSendBulkTransactions ¶ added in v1.0.3
func (ef *ElrondNodeFacade) GenerateAndSendBulkTransactions( destination string, value *big.Int, nrTransactions uint64, ) error
GenerateAndSendBulkTransactions generates a number of nrTransactions of amount value for the receiver destination
func (*ElrondNodeFacade) GenerateAndSendBulkTransactionsOneByOne ¶ added in v1.0.3
func (ef *ElrondNodeFacade) GenerateAndSendBulkTransactionsOneByOne( destination string, value *big.Int, nrTransactions uint64, ) error
GenerateAndSendBulkTransactionsOneByOne generates a number of nrTransactions of amount value for the receiver destination in a one by one fashion
func (*ElrondNodeFacade) GenerateTransaction ¶ added in v1.0.3
func (ef *ElrondNodeFacade) GenerateTransaction(senderHex string, receiverHex string, value *big.Int, data string) (*transaction.Transaction, error)
GenerateTransaction generates a transaction from a sender, receiver, value and data
func (*ElrondNodeFacade) GetAccount ¶
func (ef *ElrondNodeFacade) GetAccount(address string) (*state.Account, error)
GetAccount returns an accountResponse containing information about the account correlated with provided address
func (*ElrondNodeFacade) GetBalance ¶
func (ef *ElrondNodeFacade) GetBalance(address string) (*big.Int, error)
GetBalance gets the current balance for a specified address
func (*ElrondNodeFacade) GetCurrentPublicKey ¶ added in v1.0.3
func (ef *ElrondNodeFacade) GetCurrentPublicKey() string
GetCurrentPublicKey gets the current nodes public Key
func (*ElrondNodeFacade) GetHeartbeats ¶
func (ef *ElrondNodeFacade) GetHeartbeats() ([]heartbeat.PubKeyHeartbeat, error)
GetHeartbeats returns the heartbeat status for each public key from initial list or later joined to the network
func (*ElrondNodeFacade) GetTransaction ¶
func (ef *ElrondNodeFacade) GetTransaction(hash string) (*transaction.Transaction, error)
GetTransaction gets the transaction with a specified hash
func (*ElrondNodeFacade) IsNodeRunning ¶
func (ef *ElrondNodeFacade) IsNodeRunning() bool
IsNodeRunning gets if the underlying node is running
func (*ElrondNodeFacade) RecentNotarizedBlocks ¶ added in v1.0.3
func (ef *ElrondNodeFacade) RecentNotarizedBlocks(maxShardHeadersNum int) ([]*external.BlockHeader, error)
RecentNotarizedBlocks computes last notarized [maxShardHeadersNum] shard headers (by metachain node)
func (*ElrondNodeFacade) RestApiPort ¶ added in v1.0.3
func (ef *ElrondNodeFacade) RestApiPort() string
RestApiPort returns the port on which the api should start on, based on the config file provided. The API will start on the DefaultRestPort value unless a correct value is passed or
the value is explicitly set to off, in which case it will not start at all
func (*ElrondNodeFacade) RetrieveShardBlock ¶ added in v1.0.3
func (ef *ElrondNodeFacade) RetrieveShardBlock(blockHash []byte) (*external.ShardBlockInfo, error)
RetrieveShardBlock retrieves a shard block info containing header and transactions
func (*ElrondNodeFacade) SendTransaction ¶ added in v1.0.3
func (ef *ElrondNodeFacade) SendTransaction( nonce uint64, senderHex string, receiverHex string, value *big.Int, gasPrice uint64, gasLimit uint64, transactionData string, signature []byte, ) (string, error)
SendTransaction will send a new transaction on the topic channel
func (*ElrondNodeFacade) SetConfig ¶
func (ef *ElrondNodeFacade) SetConfig(facadeConfig *config.FacadeConfig)
SetConfig sets the configuration options for the facade
func (*ElrondNodeFacade) SetLogger ¶ added in v1.0.3
func (ef *ElrondNodeFacade) SetLogger(log *logger.Logger)
SetLogger sets the current logger
func (*ElrondNodeFacade) SetSyncer ¶
func (ef *ElrondNodeFacade) SetSyncer(syncer ntp.SyncTimer)
SetSyncer sets the current syncer
func (*ElrondNodeFacade) SetTpsBenchmark ¶
func (ef *ElrondNodeFacade) SetTpsBenchmark(tpsBenchmark *statistics.TpsBenchmark)
SetTpsBenchmark sets the tps benchmark handler
func (*ElrondNodeFacade) StartBackgroundServices ¶
func (ef *ElrondNodeFacade) StartBackgroundServices(wg *sync.WaitGroup)
StartBackgroundServices starts all background services needed for the correct functionality of the node
func (*ElrondNodeFacade) StartNode ¶
func (ef *ElrondNodeFacade) StartNode() error
StartNode starts the underlying node
func (*ElrondNodeFacade) StopNode ¶ added in v1.0.3
func (ef *ElrondNodeFacade) StopNode() error
StopNode stops the underlying node
func (*ElrondNodeFacade) TpsBenchmark ¶
func (ef *ElrondNodeFacade) TpsBenchmark() *statistics.TpsBenchmark
TpsBenchmark returns the tps benchmark handler
type ExternalResolver ¶ added in v1.0.3
type ExternalResolver interface { RecentNotarizedBlocks(maxShardHeadersNum int) ([]*external.BlockHeader, error) RetrieveShardBlock(blockHash []byte) (*external.ShardBlockInfo, error) }
ExternalResolver defines what functionality can be exposed to an external component (REST API, RPC, etc.)
type NodeWrapper ¶
type NodeWrapper interface { // Start will create a new messenger and and set up the Node state as running Start() error // Stop closes the messenger and undos everything done in Start Stop() error // P2PBootstrap starts the peer discovery process and peer connection filtering P2PBootstrap() error //IsRunning returns if the underlying node is running IsRunning() bool // StartConsensus will start the consesus service for the current node StartConsensus() error //GetBalance returns the balance for a specific address GetBalance(address string) (*big.Int, error) //GenerateTransaction generates a new transaction with sender, receiver, amount and code GenerateTransaction(senderHex string, receiverHex string, amount *big.Int, code string) (*transaction.Transaction, error) //SendTransaction will send a new transaction on the topic channel SendTransaction(nonce uint64, senderHex string, receiverHex string, value *big.Int, gasPrice uint64, gasLimit uint64, transactionData string, signature []byte) (string, error) //GetTransaction gets the transaction GetTransaction(hash string) (*transaction.Transaction, error) // GetCurrentPublicKey gets the current nodes public Key GetCurrentPublicKey() string // GenerateAndSendBulkTransactions generates a number of nrTransactions of amount value // for the receiver destination GenerateAndSendBulkTransactions(string, *big.Int, uint64) error // GenerateAndSendBulkTransactionsOneByOne generates a number of nrTransactions of amount value // for the receiver destination in a one-by-one fashion GenerateAndSendBulkTransactionsOneByOne(string, *big.Int, uint64) error // GetAccount returns an accountResponse containing information // about the account corelated with provided address GetAccount(address string) (*state.Account, error) // GetHeartbeats returns the heartbeat status for each public key defined in genesis.json GetHeartbeats() []heartbeat.PubKeyHeartbeat }
NodeWrapper contains all functions that a node should contain.