• Stars
    star
    177
  • Rank 215,985 (Top 5 %)
  • Language
    Dockerfile
  • License
    MIT License
  • Created over 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

One-click local Terra testnet and ecosystem for rapid prototyping

 

An instant, zero-config Terra blockchain and ecosystem.


What is LocalTerra?

LocalTerra is a complete Terra testnet and ecosystem containerized with Docker and orchestrated with a simple docker-compose file. It simplifies the way smart-contract developers test their contracts in a sandbox before they deploy them on a testnet or mainnet.

LocalTerra comes preconfigured with opinionated, sensible defaults for standard testing environments. If other projects mention testing on LocalTerra, they are referring to the settings defined in this repo.

LocalTerra has the following advantages over a public testnet:

  • Easily modifiable world states
  • Quick to reset for rapid iterations
  • Simple simulations of different scenarios
  • Controllable validator behavior

Prerequisites

Install LocalTerra

  1. Run the following commands::
$ git clone --depth 1 https://www.github.com/terra-money/LocalTerra
$ cd LocalTerra
  1. Make sure your Docker daemon is running in the background and docker-compose is installed.

Start, stop, and reset LocalTerra

  • Start LocalTerra:
$ docker-compose up

Your environment now contains:

Note: to run localterra with FCD use the docker-compose file from

Stop LocalTerra:

$ docker-compose stop

Reset the world state:

$ docker-compose rm

Integrations

You can integrate LocalTerra in Terra Station, terrad, and the Terra JavaScript and Python SDKs.

Terra Station

Terra Station has built-in support for LocalTerra so that you can quickly and easily interact with it. Open Station, and switch to the Localterra network, as shown in the following image

station_localterra

terrad

Important: 'terracli' has been deprecated, and all of its functionalities are merged into 'terrad'.

  1. Ensure the same version of terrad and LocalTerra are installed.

  2. Use terrad to talk to your LocalTerra terrad node:

$ terrad status

This command automatically works because terrad connects to localhost:26657 by default.

The following command is the explicit form:

$ terrad status --node=tcp://localhost:26657
  1. Run any of the terrad commands against your LocalTerra network, as shown in the following example:
$ terrad query account terra1dcegyrekltswvyy0xy69ydgxn9x8x32zdtapd8

Terra SDK for Python

Connect to the chain through LocalTerra's LCD server:

from terra_sdk.client.lcd import LCDClient
terra = LCDClient("localterra", "http://localhost:1317")

Terra SDK for JavaScript

Connect to the chain through LocalTerra's LCD server:

import { LCDClient } from "@terra-money/terra.js";

const terra = new LCDClient({
  URL: "http://localhost:1317",
  chainID: "localterra",
});

Configure LocalTerra

The majority of LocalTerra is implemented through a docker-compose.yml file, making it easily customizable. You can use LocalTerra as a starting template point for setting up your own local Terra testnet with Docker containers.

Out of the box, LocalTerra comes preconfigured with opinionated settings such as:

  • ports defined for RPC (26657), LCD (1317) and FCD (3060)
  • standard accounts

Modifying node configuration

You can modify the node configuration of your validator in the config/config.toml and config/app.toml files.

Pro tip: Speed Up Block Time

LocalTerra is often used alongside a script written with the Terra.js SDK or Terra Python SDK as a convenient way to do integration tests. You can greatly improve the experience by speeding up the block time.

To increase block time, edit the [consensus] parameters in the config/config.toml file, and specify your own values.

The following example configures all timeouts to 200ms:

##### consensus configuration options #####
[consensus]

wal_file = "data/cs.wal/wal"
- timeout_propose = "3s"
- timeout_propose_delta = "500ms"
- timeout_prevote = "1s"
- timeout_prevote_delta = "500ms"
- timeout_precommit_delta = "500ms"
- timeout_commit = "5s"
+ timeout_propose = "200ms"
+ timeout_propose_delta = "200ms"
+ timeout_prevote = "200ms"
+ timeout_prevote_delta = "200ms"
+ timeout_precommit_delta = "200ms"
+ timeout_commit = "200ms"

Additionally, you can use the following single line to configure timeouts:

sed -E -i '/timeout_(propose|prevote|precommit|commit)/s/[0-9]+m?s/200ms/' config/config.toml

Modifying genesis

You can change the genesis.json file by altering config/genesis.json. To load your changes, restart your LocalTerra.

Accounts

LocalTerra is pre-configured with one validator and 10 accounts with LUNA balances.

