Skip to content

Instantly share code, notes, and snippets.

@qwadratic
Last active April 13, 2022 13:06
Show Gist options
  • Save qwadratic/cb119d1741dfa62fc90a360132013ece to your computer and use it in GitHub Desktop.
Save qwadratic/cb119d1741dfa62fc90a360132013ece to your computer and use it in GitHub Desktop.
Everscale smart contract development environment setup

Prepare

Install tools

Build Solidity Compiler from sources

https://github.com/tonlabs/TON-Solidity-Compiler

  • checkout commit bbbbeca6e6f22f9a2cd3f30021ca83aac1a1428d
sh ./compiler/scripts/install_deps.sh
mkdir build
cd build
cmake ../compiler/ -DCMAKE_BUILD_TYPE=Release
cmake --build . -- -j8
sh ./compiler/scripts/install_lib_variable.sh
  • After the build succeeded, the binary will become available by the following path: ./TON-Solidity-Compiler/build/solc/solc

  • Build TVM-linker from sources For each version of compiler, the specific version of linker can be used

For 0.57.3 compile the following linker commit is recommended 80e31a5b181542ac4891297b9335a59cabedf029

cd tvm_linker && cargo update && cargo build --release
  • After the build succeeded, the binary will become available by the following path: TVM-linker/tvm_linker/target/release/tvm_linker

  • Run local node in docker (Everscale network emulator)

https://hub.docker.com/r/tonlabs/local-node

docker pull tonlabs/local-node@0.29.1
docker run -d -e USER_AGREEMENT=yes --name local-node -p8085:80 tonlabs/local-node:0.29.1

You can use any port instead of 8085. If you ommit -p8085:80 then the node will run on 80 port by default

npm install -g locklift

locklift installed globally is usually used to generate a new project It's recommended to install locklift as a dependency to a project and use it via npx locklift

Then, setup locklift.config.json in a root of you project:

module.exports = {
    compiler: {
    	// Compiler path
        path: '/usr/bin/solc-ton-tonlabs-bbbbeca',
    },
    linker: {
    	// Linker path
        path: '/usr/bin/tvm_linker-e4dc6c5',
    },
    networks: {
        local: {
            ton_client: {
                network: {
                	// Local node path
                    server_address: 'http://localhost:8085/',
                },
            },
            giver: {
                address: '0:841288ed3b55d9cdafa806807f02a0ae0c169aa5edfe88a789a6482429756a94',
                abi: {
                    "ABI version": 1,
                    "functions": [{"name": "constructor", "inputs": [], "outputs": []}, {
                        "name": "sendGrams",
                        "inputs": [{"name": "dest", "type": "address"}, {"name": "amount", "type": "uint64"}],
                        "outputs": []
                    }],
                    "events": [],
                    "data": []
                },
                key: '',
            },
            keys: {
            	// Generate a phrase via `tonos-cli genphrase` or any other way
                phrase: '',
                amount: 5,
            }
        }
    }
};
  • (optional) Build tonos-cli from sources
sudo apt-get install libssl-dev
sudo apt-get install pkg-config

git clone https://github.com/tonlabs/tonos-cli.git
cd tonos-cli
cargo update
cargo build --release

After the build succeeded, the binary will become available by the following path: tonos-cli/target/release/tonos-cli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment