Local Node with GraphQL API for DApp development and testing in TVM compatible blockchains (Everscale, Venom, TON, Gosh, etc.).
Have a question? Get quick help in our channel:
- Evernode Simple Emulator (SE)
- SE live control (REST API)
- Note for SE Developers
- Troubleshooting
Evernode Simple Emulator (SE) is a local instance of Evernode Platform that developer can run on their machine in one click to test applications locally.
At the moment we publish Evernode SE only as a docker image. But you can access non-docker builds of SE in community repos:
- Test your applications locally
- Test your contracts
- Run SE remotely on a server and test your application on a light local network from different devices.
- Latest Docker installed
Attention! Docker daemon must be running.
If you have EVERDEV installed globally on your machine, run this command
$ everdev se start
Checkout other Evernode SE commands accessible from EVERDEV.
Run this command
$ docker run -d --name local-node -e USER_AGREEMENT=yes -p80:80 tonlabs/local-node
To check that SE has been installed successfully check its local playground at http://0.0.0.0/graphql. For Windows, use http://127.0.0.1/graphql or http://localhost/graphql.
If you specified another port then add it to the local url http://0.0.0.0:port/graphql
Find out more about GraphQL API.
Evernode SE loads the blockchain configuration (config params) during its start from the configuration file blockchain.conf.json instead of special smart contract, which stores various config params in the real networks.
In order to change some of these params, do the following:
- Get blockchain.conf.json file and store it to the host's
filesystem
accessible by docker. In our example we store it at
/home/user/blockchain.conf.json
. - Edit the downloaded file, changing parameters you need. If one of the parameters is omitted or renamed, Evernode SE will not start.
- Create a new docker container, overriding its configuration file
(its path in the image is
/ton-node/blockchain.conf.json
) with the file from the host's filesystem. Change/home/user/blockchain.conf.json
to correct path pointing to the edited blockchain configuration file:
$ docker run -d --name local-node -e USER_AGREEMENT=yes -p80:80 \
-v /home/user/blockchain.conf.json:/ton-node/blockchain.conf.json \
tonlabs/local-node
- All the subsequent config changes will require only restart of the created container.
By default, Evernode SE logs the most of the information to the console, which is accessible by the next command:
$ docker logs local-node
More verbose logging is configured to /ton-node/log/
directory inside the running docker
container.
By default, there are two files: ton-node.log
for all logging and tvm.log
for tracing of TVM
execution:
code, stack, control registers, gas, etc.
Logging configuration is stored in /ton-node/log_cfg.yml
file by default,
but you can change this path with ton-node-config file in log_path
field.
In order to change the default logging verbosity of other parameters,
you can configure logging in several ways:
- In the running container by changing
/ton-node/log_cfg.yml
file:
$ docker exec -it local-node bash
bash-5.0# vi /ton-node/log_cfg.yml
(in order to exit from VI editor with saving changes press the ESC
key, then type :wq
and press
the ENTER
key)
Note: log_cfg.yml
file is normally scanned for changes every 30 seconds, so all changes made to
this file in running
container will be applied only after the scan.
Note: after recreation of the container, all changes made in its files will be lost, so use the second way, if you need to keep them.
- Before starting of the container, download and edit a copy
of log_cfg.yml file, then
mount this file to container's file system in
docker run
command:
$ docker run -d --name local-node -e USER_AGREEMENT=yes -p80:80 \
-v /home/user/log_cfg.yml:/ton-node/log_cfg.yml \
tonlabs/local-node
After starting of Evernode SE, you can edit this file in your file system without restart.
More information about log4rs configuration in the log4rs documentation.
Attention at the moment there are a few differences in SE behaviour comparing with a real TON blockchain . Read about them before you start implemennting. Please note that we plan to upgrade the SE behaviour in the next releases so that it will work the same way as a real network.
To connect to local blockchain from your application specify SE endpoints in SDK Client network config. .
- EverX implementation of TON VM written in Rust
- ArangoDB database
- GraphQL endpoint with web playground
- Ever.live blockchain explorer
- Pre-deployed high-performance Giver, ABI v2
Ever Live explorer runs on the same IP and port as Evernode SE, just open http://ip_address:port
(e.g. http://127.0.0.1)
In order to build and use Evernode Simple Emulator you need Docker. To build docker image, run from the repository root:
./build.sh
build.cmd
Evernode SE needs about 1Gb of memory but it is not limited to this value. There is an instance of
ArangoDB inside and GraphQL server running in NodeJS environment which can require more memory
during the high load over a long period of time. If there is a need to hardly limit memory
consumption then you can change default setting for these services. ArangoDB config is placed at
/arango/config
and GraphQL server entrypoint is at /q-server/entrypoint
. There is some minimum
required memory limits are preconfigured in ./memory/config
for ArangoDB and ./memory/entrypoint
.
You can copy them to evernode-se
container with the following commands
docker cp ./memory/config evernode-se:/arango/config
docker cp ./memory/entrypoint evernode-se:/q-server/entrypoint
Memory configuration values for ArangoDB can be found in official documentation
Note Node engine also consumes memory and can not be limited. So during the work memory consumption will be slightly increasing.
Warning Memory limitation affects Evernode SE performance so use it only if necessary
Evernode SE has special REST endpoint /se
that allows to perform live control over
running Evernode SE instance.
While the Evernode SE is running it has several properties that effect node behaviour:
gen_time_delta
– each time the node issues new block it sets the block'sgen_utime
tonow() + gen_time_delta
. When the node starts it sets thegen_time_delta
to0
.seq_mode
– if this mode is on then evernode SE produces separate block for each transaction and each block has uniquegen_utime
, equals to thegen_utime
of the previous block + 1.
SE control commands (must be sent using POST HTTP method):
-
/se/increase-time?delta=<seconds>
– increasegen_time_delta
by specified value. -
/se/reset-time
– resetsgen_time_delta
to0
. -
/se/time-delta
– returns currentgen_time_delta
value. -
/se/seq-mode-on
– turns on the sequential mode. -
/se/seq-mode-off
– turns off the sequential mode. -
/se/time
– returns current node time with included time delta. If seq mode is on then returned time is a time of the next block.
This repository contains several useful tools for SE development and debugging.
Dev tools resided in dev
folder and requires Node.js to execute (so you have to run npm i
inside this folder to prepare dev tools).
If you want to debug SE without docker you have to run evernode-se with following additional components:
-
Q Server (required to communicate with ever-sdk):
- Checkout
ton-q-server
from official repository. - Inside
ton-q-server
folder run:npm i
- Inside
evernode-se
folder run:node path-to-q-server/index --config ./dev/q-server.json
- Checkout
-
Arango DB (required to
ton-q-server
):- Download and install from official site.
- Start Arango DB Server.
- For the first time or if you want to reset database to initial state run:
node ./dev/reset-db
-
Evernode SE in debug mode
cargo run --release --bin evernode_se -- --workdir ./docker/ton-node --config ton-node.conf.json --blockchain-config blockchain.conf.json
Getting this error means docker service is not running or missing due to incorrect Docker installation, partiularly in the case of Docker Desktop. Try reinstalling Docker and making sure the daemon is running.
If you use certain adblockers, after you have started Evernode SE the Ever Live explorer at http://127.0.0.1/landing might fail to load (you get a rotating icon and varous warnings and errors in the console).
Try disabling the adblockers for the SE Ever Live explorer.