Install Dev Environment
To install the dev environment in your local machine, you'll need some prerequisite software already installed:
- 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.
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.0
You can check which version of node is active using
If you haven't installed wasm32-unknown-unknown target or the nightly version, you might be prompted to
rustupand install them according to the instructions.
rustup target add wasm32-unknown-unknown
rustup install nightly
One of the build scripts that are used in the following tutorials might prompt that
protoccouldn't be found. You can follow the instructions to install it:
- On a Mac:
brew install protobuf
- On Ubuntu:
apt install -y protobuf-compiler
The purpose of the
dev-runnerrepo 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.
dev-runnerto your local environment, use the following command:
git clone https://github.com/tearust/dev-runner.git
After you've dowloaded the
dev-runnerto your local computer, note that other repos will possibly interact with your local dev-runner environment as a sibling folder. For example,
tutorial-v1will write a wasm file to
dev-runnerduring the build process for that tutorial.
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-runnerrepo and associated docker images:
CTRL-Cto stop dev-runner.
docker compose down(or
docker-compose down) to stop the docker containers.
- Delete the
rm -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:dev
- After you've built the tutorials using your latest updates you'd run
docker-compose upfrom the