Local blockchain for Free TON DApp development and testing.

Overview

TON OS Startup Edition

Local blockchain for Free TON DApp development and testing.

Have a question? Get quick help in our channel:

Channel on Telegram

What is TON OS Startup Edition?

TON OS Startup Edition (SE) is a local blockchain that developer can run on their machine in one click.

At the moment we publish TON OS SE only as a docker image. We plan to provide simple installers for MacOS, Win, Linux without docker by the end of Q1 2021.

See the TON Labs TON OS SE documentation for detailed information.

Use-cases

  • Test your applications locally
  • Test your contracts
  • Run TON OS remotely on a server and test your application from different devices

How to install

Pre-requisites

Attention! Docker daemon must be running.

Instal via TONDEV Development Environment

If you have TONDEV installed globally on your machine, run this command

$ tondev se start

Checkout other TON OS SE commands accessible from TONDEV. You can also access these commands from TONDEV VS Code Extension.

Install via docker command

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.

How to connect to TON OS SE Graphql API from SDK

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 localhost in SDK Client network config.

TON OS SE components:

How to build docker image locally

In order to build and use TON OS Startup Edition you need Docker. To build docker image, run from the repository root:

Linux/Mac:

./build.sh

Windows:

build.cmd
Comments
  • Contract deletion after flag: 128 + 32 takes too long time

    Contract deletion after flag: 128 + 32 takes too long time

    It takes 160+ seconds when using locklift for testing. Also removed contract is not accessible from explorer

    Previous behavior:

    Takes 2-3 seconds and accessible from explorer

    inprogress 
    opened by FairyFromAlfeya 9
  • [Windows] Subscribe for transactions with addresses (ABIv1) test failed

    [Windows] Subscribe for transactions with addresses (ABIv1) test failed

    Steps to reproduce:

    • Build and Run Node SE from https://github.com/tonlabs/tonos-se/tree/master/ton-node-se
    • Run tests from https://github.com/tonlabs/ton-client-js#run-tests

    Result:

    PS>$env:USE_NODE_SE="true";$env:TON_NETWORK_ADDRESS="http://localhost:8080";node run
    1.11.0
    ✓ Test versions compatibility (1 / 0)
    ✓ crypto (2 / 0)
    ✓ encode_message (3 / 0)
    ✓ net (4 / 0)
    ✓ Block signatures (5 / 0)
    ✓ All Accounts (6 / 0)
    ✓ Ranges (7 / 0)
    ✓ Wait For (8 / 0)
    𐄂 Subscribe for transactions with addresses (ABIv1) (8 / 1) - [
        {
            "matcherResult": {
                "pass": false
            },
            "message": "\u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoBeGreaterThan\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m)\u001b[22m\n\nExpected: > \u001b[32m0\u001b[39m\nReceived:   \u001b[31m0\u001b[39m"
        }
    ]
    ✓ Subscribe for transactions with addresses (ABIv2) (9 / 1)
    ✓ Subscribe for messages (ABI v1) (10 / 1)
    ✓ Subscribe for messages (ABI v2) (11 / 1)
    ✓ Transactions with addresses (12 / 1)
    ✓ Check shard_hashes greater then 0 (13 / 1)
    ---
    success: 13
    failure: 1
    

    PS: I've open PR with a workaround for tests https://github.com/tonlabs/ton-client-js/pull/206

    opened by ch1seL 4
  • Unobvious operation of these states when updating a smart contract.

    Unobvious operation of these states when updating a smart contract.

    There are two of the easiest smart contracts firstContract and secondContract. Deploy 'firstContract' smart contract and calling external method contract "setValue", set value a,b=12. Data state contract: m_value = 24, version = 1. Calling 'updateContractCode' and set code from 'secondContract'. After update smart contract check values version=2 but m_value=0. Waiting that m_value=24,, because tvm.resetStorage don't calling. This is inappropriate behavior on upgraded data states to default value.

    firstContract code: `pragma ton-solidity >= 0.57.0;

    pragma AbiHeader time; pragma AbiHeader expire; pragma AbiHeader pubkey;

    contract firstContract {

    uint32 nonce_;
    uint public m_version = 1;
    uint public m_value;
    
    address owner;
    
    constructor(address owner_ ) public {
    	tvm.accept();
    	owner = owner_;
    }
    
    modifier checkOwnerAndAccept {
    	require(msg.sender == owner, 120);
    	tvm.accept();
    	_;
    }
    
    function setValue(uint a, uint b) external {
    	tvm.rawReserve(1 ton, 0);
    	m_value = a + b; 
    }
    
    function getOwner() external view responsible returns (address) {
    	return {value: 0, flag: 64, bounce: false} owner;
    
    }
    
    function updateContractCode(TvmCell newcode) public view checkOwnerAndAccept {
    	tvm.setcode(newcode);
    	tvm.setCurrentCode(newcode);
    	
    	TvmCell stateVars = abi.encode(m_version);
        onCodeUpgrade(stateVars);
    }
    
    function onCodeUpgrade(TvmCell stateVars) private pure {}
    

    }`

    secondContract code: `pragma ton-solidity >= 0.57.0;

    pragma AbiHeader time; pragma AbiHeader expire; pragma AbiHeader pubkey;

    contract secondContract {

    uint32 nonce_;
    uint public m_version; 
    uint public m_value;
    
    address owner;
    
    modifier checkOwnerAndAccept {
    	require(msg.sender == owner, 110);
    	tvm.accept();
    	_;
    }
    
    function setValue(uint a, uint b) external {
    	tvm.rawReserve(1 ton, 0);
    	m_value = a + b; 
    }
    
    function getOwner() external view responsible returns (address) {
    	return {value: 0, flag: 64, bounce: false} owner;
    
    }
    
    function updateContractCode(TvmCell newcode) public checkOwnerAndAccept {
    	tvm.setcode(newcode);
    	tvm.setCurrentCode(newcode);
    	TvmCell stateVars = abi.encode(m_version);
    
    	onCodeUpgrade(stateVars);
    }
    
    function onCodeUpgrade(TvmCell stateVars) private {
    	(uint version) = abi.decode(stateVars, (uint));
    	m_version = version + 1;
    }
    

    }`

    bug 
    opened by markgenuine 3
  • The results of calling `selfdestruct` function in EvernodeSE and Devnet differ.

    The results of calling `selfdestruct` function in EvernodeSE and Devnet differ.

    Problem

    We need to destruct the contact and transfer its tokens to some destination account.

    Version

    tonlabs/local-node:0.35.0

    Expected behaviour

    • Desctructed contract has zero balance and "non exists" type.
    • Account destination has positive balance

    Resulting behaviour

    • in Devnet
      • as expected
    • in Evernode SE
      • Desctructed contract is not destructed, its balance unchanged, but transfer to destination account exists!
      • Account destination has positive balance!

    How to reproduce a bug

    To reproduce this bug clone https://github.com/Artem-Zhdanov/evernode-se-selfdestruct-bug

    everdev se start
    

    Intall dependencies and run

    npm i
    node selfdestruct.js
    

    Open http://localhost and finds accounts in the output

    inprogress 
    opened by Artem-Zhdanov 2
  • Build failed. aes-ctr crate is DEPRECATED

    Build failed. aes-ctr crate is DEPRECATED

    root@13485a15bdb7:/tonos-se/ton-node-se# cargo build --release Updating crates.io index Updating git repository https://github.com/tonlabs/ton-labs-block.git Updating git repository https://github.com/tonlabs/ton-labs-block-json.git Updating git repository https://github.com/tonlabs/ton-labs-executor.git Updating git repository https://github.com/tonlabs/ton-labs-types.git Updating git repository https://github.com/tonlabs/ton-labs-vm.git Updating git repository https://github.com/tonlabs/ton-labs-tl.git Updating git repository https://github.com/tonlabs/ton-labs-assembler.git Updating git repository https://github.com/paritytech/rust-secp256k1 Updating git repository https://github.com/tonlabs/TON-SDK.git Updating git repository https://github.com/tonlabs/lockfree.git error: failed to select a version for the requirement stream-cipher = "^0.3" candidate versions found which didn't match: 0.99.99, 0.7.1, 0.6.0, ... location searched: crates.io index required by package aes-ctr v0.3.0 ... which is depended on by adnl v0.0.4 (/tonos-se/ton-node-se/adnl) ... which is depended on by ton_node_startup v0.28.4 (/tonos-se/ton-node-se/ton_node_startup)

    opened by ch1seL 2
  • Unable to start se

    Unable to start se

    I tried to start SE with the command tondev se start but it didn't work: tondev se info shows that the default instance has state "exited". Also I tried docker run -e USER_AGREEMENT=yes -p80:80 tonlabs/local-node and the container exited with the following output:

    16:08:57 system | node_workers.1 started (pid=14) 16:08:57 node_workers.1 | + set -e 16:08:57 node_workers.1 | + cd /ton-node 16:08:57 node_workers.1 | + exec /node/ton-node --config ./ton-node.conf.json --blockchain-config ./blockchain.conf.json 16:08:57 system | arango.1 started (pid=12) 16:08:57 arango.1 | + set -e 16:08:57 arango.1 | + ARANGO_INIT_PORT=8529 16:08:57 arango.1 | + ARANGO_ENDPOINT=tcp://127.0.0.1:8529 16:08:57 arango.1 | + ARANGO_INIT_PIDFILE=/run/arango-init.pid 16:08:57 arango.1 | + export GLIBCXX_FORCE_NEW=1 16:08:57 arango.1 | + GLIBCXX_FORCE_NEW=1 16:08:57 arango.1 | + NUMACTL= 16:08:57 arango.1 | + '[' -d /sys/devices/system/node/node1 -a -f /proc/self/numa_maps ']' 16:08:57 arango.1 | + arangod --config /arango/config --server.endpoint tcp://127.0.0.1:8529 --server.authentication=false --log.foreground-tty true --database.auto-upgrade true 16:08:57 system | nginx.1 started (pid=13) 16:08:57 system | q_server.1 started (pid=11) 16:08:57 q_server.1 | + set -e 16:08:57 q_server.1 | + export 'Q_DATA_MUT=http://127.0.0.1:8529' 16:08:57 q_server.1 | + export 'Q_DATA_HOT=http://127.0.0.1:8529' 16:08:57 q_server.1 | + export 'Q_SLOW_QUERIES_MUT=http://127.0.0.1:8529' 16:08:57 q_server.1 | + export 'Q_SLOW_QUERIES_HOT=http://127.0.0.1:8529' 16:08:57 q_server.1 | + export 'Q_REQUESTS_MODE=rest' 16:08:57 q_server.1 | + export 'Q_REQUESTS_SERVER=http://127.0.0.1' 16:08:57 q_server.1 | + export 'Q_HOST=127.0.0.1' 16:08:57 q_server.1 | + export 'Q_PORT=4000' 16:08:57 q_server.1 | + cd /home/node/ton-q-server 16:08:57 q_server.1 | + exec node index.js 16:08:57 arango.1 | /arango/entrypoint: line 34: 20 Illegal instruction (core dumped) $NUMACTL arangod --config /arango/config --server.endpoint $ARANGO_ENDPOINT --server.authentication=false --log.foreground-tty true --database.auto-upgrade true 16:08:57 arango.1 | + exit 1 16:08:57 system | arango.1 stopped (rc=1) 16:08:57 system | sending SIGTERM to q_server.1 (pid 11) 16:08:57 system | sending SIGTERM to nginx.1 (pid 13) 16:08:57 system | sending SIGTERM to node_workers.1 (pid 14) 16:08:57 system | node_workers.1 stopped (rc=-15) 16:08:57 system | q_server.1 stopped (rc=-15) 16:08:57 system | nginx.1 stopped (rc=0)

    opened by medved239 1
  •  What's nginx for here?

    What's nginx for here?

    What's nginx for here?

    It is used for routing requests for Node SE or Q-Server, according to the path. You can inspect its configuration for deeper investigation: https://github.com/tonlabs/tonos-se/blob/master/docker/nginx.conf.d

    What route them for?

    question 
    opened by GildedHonour 1
  • Why honcho in particular?

    Why honcho in particular?

    1. Why is honcho in particular used here?

    2. What's the neccessity? Why not run all of them without honcho, as ordinary processes? Is it specific to the fact that it's all done in Docker?

    question 
    opened by GildedHonour 1
  • fix: docker build fixes for aarch platform

    fix: docker build fixes for aarch platform

    Based on:

    Set the image's platform explicit https://stackoverflow.com/questions/65612411/forcing-docker-to-use-linux-amd64-platform-by-default-on-macos

    Fix docker memory leak during cargo build https://github.com/rust-lang/cargo/issues/10583

    Use stable alpine version to prevent segmentation fault during cargo build https://github.com/mxe/mxe/issues/2621

    opened by FairyFromAlfeya 0
  • Broken GiverV2.sol & GiverV3.sol

    Broken GiverV2.sol & GiverV3.sol

    Issue lines:

    https://github.com/tonlabs/evernode-se/blob/master/contracts/giver_v2/GiverV2.sol#L57 https://github.com/tonlabs/evernode-se/blob/master/contracts/giver_v3/GiverV3.sol#L58

    Description:

    Giver contract passes compilation, but any sendTransaction call will be reverted with code 9 (Cell underflow) on mainnet

    Proposal:

    Replace all expireAt entries with uint32 instead of uint64 GiverV3.sol.zip

    opened by FairyFromAlfeya 2