Account Address Mnemonic
validator terra1dcegyrekltswvyy0xy69ydgxn9x8x32zdtapd8
terravaloper1dcegyrekltswvyy0xy69ydgxn9x8x32zdy3ua5
satisfy adjust timber high purchase tuition stool faith fine install that you unaware feed domain license impose boss human eager hat rent enjoy dawn
test1 terra1x46rqay4d3cssq8gxxvqz8xt6nwlz4td20k38v notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius
test2 terra17lmam6zguazs5q5u6z5mmx76uj63gldnse2pdp quality vacuum heart guard buzz spike sight swarm shove special gym robust assume sudden deposit grid alcohol choice devote leader tilt noodle tide penalty
test3 terra1757tkx08n0cqrw7p86ny9lnxsqeth0wgp0em95 symbol force gallery make bulk round subway violin worry mixture penalty kingdom boring survey tool fringe patrol sausage hard admit remember broken alien absorb
test4 terra199vw7724lzkwz6lf2hsx04lrxfkz09tg8dlp6r bounce success option birth apple portion aunt rural episode solution hockey pencil lend session cause hedgehog slender journey system canvas decorate razor catch empty
test5 terra18wlvftxzj6zt0xugy2lr9nxzu402690ltaf4ss second render cat sing soup reward cluster island bench diet lumber grocery repeat balcony perfect diesel stumble piano distance caught occur example ozone loyal
test6 terra1e8ryd9ezefuucd4mje33zdms9m2s90m57878v9 spatial forest elevator battle also spoon fun skirt flight initial nasty transfer glory palm drama gossip remove fan joke shove label dune debate quick
test7 terra17tv2hvwpg0ukqgd2y5ct2w54fyan7z0zxrm2f9 noble width taxi input there patrol clown public spell aunt wish punch moment will misery eight excess arena pen turtle minimum grain vague inmate
test8 terra1lkccuqgj6sjwjn8gsa9xlklqv4pmrqg9dx2fxc cream sport mango believe inhale text fish rely elegant below earth april wall rug ritual blossom cherry detail length blind digital proof identify ride
test9 terra1333veey879eeqcff8j3gfcgwt8cfrg9mq20v6f index light average senior silent limit usual local involve delay update rack cause inmate wall render magnet common feature laundry exact casual resource hundred
test10 terra1fmcjjt6yc9wqup2r06urnrd928jhrde6gcld6n prefer forget visit mistake mixture feel eyebrow autumn shop pair address airport diesel street pass vague innocent poem method awful require hurry unhappy shoulder

Contracts

There are 10 contracts already deployed on genesis:

Code Id Name Example of already instantiated contract
1 CW1155 base
2 CW1 subkeys
3 CW1 whitelist
4 CW1 whitelist ng
5 CW20 base terra1hm4y6fzgxgu688jgf7ek66px6xkrtmn3gyk8fax3eawhp68c2d5q74k9fw
6 CW20 ics20
7 CW3 fixed multisig
8 CW3 flex multisig
9 CW4 group
10 CW4 stake

License

This software is licensed under the MIT license.

© 2020 Terraform Labs, PTE.


 

Powering the innovation of money.

More Repositories

1

classic-core

GO implementation of the Terra Protocol
JavaScript
986
star
2

core

GO implementation of the Terra Protocol
JavaScript
357
star
3

terra.js

JavaScript SDK for Terra, written in TypeScript
TypeScript
264
star
4

terra.py

Python SDK for Terra
Python
136
star
5

docs

🗂 The official documentation for the Terra blockchain
SCSS
112
star
6

station

🛰️ Station wallet
TypeScript
93
star
7

wallet-provider

Library to make React dApps easier using Terra Station Extension or Terra Station Mobile.
TypeScript
89
star
8

shuttle

TypeScript
85
star
9

bridge-web-app

🪐 Terra Bridge web app
TypeScript
82
star
10

validator-profiles

Profiles for Validators of the Terra Blockchain
Jinja
81
star
11

station-legacy

Web Application to interact with Terra Core
TypeScript
67
star
12

mantlemint

Go
65
star
13

fcd-classic

Terra ETL + RestFul API Server
HTML
62
star
14

assets

JavaScript
57
star
15

cosmwasm-contracts

Rust
51
star
16

finder

The Terra Finder is a tool to search through blocks, transactions, and accounts on the Terra blockchain.
TypeScript
50
star
17

oracle-feeder

Oracle Feeder Daemon
TypeScript
49
star
18

terra-cosmwasm

Terra bindings for CosmWasm
Rust
49
star
19

alliance

🤝 Alliance chain with x/alliance module
Go
49
star
20

terrain

🛠 A Terra development environment for seamless smart contract development
TypeScript
46
star
21

research

Models and simulations
Python
44
star
22

classic-testnet

Configuration files for Terra testnet releases
Python
44
star
23

station-mobile

🛰️ Station wallet mobile
TypeScript
34
star
24

faucet

Faucet to get free coins for the Terra testnet
Go
34
star
25

station-extension

🛰️ Station Chrome and Firefox extension
TypeScript
33
star
26

station-desktop

JavaScript
27
star
27

houston

A development environment, testing framework and smart contract pipeline for Terra, aiming to make life as a Terra developer easier.
TypeScript
27
star
28

terraswap-graph

