- Linux or Mac OS:
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- When shown choose the default settings
- require git, curl and build-essential:
# apt install git curl build-essential
- Windows: see the rust official site
-
The Trinci Node and Rust SDK source code can be found on github: Affidaty Blockchain
-
In order to build trinci we need to install the following dependencies:
clang libclang-dev protobuf-compiler
-
We can download the trinci node repository and then build the node:
$ git clone https://github.com/affidaty-blockchain/trinci-node.git
-
Then we can build the executables.
To download the needed Rust crates from crates.io
$ cargo check
To build the executables:
$ cargo build
To run an executable:
$ cargo run --bin <bin-executable> -- <arguments>
- Example:
This command launch a node as validator in the
cargo run --bin trinci-node -- --validator --network skynet
skynet
network.
- Example:
- The Trinci Smart Contract Development Environment can be found on github: Trinci SmartContracts
$ git clone https://github.com/affidaty-blockchain/trinci-smartcontracts.git
- This crate depends on the trinci-sdk crate.
- The Trinci Rust SDK documentation can be found here.
- Use the script
create_new_contract.sh
in the directory /app-rs/:then insert the new contract name. A project with the name provided will be created.$ ./create_new_contract.sh
- Note requires the
cargo generate
crate.
- Note requires the
$ ./cargo_broadcast.sh <COMMAND>
Example used to test all the contracts:
$ ./cargo_broadcast.sh test
$ ./build_wasm.sh
- Note: require
rust
with targetwasm32-unknown-unknown
$ ./build_wasm_docker.sh
- Note: requires
docker
- The
registry
directory contains the .wasm contracts
- The
integration
directory is a rust module that provide an enviroment for testing
- There are two ways to register a smart contract in Trinci Blockchain
- Through a transaction to the
Service account
with arguments:args: { "name": string, // contract name "version": string, // contract version "description": string, // contract description "url": string, // contract web site "bin": binary, // contract binary }
- With the Trinci CLI:
$ trinci-cli --host <trinci_host> \ --port 80 <trinci_port> \ --path <trinci_path>/api/v1 \ --network <trinci_network>
- Enter in the
cheats
section:
Enter 'help' to show available commands > cheats
- Launch the
register
command:
>>> register
- Fill with the needed information:
Service account: Qm...xyz # the service account Service contract (optional multihash hex string): # just press `enter` New contract name: My Cool Contract # the contract name New contract version: 0.2.1 # contract version New contract description: This is my cool contract New contract url: www.cool-contract.org New contract filename: /home/contracts/my_cool_contract.wasm # contract file in our filesystem
- Enter in the
- Through a transaction to the
- In this section will are going to build a smart contract from zero