Releases(0.36.2)
Owner
TON Labs
TON Labs is focused on developing the core infrastructure and an Open Source ecosystem for the Free TON
TON Labs
Marvin-Blockchain-Rust: A Rust-based blockchain implementation, part of the Marvin blockchain project.

Marvin Blockchain - Rust Implementation Welcome to the Rust implementation of the Marvin Blockchain. This project is part of a comparative study on bu

João Henrique Machado Silva 3 Sep 6, 2024
All the data an IC app needs to make seamless experiences, accessible directly on the IC. DAB is an open internet service for NFT, Token, Canister, and Dapp registries.

DAB ?? Overview An Internet Computer open internet service for data. All the data an IC app needs to make a seamless experience, accessible directly o

Psychedelic 58 Oct 6, 2022
An Ethereum 2.0 Emulator for Local Testing of Eth2 Applications

Mousse is an Ethereum 2.0 emulator for local testing of Eth2 applications (mainly Rollups). HTTP Server The REST API definition can be found in the ht

Mousse 46 Sep 10, 2022
Unified directories for different use cases of an application, providing standard directories for local development, when run as service or when run by a user.

UniDirs Unified directories for different use cases of an application, providing standard directories for local development, when run as service or wh

Dominik Nakamura 3 Sep 30, 2022
HyperCube is a free and open source blockchain project for everyone to use.