Terraswap Indexer + GraphQL
TypeScript
25
star
29

mantle-sdk

All type definition of Terra, database scheme, and extract scripts
Go
25
star
30

my-terra-token

Simple CosmWasm smart contract on Terra
Rust
21
star
31

documentation

White paper & protocol specifications
TeX
20
star
32

terra.go

Go library for terra blockchain
Go
19
star
33

hive-graph

GraphQL interface for Terra blockchain
TypeScript
17
star
34

mantle

Go
16
star
35

warp-contracts

Rust
15
star
36

jigu

The Python SDK for Terra.
Python
14
star
37

genesis-tools

Genesis Build Script for Terra 2.0
Python
10
star
38

enterprise-contracts

Rust
10
star
39

tefi-oracle-contracts

Oracle SmartContracts for TeFi projects
Rust
10
star
40

smart-contract-webapp-template

This is a basic template for developing smart contract and web app together. This template is based on cw-template of CosmWasm.
TypeScript
10
star
41

react-native-mnemonic-key

Performant replacement for MnemonicKey for React Native
Swift
9
star
42

use-station

TypeScript
8
star
43

warp-sdk

TypeScript
8
star
44

station-assets

🛰️ Assets for Station
JavaScript
8
star
45

feather.js

💻 JavaScript SDK for Station, written in TypeScript
TypeScript
8
star
46

terrain-frontend-template

Frontend template for developing frontends on Terra
TypeScript
7
star
47

terra.proto

proto generator env for multiple languages
TypeScript
7
star
48

wallet-kit

new version of wallet-provider
TypeScript
7
star
49

enterprise-app

TypeScript
7
star
50

feather-core

Templates for feather chain scaffolding
Go
7
star
51

bridge-sdk

Javascript Terra Bridge SDK
TypeScript
7
star
52

terra.kt

Kotlin, Java SDK for Terra
Kotlin
6
star
53

warp-web-app

TypeScript
6
star
54

terra-wallet-java

Native Terra wallet library for Android
Java
6
star
55

testnet

Testnet Infos of Terra 2.0
6
star
56

api-public

API for some Station features
TypeScript
5
star
57

fcd

HTML
5
star
58

terrain-desktop

TypeScript
4
star
59

libp2p-episub

Episub: Proximity Aware Epidemic PubSub for libp2p
Rust
4
star
60

core-genesis-exporter

temp
JavaScript
4
star
61

delegations

[WIP] Hub for managing Terraform Labs delegations
4
star
62

deposit-tracker

Track deposit transactions of an address
TypeScript
4
star
63

mainnet

3
star
64

warp-docs

The official Warp documentation.
JavaScript
3
star
65

classic-docs

CSS
3
star
66

amino-js

TypeScript
3
star
67

TIPs

Terra Improvement Proposals (TIPs) main repository
3
star
68

oracle-feeder-go

Oracle Feeder Daemon
Go
3
star
69

terrain-core-template

Core template for @terra-money/terrain to instantiate projects
TypeScript
3
star
70

level-to-rocks

LevelDB to RocksDB converter
Go
3
star
71

enterprise-sdk

TypeScript
2
star
72

cra-react18-wallet-provider-template

TypeScript
2
star
73

react-base-components

TypeScript
2
star
74

bounties

2
star
75

mantle-compatibility

bells and whistles required for mantle to operate with different versions of cosmos/tendermint
Go
2
star
76

alliance-estimator

TypeScript
2
star
77

alliance-docs

SCSS
2
star
78

msg-reader

JavaScript
2
star
79

santa

Santa subsidizes block rewards on Columbus!
Go
2
star
80

ledger-station-js

TypeScript
2
star
81

terra-web-extensions

Next Browser extensions (In development)
TypeScript
2
star
82

validator-images

JavaScript
2
star
83

key-utils

TypeScript
2
star
84

nostr-bindings

Smart contract to bind terra <-> nostr keys
Rust
2
star
85

new-docs

New docs site
JavaScript
2
star
86

synthetic-assets

TypeScript
2
star
87

station-docs

SCSS
2
star
88

terra-tutorials

A collection of example code used for tutorials
2
star
89

templates

Terra app template registry
1
star
90

alliance-nft-collection

Code to create a collection to reward participants for the Game Of Alliance
TypeScript
1
star
91

log-finder-ruleset

TypeScript
1
star
92

templates.terra.money

TypeScript
1
star
93

terrariums

TypeScript
1
star
94

screening-test-backend

1
star
95

gitcoin-onboarding

1
star
96

cosmwasm-cache-rebuilder

Simple runtime dedicated for rebuilding cosmwasm cache
Rust
1
star
97

ics-proxy

Rust
1
star
98

terra-wallet-ios

Native Terra wallet library for iOS
Swift
1
star
99

alliance-landing

Landing page for the Alliance an open-source Cosmos SDK module.
TypeScript
1
star
100

amino-decoder

rest server for amino decoding
Go
1
star