Giter Club home page Giter Club logo

everx-labs / evernode-ds Goto Github PK

View Code? Open in Web Editor NEW
34.0 8.0 21.0 16.59 MB

Community version of Evernode Platform (client supernode with GraphQL API) for TVM blockchains (Everscale, Venom, TON, Gosh) that exposes GraphQL API.

License: Apache License 2.0

Dockerfile 5.19% Shell 26.19% JavaScript 9.18% DIGITAL Command Language 1.86% HTML 0.14% Solidity 38.65% TypeScript 18.79%
everscale node client api graphql evernode blockchain fullnode supernode ton

evernode-ds's Introduction

Evernode DApp Server

Evernode DApp Server is a community (open source) version of Ever Platform (client supernode with GraphQL API) for TVM blockchains (Everscale, Venom, TON, Gosh) that exposes GraphQL API.

Evernode DApp Server is compatible with ever-sdk, everdev, everscale-inpage-provider, evescale-standalone-client and other libraries and tools for TVM blockchains.

This repository contains instructions on how to run your own free instance of Evernode Platform to connect your application to TVM blockchains.
The instructions and scripts were verified on Ubuntu 20.04.

Table of Contents

1. What is Evernode DApp Server?

Evernode DApp Server is a set of services that provides a GraphQL API for TVM blockchains.

The client application can send messages to the blockchain and receive the results by performing the appropriate GraphQL operations:

  • Mutation - to send an external message to the blockchain.
  • Query - to query blockchain data.
  • Subscription - to subscribe for blockchain events.

DApp Server consists of:

  • Evernode, written in Rust and focused on performance and safety, is the core element of DApp Server.

  • Everscale GraphQL Server (referred as Q-Server) provides GraphQL endpoint for sending messages and querying blockchain.

  • ArangoDB - multi-model database with the information about all blockchain entities (like accounts, blocks, transactions, etc.) stored over time.

  • Kafka stream-processing platform for communication between services.

  • StatsD exporter to collect and expose metrics to Prometheus.

2. Overview of technical architecture

Evernode DApp server provides the following endpoints:

2.1 Service interaction diagram:

In this diagram, the bold arrows show how external messages are processed.

  • The client application sends a message (represented as a GraphQL mutation operation) to the Q-Server.
  • Q-Server sends this message (via Kafka) to Ever-node for processing.
  • Ever-node continuously provides (via Kafka) updated blockchain data as JSON documents (blocks, messages, transactions, account states) to ArangoDB.
  • Q-Server queries ArangoDB, thus knowing the result of the message execution.

Services interaction:

This scripts run all services as docker containers inside one docker bridge network.
Recommended system configuration for this setup are shown below:

CPU (cores) RAM (GiB) Storage (GiB) Network (Gbit/s)
24 128 2000. (NVMe SSD disks are recommended) 1

See 4. Notes

3. Getting Started

3.1 Prerequisites

  • Host OS: Linux (all scripts tested on Ubuntu 20.04).
  • DApp server is accessed via HTTPS, so your server must have a fully qualified domain name.
    A self-signed certificate will be received on start-up and will be renewed automatically.
  • Installed Git, Docker Engine, Docker CLI, Docker Compose v2 or later.

3.2 Configuration

3.2.1 Set variables

Check configure.sh and set at least these environment variables:

  • NETWORK_TYPE
  • EVERNODE_FQDN
  • LETSENCRYPT_EMAIL

3.2.2 Generate credentials to access the ArangoDB web interface

Generate credentials (usernames and password) for basic authentication and update .htpasswd file.
You can generate it by running htpasswd -nb <name> <password>

3.2.3 Run configuration script

$ ./configure.sh

This script creates ./deploy directory

3.3 Deployment

Run ./up.sh.

After the script completes normally (it takes 30 min approx.), the node starts synchronizing its state, which can take several hours.
Use the following command to check the progress:

    docker exec ever-node /ever-node/tools/console -C /ever-node/configs/console.json --cmd getstats

Script output example:

tonlabs console 0.1.286
COMMIT_ID: 5efe6bb8f2a974ba0e6b1ea3e58233632236e182
BUILD_DATE: 2022-10-17 02:32:44 +0300
COMMIT_DATE: 2022-08-12 00:22:07 +0300
GIT_BRANCH: master
{
	"sync_status":	"synchronization_finished",
	"masterchainblocktime":	1665988670,
	"masterchainblocknumber":	9194424,
	"node_version":	"0.51.1",
	"public_overlay_key_id":	"S4TaVdGitzTApe7GFCj8DbuRIkVEbg+ODzBxhQGIUG0=",
	"timediff":	6,
	"shards_timediff":	6,
     ----%<---------------------
}

If the timediff parameter is less than 10 seconds, synchronization with masterchain is complete.
"sync_status": "synchronization finished" means synchronization with workchains is complete.

3.4 Tests

To verify that the DApp server is actually functional, after the sync process is complete, run the test below. This test deploys wallet and transfers 0.5 tokens from the wallet to another address.

$ cd tests
$ chmod o+w package-lock.json
$ docker build --tag evernode_test .
$ docker run --rm -e ENDPOINT=https://<your_domain>/graphql evernode_test

Example output

> npx ts-node src/wallet.ts
You can topup your wallet from dashboard at https://dashboard.evercloud.dev
Please send >= 1 tokens to 0:8a447eca3adde54414ab760d3633b96d5e7706a754450adfed587ac191c5b117
awaiting...

Here the test will block until you send some tokens to that address.
In devnet you can do it using our dashboard at https://dashboard.evercloud.dev or telegram bot https://t.me/everdev_giver_bot

Account balance is: 100 tokens. Account type is 0
Deploying wallet contract to address: 0:8a447eca3adde54414ab760d3633b96d5e7706a754450adfed587ac191c5b117 and waiting for transaction...
Contract deployed. Transaction hash 318d2acfabd15a9e5ffd58c06c00074c67eca414f25e973c3332a8aeaa574bf1
Sending 0.5 token to -1:7777777777777777777777777777777777777777777777777777777777777777
Transfer completed. Transaction hash 54fdd8cce38c6078a25aae61c7deed2e5664c847c171048a814692440ee37610
Transaction hash: 1d3bf7ef8a50ad38012f304a38c94fe4bca5bc1b50c2d4dd45ce2a71dc7c0921
Transaction hash: 318d2acfabd15a9e5ffd58c06c00074c67eca414f25e973c3332a8aeaa574bf1
Transaction hash: 54fdd8cce38c6078a25aae61c7deed2e5664c847c171048a814692440ee37610

Congratulations! Your DApp server is set up.

4. Notes

  • This repository is a "quick start" to get your first DApp server up and running.
  • The installation process is simple, written in pure bash and requires installation from scratch.
  • For simplicity, all services are deployed on one host and the system requirements for it are high, so it makes sense to distribute services across different servers.
    After understanding this installation process, you can easily customize it for yourself.

5. Related projects

evernode-ds's People

Contributors

a-zorina avatar alex-novikov-1990 avatar alexeyvavilin avatar ar-tmp avatar artem-zhdanov avatar aslanin avatar bvscd avatar elasticlove1 avatar futurizt avatar g9d avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

evernode-ds's Issues

NETWORK_TYPE=main.ton.dev error

TON OS App server,
NETWORK_TYPE=main.ton.dev
When ton-node does not synchronize data, it prompts the above error
1616735461.529732438 TRACE [ton_node::external_db::kafka_producer] 140566803049472: Creating kafka producer (topic: blocks)...
1616735461.532777063 TRACE [ton_node::external_db::kafka_producer] 140566803049472: Kafka producer (topic: ) is DISABLED
1616735461.532810242 TRACE [ton_node::external_db::kafka_producer] 140566803049472: Creating kafka producer (topic: messages)...
1616735461.533083563 TRACE [ton_node::external_db::kafka_producer] 140566803049472: Creating kafka producer (topic: transactions)...
1616735461.533408231 TRACE [ton_node::external_db::kafka_producer] 140566803049472: Creating kafka producer (topic: accounts)...
1616735461.533640828 TRACE [ton_node::external_db::kafka_producer] 140566803049472: Creating kafka producer (topic: blocks_signatures)...
1616735461.534159416 INFO [ton_node::engine] 140566803049472: Engine::run
1616735461.534191643 INFO [ton_node::engine] 140566803049472: Creating engine...
1616735462.035297289 ERROR [ton_node] 140566803049472: Can't start node's Engine: Error("invalid type: integer 404, expected struct TonNodeGlobalConfigJson", line: 1, column: 4)

image

error

docker-compose/ton-node/build/Dockerfile

I suggest the RUST version be changed to 1.53.0

Для перезапуска сервера нужен другой скрипт?

Запускал https://github.com/tonlabs/TON-OS-DApp-Server .

  1. при первом deploy.sh создаёт докер-контейнеры и запускает службы;
  2. при втором deploy.sh стопит службы и удаляет директории в докер-контейнерах;
  3. при третьем и следующем deploy.sh снова удаляет директории в докер-контейнерах
    и пытается запустить службы из этих же директорий. Соответственно их не находит и падает с ошибками.

Так и задуманно или нужно написать скрипт re-deploy.sh для повторного запуска TON-OS-DApp-Server?

build fail

build fails on ton-node

   Compiling external-ip v4.1.0
error[E0063]: missing field `tag` in initializer of `TaggedObject<&[u8]>`
    --> /root/.cargo/git/checkouts/ton-labs-rldp-3f95b4b391aaae2a/6643e9d/src/lib.rs:1129:33
     |
1129 |                     let chunk = TaggedByteSlice {
     |                                 ^^^^^^^^^^^^^^^ missing `tag`

error[E0063]: missing field `tag` in initializer of `TaggedObject<&[u8]>`
   --> /root/.cargo/git/checkouts/ton-labs-rldp-3f95b4b391aaae2a/6643e9d/src/lib.rs:199:27
    |
199 |                 let ret = TaggedByteSlice {
    |                           ^^^^^^^^^^^^^^^ missing `tag`

error[E0063]: missing field `tag` in initializer of `TaggedObject<&[u8]>`
   --> /root/.cargo/git/checkouts/ton-labs-rldp-3f95b4b391aaae2a/6643e9d/src/lib.rs:215:19
    |
215 |         let ret = TaggedByteSlice {
    |                   ^^^^^^^^^^^^^^^ missing `tag`

error[E0063]: missing field `tag` in initializer of `TaggedObject<&[u8]>`
    --> /root/.cargo/git/checkouts/ton-labs-rldp-3f95b4b391aaae2a/6643e9d/src/lib.rs:1223:34
     |
1223 | ...                   &TaggedByteSlice {
     |                        ^^^^^^^^^^^^^^^ missing `tag`

error[E0063]: missing field `tag` in initializer of `TaggedObject<&[u8]>`
    --> /root/.cargo/git/checkouts/ton-labs-rldp-3f95b4b391aaae2a/6643e9d/src/lib.rs:1235:34
     |
1235 | ...                   &TaggedByteSlice {
     |                        ^^^^^^^^^^^^^^^ missing `tag`

error: aborting due to 5 previous errors

Deploy.sh падает с ошибкой при запуске контейнера ./ton-node.

При выполнение скрипта deploy.sh вылетает следущая
ошибка:
error: couldn't read catchain/../common/build/build.rs: No such file or directory (os error 2)
error: aborting due to previous error
error: could not compile catchain
To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
ERROR: Service 'node' failed to build: The command '/bin/sh -c cargo build --release --features "external_db,metrics"' returned a non-zero code: 101

{Почему-то директория: /TON-OS-DApp-Server/docker-compose/ton-node/build/ton-node/common не содержит никаких файлов.
Решение:
Выполнил команду: git submodule update --init в следующей директории
~/TON-OS-DApp-Server/docker-compose/ton-node/build/ton-node#

В конфигах ton-node до кучи прописал rust 1.49.0. Далее запускал поочерёдно каждый контейнер вручную. В итоге DApp запустился без проблем. До этого пользовался этими скриптами без проблем. Были какие-то изменения, может что-то из них не учитывается в текущих скриптах.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.