An attempt to rewrite lite-client for TON Blockchain in Rust using ton-labs-adnl library.

Overview

TON LiteClient

An attempt to rewrite lite-client for TON Blockchain in Rust using ton-labs-adnl library.

Roadmap

  • Implement own ADNL library instead of using Everscale
  • Write documentation for ADNL protocol
  • Implement all functions of the original lite-client

Installation

# workdir = cloned repo folder
cargo install --path .

Usage

Create file config.json with liteserver ip, port and public key:

{  
  "server_address": "65.21.74.140:46427",  
  "server_key": {  
    "type_id": 1209251014,  
    "pub_key": "JhXt7H1dZTgxQTIyGiYV4f9VUARuDxFl/1kVBjLSMB8="  
  }  
}

(that is a testnet server from https://newton-blockchain.github.io/testnet-global.config.json)

Send an external message to TON:

echo 1234 | liteclient send -  # accept message bytes from stdin
liteclient send ./query.boc  # read from file

It prints:

[ERROR] Server error [code=0]: cannot apply external message to current state : failed to parse external message cannot deserialize bag-of-cells: invalid header, error 0

Debug logging

echo 1234 | RUST_LOG=debug liteclient send -

prints:

[2022-03-15T10:43:55Z DEBUG liteclient::private] Sending query:
    Length: 20 (0x14) bytes
    0000:   df 06 8c 79  0c 82 d4 0a  69 05 31 32  33 34 0a 00   ...y....i.1234..
    0010:   00 00 00 00                                          ....
[2022-03-15T10:43:55Z DEBUG liteclient::private] Received:
    Length: 148 (0x94) bytes
    0000:   48 e1 a9 bb  00 00 00 00  8a 63 61 6e  6e 6f 74 20   H........cannot
    0010:   61 70 70 6c  79 20 65 78  74 65 72 6e  61 6c 20 6d   apply external m
    0020:   65 73 73 61  67 65 20 74  6f 20 63 75  72 72 65 6e   essage to curren
    0030:   74 20 73 74  61 74 65 20  3a 20 66 61  69 6c 65 64   t state : failed
    0040:   20 74 6f 20  70 61 72 73  65 20 65 78  74 65 72 6e    to parse extern
    0050:   61 6c 20 6d  65 73 73 61  67 65 20 63  61 6e 6e 6f   al message canno
    0060:   74 20 64 65  73 65 72 69  61 6c 69 7a  65 20 62 61   t deserialize ba
    0070:   67 2d 6f 66  2d 63 65 6c  6c 73 3a 20  69 6e 76 61   g-of-cells: inva
    0080:   6c 69 64 20  68 65 61 64  65 72 2c 20  65 72 72 6f   lid header, erro
    0090:   72 20 30 00                                          r 0.
[ERROR] Server error [code=0]: cannot apply external message to current state : failed to parse external message cannot deserialize bag-of-cells: invalid header, error 0
You might also like...
Advanced Fuzzing Library - Slot your Fuzzer together in Rust! Scales across cores and machines. For Windows, Android, MacOS, Linux, no_std, ...
Advanced Fuzzing Library - Slot your Fuzzer together in Rust! Scales across cores and machines. For Windows, Android, MacOS, Linux, no_std, ...

LibAFL, the fuzzer library. Advanced Fuzzing Library - Slot your own fuzzers together and extend their features using Rust. LibAFL is written and main

QuickCheck bug hunting in Rust standard library data structures

BugHunt, Rust This project is aiming to provide "stateful" QuickCheck models for Rust's standard library. That is, we build up a random list of operat

Mundane is a Rust cryptography library backed by BoringSSL that is difficult to misuse, ergonomic, and performant (in that order).

Mundane Mundane is a Rust cryptography library backed by BoringSSL that is difficult to misuse, ergonomic, and performant (in that order). Issues and

A simple rust library for working with ZIP archives

rust-zip A simple rust library to read and write Zip archives, which is also my pet project for learning Rust. At the moment you can list the files in

A new shellcode injection technique. Given as C++ header, standalone Rust program or library.
A new shellcode injection technique. Given as C++ header, standalone Rust program or library.

FunctionStomping Description This is a brand-new technique for shellcode injection to evade AVs and EDRs. This technique is inspired by Module Stompin

Extended precision integer Rust library. Provides signed/unsigned integer 256 to 2048.

Extended precision integer Rust library. Provides signed/unsigned integer 256 to 2048.

Linux anti-debugging and anti-analysis rust library
Linux anti-debugging and anti-analysis rust library

DebugOff Library Linux anti-analysis Rust library The goal of this library is to make both static and dynamic (debugging) analysis more difficult. The

An R interface to Rust's h3o library
An R interface to Rust's h3o library

h3o h3o is a system-dependency free package to interact with the H3 Geospatial Indexing system by Uber. h3o utilizes the Rust library h3o with is a pu

A rust library for sharing and updating arbitrary slices between threads, optimized for wait-free reads

atomicslice A Rust library for thread-safe shared slices that are just about as fast as possible to read while also being writable. Overview Use Atomi

Owner
TonStack
Independent TON developers community focused on making things better
TonStack
A rewrite of my first Password generator in rust.

PGen-Rust Getting Started You can get the latest version of PGen from the github actions artifacts or from one of these links: linux, windows, macos U

Racci 4 Jun 1, 2022
The Mullvad VPN client app for desktop and mobile

Mullvad VPN desktop and mobile app Welcome to the Mullvad VPN client app. This repository contains all the source code for the desktop and mobile vers

Mullvad VPN 3.1k Jan 8, 2023
A simple port scanner built using rust-lang

A simple port scanner built using rust-lang

Krisna Pranav 1 Nov 6, 2021
Linux LPE using polkit-1 written in Rust.

CVE-2021-4024-Rust Linux LPE using polkit-1 written in Rust. Build instructions Install rust if you haven't already git clone https://github.com/deoxy

Kevin Pham 1 Feb 3, 2022
Attempts to suspend all known AV/EDRs processes on Windows using syscalls and the undocumented NtSuspendProcess API. Made with <3 for pentesters. Written in Rust.

Ronflex Attempts to suspend all known AV/EDRs processes on Windows using syscalls and the undocumented NtSuspendProcess API. Made with <3 for penteste

null 5 Apr 17, 2023
Cyg will help you to secure files in your repository directly using PGP encryption

cyg: Secure files in your repository Cyg will help you to secure files in your repository directly using PGP encryption. The name "cyg" was inspired b

Hisam Fahri 2 Aug 31, 2022
Using fibers to run in-memory code in a different and stealthy way.

Description A fiber is a unit of execution that must be manually scheduled by the application rather than rely on the priority-based scheduling mechan

Kurosh Dabbagh Escalante 121 Apr 20, 2023
CVEs for the Rust standard library

Rust CVE Preface This is a list of CVEs for unsound APIs in the Rust standard library. These bugs break Rust's memory safety guarantee and lead to sec

Yechan Bae 26 Dec 4, 2022
Rust library for building and running BPF/eBPF modules

RedBPF A Rust eBPF toolchain. Overview The redbpf project is a collection of tools and libraries to build eBPF programs using Rust. It includes: redbp

foniod 1.5k Jan 1, 2023
Rust library for developing safe canisters.

IC Kit This library provides an alternative to ic-cdk that can help developers write canisters and unit test them in their Rust code. Install Add this

Psychedelic 26 Nov 28, 2022