diff --git a/README.md b/README.md new file mode 100644 index 0000000..1b5a5c1 --- /dev/null +++ b/README.md @@ -0,0 +1,79 @@ +# Torus Network Node + +Torus is a self-assembling and evolving peer-to-peer blockchain organism, with a +stake-driven network built in Rust with the Substrate framework. Torus powers an +innovative ecosystem of agents and incentives, incorporating diverse +technologies into its collective body. + +## Quick start + +TODO + +## Building from source + +### Dependencies + +The recommended way to install dependencies is [using Nix](docs/nix.md). + +If you don't want to use Nix, you should have the following dependencies: + +- [Rust](https://www.rust-lang.org/) +- [protoc](https://github.com/protocolbuffers/protobuf) + +You can install Rust using [Rustup]: + +```sh +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +``` + +Then install `protoc`: + +```sh +# on Ubuntu +sudo apt install protobuf-compiler +``` + + + +[Rustup]: https://rustup.rs/ + +## Building and running the node + +```sh +cargo build -p torus-node --release +``` + +To run a node connected to the Torus testnet: + +```sh +cargo run --bin torus-node --release -- --chain data/testnet/spec.json +``` + +## Docker + +TODO + +## Development + +Check your code with: + +```sh +cargo clippy +``` + +Run all tests with: + +```sh +cargo test +``` + +Running a local dev node: + +```sh +cargo xtask run local --alice +``` diff --git a/docs/nix.md b/docs/nix.md new file mode 100644 index 0000000..b8d6a56 --- /dev/null +++ b/docs/nix.md @@ -0,0 +1,46 @@ +# Build and development with Nix + +The recommended way to install dependencies on the Torus Node project is using +[Nix] and [direnv]. + +You can install Nix with the [Determinate Nix Installer]: + +```sh +curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install +``` + +## With direnv + +You can then install and use [direnv] to automatically load the environment: + +- Install direnv: + + ```sh + nix profile install nixpkgs#direnv + ``` + +- Add to your `~/.zshrc` and reload your shell if you're using zsh: + + ```sh + eval "$(direnv hook zsh)" + ``` + +- For bash, add to your `~/.bashrc`: + + ```sh + eval "$(direnv hook bash)" + ``` + +- Run `direnv allow` inside the project directory to enable it. + +### Without direnv + +You can also manually load the environment: + +```sh +nix develop +``` + +[Nix]: https://nixos.org/ +[direnv]: https://direnv.net/ +[Determinate Nix Installer]: https://github.com/DeterminateSystems/nix-installer