XPZ Public Chain HyperCube is a free and open source blockchain project for everyone to use. 日本語 简体中文 正體中文 HyperCube Wiki Wha is HyperCube HyperCube i

null 949 Dec 31, 2022
As part of the IOP Stack™ Morpheus is a toolset to have gatekeeper-free identity management and verifiable claims as a 2nd layer on top of a blockchain

Internet of People Internet of People (IoP) is a software project creating a decentralized software stack that provides the building blocks and tools

We are building a complete decentralized ecosystem with the IOP Stack™ 9 Nov 4, 2022
A secure development tool box and fintech application made with Rust to be used for developing cryptocurrencies on the blockchain.

Crypto Fintech Tools for Rust (CFT) Dependencies Rust MacOS Homebrew # xcode cli tools xcode-select --install # install dependencies using Homebrew b

Phil Hills 1 Apr 15, 2022
Testing a smart contract on the Solana blockchain

Environment Setup Install Rust from https://rustup.rs/ Install Solana from https://docs.solana.com/cli/install-solana-cli-tools#use-solanas-install-to

Maurice 1 Oct 25, 2021
A specialized blockchain for testing use cases with the FRAME NFTs Pallet.

Substrate NFTs Node The Substrate NFTs node is a specialized blockchain for testing use cases with the FRAME NFTs Pallet. ?? The purpose of this node

