README.md 3.28 KiB
Newer Older
# Trappist
Steve Degosserie's avatar
Steve Degosserie committed

Trappist is a versatile Proof-of-Authority (PoA) Blockchain network that supports hosting decentralized applications (dApps), including Smart Contracts, Crypto-tokens & Non-Fungible
Tokens (NFTs).
Steve Degosserie's avatar
Steve Degosserie committed

This repository contains the source code of the Trappist Blockchain node & runtime, based on
[Substrate](https://www.substrate.dev/), an open-source framework for building tailored Blockchain solutions.
Steve Degosserie's avatar
Steve Degosserie committed

## Getting Started

Follow the steps below to get started.
Steve Degosserie's avatar
Steve Degosserie committed

### Using Nix

Install [nix](https://nixos.org/) and optionally [direnv](https://github.com/direnv/direnv) and [lorri](https://github.com/target/lorri) for a fully plug
and play experience for setting up the development environment. To get all the correct dependencies activate direnv `direnv allow` and lorri `lorri shell`.

### Rust Setup

First, complete the [basic Rust setup instructions](./docs/rust-setup.md).

### Run

Use Rust's native `cargo` command to build and launch the Trappist node:
Steve Degosserie's avatar
Steve Degosserie committed

```sh
cargo run --release -- --dev --tmp
```

### Build

The `cargo run` command will perform an initial build. Use the following command to build the node
without launching it:

```sh
cargo build --release
```

### Embedded Docs

Once the project has been built, the following command can be used to explore all parameters and
subcommands:

```sh
./target/release/trappist -h
Steve Degosserie's avatar
Steve Degosserie committed
```

## Run

The provided `cargo run` command will launch a temporary node and its state will be discarded after
you terminate the process. After the project has been built, there are other ways to launch the
node.

### Single-Node Development Chain

This command will start the single-node development chain with persistent state:

```bash
./target/release/trappist --dev
Steve Degosserie's avatar
Steve Degosserie committed
```

Purge the development chain's state:

```bash
./target/release/trappist purge-chain --dev
Steve Degosserie's avatar
Steve Degosserie committed
```

Start the development chain with detailed logging:

```bash
RUST_LOG=debug RUST_BACKTRACE=1 ./target/release/trappist -lruntime=debug --dev
Steve Degosserie's avatar
Steve Degosserie committed
```

### Connect with Polkadot-JS Apps Front-end

Once the node template is running locally, you can connect it with **Polkadot-JS Apps** front-end
to interact with your chain. [Click here](https://polkadot.js.org/apps/#/explorer?rpc=ws://localhost:9944) connecting the Apps to your local Trappist node.
Steve Degosserie's avatar
Steve Degosserie committed

### Multi-Node Local Testnet

If you want to see the multi-node consensus algorithm in action, refer to
[our Start a Private Network tutorial](https://substrate.dev/docs/en/tutorials/start-a-private-network/).

### Run in Docker

First, install [Docker](https://docs.docker.com/get-docker/) and
[Docker Compose](https://docs.docker.com/compose/install/).

Then run the following command to start a single node development chain.

```bash
./scripts/docker_run.sh
```

This command will firstly compile your code, and then start a local development network. You can
also replace the default command (`cargo build --release && ./target/release/trappist --dev --ws-external`)
Steve Degosserie's avatar
Steve Degosserie committed
by appending your own. A few useful ones are as follow.

```bash
# Run Substrate node without re-compiling
./scripts/docker_run.sh ./target/release/trappist --dev --ws-external
Steve Degosserie's avatar
Steve Degosserie committed

# Purge the local dev chain
./scripts/docker_run.sh ./target/release/trappist purge-chain --dev
Steve Degosserie's avatar
Steve Degosserie committed

# Check whether the code is compilable
./scripts/docker_run.sh cargo check
```

## License

Trappist is licensed under [Apache 2](LICENSE).