API methods available to smart contract¶
Docker container-based smart contracts can use node REST API. Smart contract developers can use limited list of REST API methods. This list is represented below, these methods are available directly from the container.
A smart contract can use Contracts methods implementing the separated
/internal/contracts/ route, which is totally identical to the regular Contracts methods.
Docker contract authorization¶
A smart contract requires an authorization to use the node REST API. There are following steps for the correct REST API methods usage by the smart contract:
The following variables should be defined in the Docker contract environment:
The Docker contract developer assigns the value of the variable
API_TOKENto the request header
X-Contract-Api-Token. The node specifies JWT authorization token into the variable
API_TOKENfor the contract creation and execution.
The contract code should pass the received token in the request header (
X-Contract-Api-Token) each time the node API is accessed.