Sacha Lansky 4 May 25, 2023
This is the Repo used to learn blockchain development in conjusction with the CyberGen NFT Project.

Environment Setup Install Rust from https://rustup.rs/ Install Solana from https://docs.solana.com/cli/install-solana-cli-tools#use-solanas-install-to

null 1 Nov 3, 2021
🔗 Tool for rebasing a chain of local git branches.

git-chain Tool for rebasing a chain of local git branches. Motivation Suppose you have branches, each depending on a parent branch (usually called "st

Alberto Leal 10 Jul 15, 2022
Figures out the local timezone as IANA / Olson identifier

localzone Utility crate to figure out the IANA (Olson) timezone of the current machine. The IANA timezones have been largely established as the standa

Armin Ronacher 11 Jan 4, 2022
Sothis is a tool for replaying historical state on a local testnet node.

sothis Sothis is a tool for replaying historical state on a local anvil/hardhat testnet node. Usage Sothis currently has 2 modes. Live and historic. I

null 22 Jun 15, 2023
Fiddi is a command line tool that does the boring and complex process of checking and processing/watching transactions on EVM compatible Blockchain.

Fiddi is a command line tool that does the boring and complex process of checking and processing/watching transactions on EVM compatible Blockchain.

Ahmad Abdullahi Adamu 7 Jan 9, 2023
Selendra is a multichains interoperable nominated Proof-of-Stake network for developing and running Substrate-based and EVM compatible blockchain applications.

Selendra An interoperable nominated Proof-of-Stake network for developing and running Substrate-based and EVM compatible blockchain applications. Read

Selendra 16 Nov 29, 2022
Automated security testing for open source libraries and applications.

autovet continuously searches for security breaches in open source libraries and applications. Recently processed packages package version channel las

null 5 Aug 23, 2022
Parser and test runner for testing compatable common Ethereum full node tests against Polygon Zero's EVM.

EVM Test Parses and runs compatible common Ethereum tests from ethereum/tests against Polygon Zero's EVM. Note: This repo is currently very early in d

Mir Protocol 3 Nov 4, 2022
The Nervos CKB is a public permissionless blockchain, and the layer 1 of Nervos network.

Nervos CKB - The Common Knowledge Base master develop About CKB CKB is the layer 1 of Nervos Network, a public/permissionless blockchain. CKB uses Pro

Nervos Network 1k Dec 30, 2022