Giter VIP home page Giter VIP logo

ever-node-tools's Introduction

WARNING! This repository is obsolete

Tools for Everscale/Venom blockchains were merged into Everscale/Venom node repository https://github.com/tonlabs/ever-node.git

ever-node-tools

Tools for Everscale/Venom blockchains

Table of Contents

About

This repository contains a collection of tools used to manage the Everscale/Venom node.

Getting Started

Prerequisites

  • Rust complier v1.65+.
  • OpenSSL
    sudo apt-get install libssl-dev (openssl-devel on Fedora)
    sudo apt-get install pkg-config

Installing

git clone --recurse-submodules https://github.com/tonlabs/ever-rldp.git
cd ever-rldp
cargo build --release

Usage

console

This tool serves the purpose of generating election requests for the Rust Node. The tool is compatible with TONOS-CLI and allows to perform all actions necessary to obtain a signed election request.

Command syntax

console -C console.json -c "commamd with parameters" -c "another command" -t timeout

Where

console.json - path to configuration file

commamd with parameters/ another command – any of the supported console commands with necessary parameters

timeout – command timeout in seconds

Configuration file should be created manually and have the following format:

{
		"config": {
				"server_address": "127.0.0.1:4924",
				"server_key": {
						"type_id": 1209251014,
						"pub_key": "cujCRU4rQbSw48yHVHxQtRPhUlbo+BuZggFTQSu04Y8="
				},
				"client_key": {
						"type_id": 1209251014,
						"pvt_key": "oEivbTDjSOSCgooUM0DAS2z2hIdnLw/PT82A/OFLDmA="
				}
		},
		"wallet_id": "-1:af17db43f40b6aa24e7203a9f8c8652310c88c125062d1129fe883eaa1bd6763",
		"max_factor": 2.7
}

Where

server_address – address and port of the node.

server_key – structure containing server public key. Can be generated with keygen tool.

client_key – structure containing client private key. Can be generated with keygen tool.

type_id – key type, indicating ed25519 is used. Should not be changed.

wallet_id – validator wallet address.

max_factormax_factor stake parameter (maximum ratio allowed between your stake and the minimal validator stake in the elected validator group), should be ≥ 1

Commands

election-bid

election-bid - obtains required information from the blockchain, generates all the necessary keys for validator, prepares the message in predefined format, asks to sign it and sends to the blockchain.

params:

election-start - unixtime of election start.

election-end - unixtime of election end.

filename - filename with path to save body of message ("validator-query.boc" by default)

Example:

console -c "election-bid 1608205174 1608288600"

Command calls all other necessary subcommands automatically. Election request is written to file.

recover_stake

recover_stake – recovers all or part of the validator stake from elector.

params:

filename - filename with path to save body of message ("recover-query.boc" by default)

Example:

console -c "recover_stake"

newkey

newkey - generates new key pair on server.

Command has no parameters.

Returns ed25519 hash of public key in hex and base64 format.

Example:

console -c "newkey"

exportpub

exportpub - exports public key by key hash.

params:

key_hash - ed25519 hash of public key in hex or base64 format.

Returns public_key - ed25519 public key in hex and base64 format.

Example:

console -c "exportpub 4374376452376543"

sign

sign - signs bytestring with private key.

params:

key_hash - ed25519 hash of public key in hex or base64 format.

data - data in hex or base64 format.

Example:

console -c "sign 4374376452376543 af17db43f40b6aa24e7203a9f8c8652310c88c125062d1129f"

addpermkey

addpermkey - adds validator permanent key

params:

key_hash - ed25519 hash of public key in hex or base64 format.

election-date - election start in unixtime.

expire-at- time the key expires and is deleted from node, in unixtime.

Example:

console -c "addpermkey 4374376452376543 1608205174 1608288600"

addtempkey

addtempkey - adds validator temporary key.

params:

perm_key_hash - ed25519 hash of permanent public key in hex or base64 format.

key_hash - ed25519 hash of public key in hex or base64 format.

expire-at - time the key expires and is deleted from node, in unixtime.

Example:

console -c "addtempkey 4374376452376543 6783978551824553 1608288600"

addvalidatoraddr

addvalidatoraddr - adds validator ADNL address.

params:

perm_key_hash - ed25519 hash of permanent public key in hex or base64 format.

key_hash - ed25519 hash of public key in hex or base64 format.

expire-at- time the ADNL address expires and is deleted from node, in unixtime.

Example:

console -c "addvalidatoraddr 4374376452376543 6783978551824553 1608288600"

addadnl

addadnl – sets key as ADNL address.

params:

perm_key_hash - ed25519 hash of permanent public key in hex or base64 format.

key_hash - ed25519 hash of public key in hex or base64 format.

expire-at - time the ADNL address expires and is deleted from node, in unixtime.

Example:

console -c "addadnl 4374376452376543 6783978551824553 1608288600"

getstats

getstats - get node status, validation status (if node is validator) and other information.

Command has no parameters.

Returns node's information in JSON-format.

base json-fields:

sync_status - synchronization status description;

masterchainblocktime - field with time of last masterchain block, downloaded by node;

masterchainblocknumber - field with number of last masterchain block, downloaded by node;

timediff - field with time difference between now and last loaded masterchain block's time;

in_current_vset_p34 - true, if config param p34 contains this node's key;

in_current_vset_p36 - true, if config param p36 contains this node's key;

last applied masterchain block id - field with information about last applied masterchain block's id;

processed workchain - field with information about the processed workchain;

validation_stats - field with information about validated workchains;

tps_10 - transactions per second average over 10 seconds;

tps_300 - transactions per second average over 300 seconds;

Example:

console -c "getstats"

sendmessage

sendmessage - loads a serialized message from file and sends it to nodes as an external message.

params:

file_name - serialized message file (in bag of cells format).

Example:

console -c "sendmessage message.boc"

getaccountstate

getaccountstate - save account to the file (in bag of cells format).

params:

account_address - is the account address.

file_name - is the file's name to save account's boc.

Returns account's boc.

Example:

console -c "getaccountstate 0:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F account.boc"

getaccount

getaccount - load and save (optional) account information in json-format.

params:

account_address - is the account address.

file_name - is the file's name to save account information in json-format. This param is optional.

Returns json with account information.

Base json-fields:

acc_type - account type description;

balance - account balance;

last_trans_lt - logical time of the last account's transaction;

data(boc) - account`s boc.

Example:

console -c "getaccount 0:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F"

getconfig

getconfig - get current config param from masterchain state.

params:

param_number - config parameter number.

Returns boc with current config param.

Example:

console -c "getconfig 15"

getblockchainconfig

getblockchainconfig - get current config from masterchain state.

Returns boc with current config.

Example:

console -c "getblockchainconfig"

zerostate

This tool generates config and zerostate for network launch from json zerostate file.

How to use

zerostate -i zerostate.json

Where

zerostate.json – is the zerostate file.

keygen

This tool generates an ed25519 key and prints it out in different formats.

How to use

keygen

Command has no parameters.

gendht

This tool generates the node DHT record, for example, for the purposes of adding it to the global blockchain config.

How to use

gendht ip:port pvt_key

Where

ip:port – Node IP address and port.

pvt_key – Node private key.

Example:

gendht 51.210.114.123:30303 ABwHd2EavvLJk789BjSF3OJBfX6c26Uzx1tMbnLnRTM=

dhtscan

This tool scans DHT for node records.

How to use

dhtscan [--jsonl] [--overlay] [--workchain0] path-to-global-config

Where

--jsonl – optional flag that sets the output as single line json. Default output is multiline json.

--overlay – optional flag to search for overlay nodes.

--workchain0 – optional flag to search both in masterchain and basechain. By default only masterchain is searched.

path-to-global-config – path to global config file.

print

This tool prints a state or block from the database.

How to use

print -d path [-s state_id] [-b block_id] [--accounts]

Where

path – path to node database.

block_id – id of the block to be printed.

state_id – id of the state to be printed.

accounts - short info of all accounts will be printed as json

Contributing

Contribution to the project is expected to be done via pull requests submission.

License

See the LICENSE file for details.

Tags

blockchain everscale rust venom-blockchain venom-developer-program venom-tools

ever-node-tools's People

Contributors

antonivanchukov avatar atomxy avatar bvscd avatar iagen avatar joydark avatar lenykholodov avatar sehor05 avatar sumrachek avatar tonjen avatar yaroslavser avatar

Stargazers

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

Watchers

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

ever-node-tools's Issues

error: could not find system library 'libzstd' required by the 'zstd-sys' crate

RUST_BACKTRACE=1 cargo build
   Compiling serde v1.0.166
   Compiling failure_derive v0.1.8
   Compiling futures-util v0.3.28
   Compiling tokio v1.28.2
   Compiling zeroize v1.3.0
   Compiling num v0.4.0
   Compiling zstd-sys v2.0.8+zstd.1.5.5
   Compiling pin-project v1.1.2
   Compiling thiserror v1.0.40
   Compiling openssl-sys v0.9.90
   Compiling openssl v0.10.55
   Compiling native-tls v0.2.11
   Compiling prettyplease v0.2.9
   Compiling regex v1.8.4
   Compiling tikv-jemalloc-sys v0.5.3+5.3.0-patched
error: failed to run custom build command for `zstd-sys v2.0.8+zstd.1.5.5`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `/home/oleg/Projects/ever-node-tools/target/debug/build/zstd-sys-a6af9cdb049c697a/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=ZSTD_SYS_USE_PKG_CONFIG
  cargo:rerun-if-env-changed=LIBZSTD_NO_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_PATH
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
  cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

  --- stderr
  thread 'main' panicked at 'Can't probe for zstd in pkg-config: `PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" PKG_CONFIG_ALLOW_SYSTEM_LIBS="1" "pkg-config" "--static" "--libs" "--cflags" "libzstd"` did not exit successfully: exit status: 1
  error: could not find system library 'libzstd' required by the 'zstd-sys' crate

  --- stderr
  Package libzstd was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libzstd.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libzstd' found
  ', /home/oleg/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zstd-sys-2.0.8+zstd.1.5.5/build.rs:46:10
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:578:5
     1: core::panicking::panic_fmt
               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panicking.rs:67:14
     2: core::result::unwrap_failed
               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/result.rs:1687:5
     3: core::result::Result<T,E>::expect
     4: build_script_build::pkg_config
     5: build_script_build::main
     6: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
