MCPcopy Index your code
hub / github.com/everx-labs/ever-sdk

github.com/everx-labs/ever-sdk @1.49.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.49.2 ↗ · + Follow
2,828 symbols 7,866 edges 253 files 92 documented · 3% updated 15mo ago1.49.2 · 2024-11-22★ 1702 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Ever SDK

Client libraries for DApp development in TVM blockchains (Everscale, Gosh, TON, Venom Blockchain, etc.).

Core Ever-SDK client library is written in Rust, with bindings in 11 programming languages.

Get quick help in our telegram channel:

Channel on Telegram

Supported languages

Rust (core library)

Repository: https://github.com/everx-labs/ever-sdk

What is Core Client Library?

Core Client Library is written in Rust that can be dynamically linked. It provides all heavy-computation components and functions, such as TON Virtual Machine, TON Transaction Executor, ABI-related functions, boc-related functions, crypto functions.

The decision to create the Rust library was made after a period of time using pure JavaScript to implement these use cases.

We ended up with very slow work of pure JavaScript and decided to move all this to Rust library and link it to Javascript as a compiled binary including a wasm module for browser applications.

Also, this approach provided an opportunity to easily create bindings for any programming language and platform, thus, to make it possible to develop distributed applications (DApps) for any possible use-cases, such as: mobile DApps, web DApps, server-side DApps, enterprise DApp etc.

Client Library exposes all the functionality through a few of exported functions. All interaction with library is performed using JSON-RPC like protocol.

Official Javascript(Typescript) binding

Repository: JavaScript SDK

You need to install core package and the package with binary for your platform. See the documentation.

Platform Package
core package for all platforms @eversdk/core
Node.js @eversdk/lib-node
Web @eversdk/lib-web
React-Native @eversdk/lib-react-native
React-Native with JSI support @eversdk/lib-react-native-jsi

Community bindings

Language Repository
Clojure serge-medvedev/tonos-client-clojure
Golang

radianceteam/ton-client-go

markgenuine/ever-client-go

| | Java |

radianceteam/ton-client-java

laugan/java4ever-binding

| | Kotlin | mdorofeev/ton-client-kotlin | | Lua | serge-medvedev/tonos-client-lua | | .NET | everscale-actions/everscale-dotnet | | PHP |

extraton/php-ton-client

radianceteam/ton-client-php

  |

| Python | move-ton/ton-client-py | | Ruby | nerzh/ton-client-ruby | | Scala | radianceteam/ton-client-scala | | Swift | nerzh/ton-client-swift |

If you did not find the language you need

  • use library module json_interface which provides access to library functions through JSON-RPC interface. This interface exports several extern "C" functions. So you can build a dynamic or static link library and link it to your application as any other external libraries. The JSON Interface is fully "C" compliant. You can find description in section JSON Interface.
  • write your own binding to chosen language and share it with community.

If you choose using JSON Interface please read this document JSON Interface.\ Here you can find directions how to use json_interface and write your own binding.

Use-cases

With Ever-SDK you can implement logic of any complexity on TVM compatible blockchains (Everscale, Gosh, TON, Venom, etc.).

  • Create and send messages to blockchain
  • Process messages reliably (supports retries and message expiration mechanics)
  • Supports TON Solidity and ABI compatible contracts
  • Emulate transactions locally
  • Run get methods
  • Get account state
  • Query blockchain data (blocks, transactions, messages)
  • Subscribe to events and any other blockchain updates (literally)
  • Sign data/check signature, calculate hashes (sha256, sha512), encrypt/decrypt data
  • Validate addresses
  • Work with blockchain native types (bag of cells or BOCs): encode, decode, calculate hash, etc
  • Works on top of GraphQL API and compatible with Evernode-SE/DS, Evercloud.

Quick Start

Get your endpoint at dashboard.evercloud.dev or run Evernode-SE (local node) or Dapp Server (self-hosted blockchain node).

See the list of available TVM networks: https://docs.everplatform.dev/products/evercloud/networks-endpoints

Quick Start (Javascript binding)

Error descriptions

JavaScript SDK Types and Methods (API Reference)

Core Types and Methods (API Reference)

Guides

How to avoid Soft Breaking Problems

Soft Breaking is API changes that include only new optional fields in the existing structures. These changes are fully backward compatible for JSON Interface.

But in Rust such changes can produce some problems with an old client code.

Look at the example below:

  1. There is an API v1.0 function foo and the corresponding params structure:
#[derive(Default)]
struct ParamsOfFoo {
    pub foo: String,
}

pub fn foo(params: ParamsOfFoo)
  1. Application uses this function in this way:
foo(ParamsOfFoo {
    foo: "foo".into(),
});
  1. API v.1.1 introduces new field in ParamsOfFoo:
#[derive(Default)]
struct ParamsOfFoo {
    pub foo: String,
    pub bar: Option<String>,
}

From the perspective of JSON-interface it isn't breaking change because the new parameter is optional. But code snippet (2) will produce Rust compilation error.

  1. To avoid such problems we recommend to use default implementation inside structure initialisation:
