📖
Dev Documents
  • README
  • Basic Concepts
    • TEA Developer Prerequisites
    • The TEA Economic Revolution for Developers
    • The Future of Layer-2s
    • What Makes a Web3 App?
    • Magic of the State Machine
  • Step by Step Tutorial
    • Install Dev Environment
    • Hello World
      • Step 1: Build sample-actor and Run Unit Test
      • Step 2: Start the Local Dev Environment
      • Sample Actor Code Walkthrough
      • Sample Front-end Code Walkthrough
      • 025_understand_request_and_response
    • Deploy Hello World on Testnet
    • Add Login Feature
      • Sample-actor Code Walkthrough - Login Branch
        • tea_sdk_utils
      • Sample Front-end Walkthrough - Login Branch
    • SQL
      • Sample Txn Executor
      • Sample Actor
      • Sample Front-end
    • Reward Fund Transfer
      • Sample Txn Executor
    • Retweet Task
      • Retweet Frontend
      • Retweet Sample Actor
      • Retweet Txn Executor
      • Retweet FAQ
    • Gas Fees
      • Query logs
      • A deep dive into gas measurement and settlement
    • Summary
  • Billing
    • Billing FAQ
    • Gas Fee Billing
    • Gas & Fuse Limits
    • Local Debugging Environment
    • State Maintainer Billing
    • TApp Billing
  • Example TApps
  • Advanced TApps
    • TEA Party TApp Intro
    • TEA Party Code Walkthrough
  • Functions
    • Actors vs Functions
    • Function Calls Between Native & Wasm
    • Native vs Wasm Functions
  • Glossary
    • Actor
    • Adapter
    • App AES Key
    • AuthKey
    • back_end_actor
    • Birth Control
    • Blockchain Listener
    • Capability
    • CML Auctions
    • Commands
    • Consensus
    • Context
    • Conveyor
    • Conveyor: Mutable vs Immutable
    • enclave
    • Followup
    • Front-end
    • GlueSQL
    • GPS
    • Hosting Actor Handlers
    • Hosting CML
    • hosting_profitability
    • Magic of WASM
    • mini-runtime
    • OrbitDb
    • Order of Txns
    • party-actor
    • party-fe
    • Party-state-actor
    • Providers
    • Public Service
    • queries
    • Remote Attestation
    • Staking to Hosting CML
    • Staking to TApp
    • State
    • State Machine
    • State Machine Actor
    • State Machine Replica
    • TEA ID
    • TPM
    • Transactions
    • VMH - Virtual Messaging Hub
    • Where Messages are Stored
Powered by GitBook
On this page
  • Install prerequisites
  • Install local development environment: Dev-Runner
  • Troubleshooting the Dev Environment
  1. Step by Step Tutorial

Install Dev Environment

PreviousStep by Step TutorialNextHello World

Last updated 2 years ago

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.0

You 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-unknown

  • rustup install nightly

One of the build scripts that are used in the following tutorials might prompt that protoc couldn't be found. You can :

  • On a Mac: brew install protobuf

  • On Ubuntu: apt install -y protobuf-compiler

Install local development environment: Dev-Runner

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 pull your 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-C to stop dev-runner.

  • docker compose down (or docker-compose down) to stop the docker containers.

  • If there are any updates of the dev-runner docker images, use docker pull the_images_of_the_two_:dev_image to 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 up from the dev-runner directory.

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 where a process ensures that all nodes are trustable. In the simplified local runtime, there's only one ("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.

Delete the .tokenstate using rm -rf .tokenstate to 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 . This may cause conflicts if you've updated your code logic.

follow the instructions to install it
state machine
remote attestation
hosting node
state