warning: build failed, waiting for other jobs to finish...

Installation failed with # cargo build --release

Installation failed with # cargo build --release

It looks like you're compiling on Linux and also targeting Linux. Currently this
requires the pkg-config utility to find OpenSSL but unfortunately pkg-config
could not be found. If you have OpenSSL installed you can likely fix this by
installing pkg-config.

', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.61/build/find_normal.rs:174:5
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed

image

build error

branch use-console-for-elections
commit 79591b6

error[E0422]: cannot find struct, variant or union type GetAccount in module ton::rpc::raw
--> bin/console.rs:381:42
|
381 | let get_account = ton::rpc::raw::GetAccount { account_address: account, workchain: workchain };
| ^^^^^^^^^^ not found in ton::rpc::raw

error: aborting due to previous error

Build is broken

Compiling ton_node v0.47.43 (https://github.com/tonlabs/ton-labs-node.git?branch=rustnet#ac841b04)
error[E0432]: unresolved import `ton_node::collator_test_bundle::create_engine_allocated`
 --> bin/print.rs:7:5
  |
7 |     collator_test_bundle::create_engine_allocated, 
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `create_engine_allocated` in `collator_test_bundle`

error[E0432]: unresolved import `ton_node::collator_test_bundle::create_engine_telemetry`
  --> bin/print.rs:11:5
   |
11 | use ton_node::collator_test_bundle::create_engine_telemetry;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `create_engine_telemetry` in `collator_test_bundle`

error[E0061]: this function takes 1 argument but 3 arguments were supplied
   --> bin/print.rs:126:18
    |
126 |         let db = InternalDbImpl::new(
    |                  ^^^^^^^^^^^^^^^^^^^ expected 1 argument
127 |             db_config, 
    |             ---------
128 |             #[cfg(feature = "telemetry")]
129 |             create_engine_telemetry(),
    |             -------------------------
130 |             create_engine_allocated()
    |             ------------------------- supplied 3 arguments
    |
note: associated function defined here
   --> /home/svt/.cargo/git/checkouts/ton-labs-node-40e10ba0cb7afa0f/ac841b0/src/internal_db/mod.rs:266:18
    |
266 |     pub async fn new(config: InternalDbConfig) -> Result<Self> {
    |                  ^^^

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0061, E0432.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `ton-node-tools`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

error: current package believes it's in a workspace when it's not

ton-labs-node-tools# cargo build
error: current package believes it's in a workspace when it's not:
current: /opt/rustnet.ton.dev/docker-compose/ton-node/build/ton-node/ton-labs-node-tools/Cargo.toml
workspace: /opt/rustnet.ton.dev/docker-compose/ton-node/build/ton-node/Cargo.toml

this may be fixable by adding ton-labs-node-tools to the workspace.members array of the manifest located at: /opt/rustnet.ton.dev/docker-compose/ton-node/build/ton-node/Cargo.toml
Alternatively, to keep it out of the workspace, add the package to the workspace.exclude array, or add an empty [workspace] table to the package's manifest.

docs error

config.json - path to configuration file
should be console.json?

Wrong JSON output

tonlabs console 0.1.27
COMMIT_ID: 8684d858561580b5ee7e7621f1ef8a522584adbd
BUILD_DATE: 2021-07-30 16:03:46 +0300
COMMIT_DATE: 2021-07-30 13:58:46 +0300
GIT_BRANCH: master
{
	"masterchainblocktime":	1627652276,
	"masterchainblocknumber":	379863,
	"timediff":	9,
	"in_current_vset_p34":	false,
	"in_next_vset_p36":	false,
	"validation_stats":	,
	"collation_stats":	
}

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.