foo(ParamsOfFoo {
    foo: "foo".into(),
    ..Default::default(),
});

For all Ton Client API structures Default trait is implemented.

Build client library

The best way to build client libraries is to use build scripts from this repo.

Note: The scripts are written in JavaScript, so you have to install Node.js (v.10 or newer) to run them. Also make sure you have the latest version of Rust installed.

To build a binary for a specific target (or binding), navigate to the relevant folder and run node build.js.

The resulting binaries are placed to bin folder in the gz-compressed format.

Note that the build script generates binaries compatible with the platform used to run the script. For example, if you run it on macOS, you get binaries targeted at Darwin (macOS) platform.

Note: You need latest version of rust. Upgrade it with rustup update command. Check version with rustc --version, it should be above or equal to 1.47.0.

Build artifacts

Rebuild api.json:

cd evercli
cargo run api -o ../tools

Rebuild docs:

cd tools
npm i
tsc
node index docs -o ../docs

Rebuild modules.ts:

cd tools
npm i
tsc
node index binding -l ts -o ../../ever-sdk-js/packages/core/src

Run tests

To run test suite use standard Rust test command

cargo test

SDK tests need EVER OS API endpoint to run on. Such an API is exposed by a DApp Server which runs in real networks and by local blockchain Evernode SE.

Evernode SE is used by default with address http://localhost and port 80. If you launch it on another port you need to specify it explicitly like this: http://localhost:port. If you have Evernode SE running on another address or if you need to run tests on a real Everscale network, use the following environment variables to override the default parameters

TON_USE_SE: true/false - flag defining if tests run against Evernode SE or a real network (DApp Server)
TON_NETWORK_ADDRESS - Dapp server or Evernode SE addresses separated by comma.
TON_GIVER_SECRET - Giver secret key. If not defined, default Evernode SE giver keys are used
TON_GIVER_ADDRESS - Address of the giver to use for prepaying accounts before deploying test contracts. If not defined, the address is calculated using `GiverV2.tvc` and configured public key
EVERCLOUD_AUTH_PROJECT – Evercloud project id used to authorise tests that requires main net interaction 

Download precompiled binaries

Instead of building library yourself, you can download the latest precompiled binaries from EverX SDK Binaries Store.

Platform Major Download links
Win32 0 ever_client.lib, ever_client.dll
1 ever_client.lib, ever_client.dll
macOS 0 libton_client.dylib
1 (x86_64)libton_client.dylib
1 (aarch64)libton_client.dylib
Linux 0 libton_client.so
1 libton_client.so

If you want an older version of library (e.g. 0.25.0 for macOS), you need to choose a link to your platform from the list above

Extension points exported contracts — how you extend this code

EncryptionBox (Interface)
(no doc) [7 implementers]
ever_client/src/crypto/boxes/encryption_box/mod.rs
CellFromBoc (Interface)
(no doc) [2 implementers]
ever_client_processing/src/message_monitor/message.rs
ApiType (Interface)
(no doc) [1 implementers]
api/info/src/lib.rs
DebotInterface (Interface)
(no doc) [7 implementers]
ever_client/src/debot/dinterface.rs
MessageMonitorSdkServices (Interface)
(no doc) [2 implementers]
ever_client_processing/src/sdk_services/mod.rs
ApiModule (Interface)
(no doc)
api/info/src/lib.rs
AsyncHandler (Interface)
(no doc) [5 implementers]
ever_client/src/json_interface/runtime.rs
KeyValueStorage (Interface)
(no doc) [3 implementers]
ever_client/src/client/storage.rs

Core symbols most depended-on inside this repo

clone
called by 1227
ever_client/src/net/endpoint.rs
to_string
called by 350
ever_client/src/json_interface/interop.rs
into
called by 272
ever_client/src/debot/mod.rs
as_str
called by 161
ever_client/src/client/client_env.rs
as_ref
called by 76
ever_client/src/crypto/internal.rs
register_sync_fn
called by 74
ever_client/src/json_interface/registrar.rs
hasClass
called by 67
docs/reference/rust-api/storage.js
remove
called by 49
ever_client/src/client/storage.rs

Shape

Method 1,181
Function 1,050
Class 488
Enum 91
Interface 18

Languages

Rust92%
TypeScript8%
C++1%

Modules by API surface

docs/reference/rust-api/main.js94 symbols
ever_client/src/tests/mod.rs70 symbols
ever_client/src/debot/tests.rs59 symbols
ever_client/src/net/server_link.rs51 symbols
ever_sdk/src/contract.rs49 symbols
ever_client/src/proofs/engine.rs48 symbols
ever_client/src/net/iterators/block.rs46 symbols
ever_client/src/crypto/hdkey.rs43 symbols
ever_client/src/proofs/tests/mod.rs40 symbols
ever_client/src/client/errors.rs40 symbols
ever_client/src/net/ton_gql.rs39 symbols
ever_client/src/crypto/boxes/crypto_box/mod.rs37 symbols

For agents

$ claude mcp add ever-sdk \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact