Fullnode Rest API
Last updated
Last updated
If you wish to employ the , then this guide is for you. This guide will walk you through all you need to integrate the Endless blockchain into your platform with the Endless API.
Most integrations into the Endless blockchain benefit from a holistic and comprehensive overview of the current and historical state of the blockchain. Endless provides historical transactions, state, and events, all the result of transaction execution.
Historical transactions specify the execution status, output, and tie to related events. Each transaction has a unique version number associated with it that dictates its global sequential ordering in the history of the blockchain ledger.
The state is the representation of all transaction outputs up to a specific version. In other words, a state version is the accumulation of all transactions inclusive of that transaction version.
As transactions execute, they may emit events. Events are hints about changes in on-chain data.
The storage service on a node employs two forms of pruning that erase data from nodes:
state
events, transactions, and everything else
While either of these may be disabled, storing the state versions is not particularly sustainable.
Events and transactions pruning can be disabled via setting the to false
in storage_config.rs
. This is default behavior in Mainnet. In the near future, Endless will provide indexers that mitigate the need to directly query from a node.
The REST API offers querying transactions and events in these ways:
The view function operates like the Endless Simulation API, though with no side effects and an accessible output path. View functions can be called via the /view
endpoint. Calls to view functions require the module and function names along with input type parameters and values.
A function does not have to be immutable to be tagged as #[view]
, but if the function is mutable it will not result in state mutation when called from the API. If you want to tag a mutable function as #[view]
, consider making it private so that it cannot be maliciously called during runtime.
In order to use the View functions, you need to publish the module through the Endless CLI.
In the Endless CLI, a view function request would look like this:
In the TypeScript SDK, a view function request would look like this:
The view function returns a list of values as a vector. By default, the results are returned in JSON format; however, they can be optionally returned in Binary Canonical Serialization (BCS) encoded format.
View functions do not modify blockchain state when called from the API. A can be used to read potentially complex on-chain state using Move. For example, you can evaluate the EDS changes due to the transactions of blocks. Here are related files:
for an example
related code
.