Install Dev Environment
Install prerequisites
To install the dev environment in your local machine, you'll need some prerequisite software already installed:
Git
Docker: install docker and "docker compose". Note that we've only tested using the current version of Docker (20.10.23) and we suggest keeping your Docker updated to the latest version.
Rust
Node.js
Note that you'll need to use node version 14.14.0 for this tutorial. Make sure you have nvm 14.14.0 installed and set as default:
nvm install 14.14.0
nvm use 14.14.0You can check which version of node is active using nvm current.
If you haven't installed wasm32-unknown-unknown target or the nightly version, you might be prompted to rustup and install them according to the instructions.
rustup target add wasm32-unknown-unknownrustup install nightly
One of the build scripts that are used in the following tutorials might prompt that protoc couldn't be found. You can follow the instructions to install it:
On a Mac:
brew install protobufOn Ubuntu:
apt install -y protobuf-compiler
Install local development environment: Dev-Runner
The purpose of the dev-runner repo is to allow any user to recreate the TEA runtime on their local machine. The TEA Project is a decentralized system that needs multiple nodes for both its hosting infrastructure and state machine where a remote attestation process ensures that all nodes are trustable. In the simplified local runtime, there's only one hosting node ("B-node") and one state machine node ("A-node"). And there's no remote attestation since this is a simulated environment with a single node on each level.
To install dev-runner to your local environment, use the following command:
git clone https://github.com/tearust/dev-runner.git
After you've dowloaded the dev-runner to your local computer, note that other repos will possibly interact with your local dev-runner environment as a sibling folder. For example, tutorial-v1 will write a wasm file to dev-runner during the build process for that tutorial.
Troubleshooting the Dev Environment
The most common cause of errors during the following tutorials generally either arise from an improperly configured local environment or from not having the most up to date repo.
Misconfigured local environments can be fixed by following the error messages requesting missing packages. The prerequisites at the top of this document should be sufficient but everyone's local development environment will be unique.
git pullyour current tutorial's repo to make sure you have the latest files.
If you either change your local software environment or update your local repos, you'll need to stop any existing TEA runtime docker images. These are the steps for refreshing the dev-runner repo and associated docker images:
Press
CTRL-Cto stop dev-runner.docker compose down(ordocker-compose down) to stop the docker containers.Delete the
.tokenstateusingrm -rf .tokenstateto clear the stored state. This directory contains the local state's persistent storage in local dev mode. If you don't delete it, the next time you start the dev-runner will continue from the last saved state . This may cause conflicts if you've updated your code logic.If there are any updates of the dev-runner docker images, use
docker pull the_images_of_the_two_:dev_imageto update the existing older images if there's an updated image available:
docker pull tearust/parent-instance-client:dev
docker pull tearust/runtime:devAfter you've built the tutorials using your latest updates you'd run
docker-compose upfrom thedev-runnerdirectory.
Last updated