• Stars
    star
    986
  • Rank 44,900 (Top 1.0 %)
  • Language
    JavaScript
  • License
    Other
  • Created over 5 years ago
  • Updated 9 months ago

Reviews

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

Repository Details

GO implementation of the Terra Protocol

What is Terra Classic?

Terra is a public, open-source blockchain protocol that provides fundamental infrastructure for a decentralized economy and enables open participation in the creation of new financial primitives to power the innovation of money.

Classic is the reference implementation of the Terra protocol, written in Golang. Terra Core is built atop Cosmos SDK and uses Tendermint BFT consensus. If you intend to work on Terra Core source, it is recommended that you familiarize yourself with the concepts in those projects.

Upon the implosion of Terra, a group of rebels seized control of the blockchain. Terra's future is uncertain, but the rebels are now firmly in control.

Installation

Binaries

The easiest way to get started is by downloading a pre-built binary for your operating system. You can find the latest binaries on the releases page.

From Source

Step 1. Install Golang

Go v1.18 is required for Terra Core.

If you haven't already, install Golang by following the official docs. Make sure that your GOPATH and GOBIN environment variables are properly set up.

Step 2: Get Terra Core source code

Use git to retrieve Terra Core from the official repo and checkout the main branch. This branch contains the latest stable release, which will install the terrad binary.

git clone https://github.com/classic-terra/core/
cd core
git checkout main

Step 3: Build Terra core

Run the following command to install the executable terrad to your GOPATH and build Terra Core. terrad is the node daemon and CLI for interacting with a Terra node.

# COSMOS_BUILD_OPTIONS=rocksdb make install
make install

Step 4: Verify your installation

Verify that you've installed terrad successfully by running the following command:

terrad version --long

If terrad is installed correctly, the following information is returned:

name: terra
server_name: terrad
version: 1.0.5
commit: 8bb56e9919ecf5234a3239a6a351b509451f9d5d
build_tags: netgo,ledger
go: go version go1.18.1 linux/amd64

terrad

NOTE: terracli has been deprecated and all of its functionalities have been merged into terrad.

terrad is the all-in-one command for operating and interacting with a running Terra node. For comprehensive coverage on each of the available functions, see the terrad reference information. To view various subcommands and their expected arguments, use the $ terrad --help command:

        
$ terrad --help Stargate Terra App Usage: terrad [command] Available Commands: add-genesis-account Add a genesis account to genesis.json collect-gentxs Collect genesis txs and output a genesis.json file debug Tool for helping with debugging your application export Export state to JSON gentx Generate a genesis tx carrying a self delegation help Help about any command init Initialize private validator, p2p, genesis, and application configuration files keys Manage your application's keys migrate Migrate genesis to a specified target version query Querying subcommands rosetta spin up a rosetta server start Run the full node status Query remote node for status tendermint Tendermint subcommands testnet Initialize files for a terrad testnet tx Transactions subcommands unsafe-reset-all Resets the blockchain database, removes address book files, and resets data/priv_validator_state.json to the genesis state validate-genesis validates the genesis file at the default location or at the location passed as an arg version Print the application binary version information Flags: -h, --help help for terrad --home string directory for config and data (default "/Users/$HOME/.terra") --log_format string The logging format (json|plain) (default "plain") --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info") --trace print out full stack trace on errors Use "terrad [command] --help" for more information about a command.

Node Setup

Once you have terrad installed, you will need to set up your node to be part of the network.

Join the mainnet

The following requirements are recommended for running a columbus-5 mainnet node:

  • 4 or more CPU cores
  • At least 2TB of disk storage
  • At least 100mbps network bandwidth
  • An Linux distribution

For configuration and migration instructions for setting up a Columbus-5 mainnet node, visit The mainnet repo.

Terra Node Quick Start

terrad init nodename
wget -O ~/.terra/config/genesis.json https://cloudflare-ipfs.com/ipfs/QmZAMcdu85Qr8saFuNpL9VaxVqqLGWNAs72RVFhchL9jWs
curl https://network.terra.dev/addrbook.json > ~/.terrad/config/addrbook.json
terrad start

Join a testnet

Several testnets might exist simultaneously. Ensure that your version of terrad is compatible with the network you want to join.

To set up a node on the latest testnet, visit the testnet repo.

Run a local testnet

The easiest way to set up a local testing environment is to run LocalTerra, which automatically orchestrates a complete testing environment suited for development with zero configuration.

Run a single node testnet

You can also run a local testnet using a single node. On a local testnet, you will be the sole validator signing blocks.

Step 1. Create network and account

First, initialize your genesis file to bootstrap your network. Create a name for your local testnet and provide a moniker to refer to your node:

terrad init --chain-id=<testnet_name> <node_moniker>

Next, create a Terra account by running the following command:

terrad keys add <account_name>

Step 2. Add account to genesis

Next, add your account to genesis and set an initial balance to start. Run the following commands to add your account and set the initial balance:

terrad add-genesis-account $(terrad keys show <account_name> -a) 100000000uluna,1000usd
terrad gentx <account_name> 10000000uluna --chain-id=<testnet_name>
terrad collect-gentxs

Step 3. Run Terra daemon

Now you can start your private Terra network:

terrad start

Your terrad node will be running a node on tcp://localhost:26656, listening for incoming transactions and signing blocks.

Congratulations, you've successfully set up your local Terra network!

Set up a production environment

NOTE: This guide only covers general settings for a production-level full node. You can find further details on considerations for operating a validator node by visiting the Terra validator guide.

This guide has been tested against Linux distributions only. To ensure you successfully set up your production environment, consider setting it up on an Linux system.

Increase maximum open files

terrad can't open more than 1024 files (the default maximum) concurrently.

You can increase this limit by modifying /etc/security/limits.conf and raising the nofile capability.

*                soft    nofile          65535
*                hard    nofile          65535

Create a dedicated user

It is recommended that you run terrad as a normal user. Super-user accounts are only recommended during setup to create and modify files.

Port configuration

terrad uses several TCP ports for different purposes.

  • 26656: The default port for the P2P protocol. Use this port to communicate with other nodes. While this port must be open to join a network, it does not have to be open to the public. Validator nodes should configure persistent_peers and close this port to the public.

  • 26657: The default port for the RPC protocol. This port is used for querying / sending transactions and must be open to serve queries from terrad. DO NOT open this port to the public unless you are planning to run a public node.

  • 1317: The default port for Lite Client Daemon (LCD), which can be enabled in ~/.terra/config/app.toml. The LCD provides an HTTP RESTful API layer to allow applications and services to interact with your terrad instance through RPC. Check the Terra REST API for usage examples. Don't open this port unless you need to use the LCD.

  • 26660: The default port for interacting with the Prometheus database. You can use Promethues to monitor an environment. This port is closed by default.

Run the server as a daemon

Important:

Keep terrad running at all times. The simplest solution is to register terrad as a systemd service so that it automatically starts after system reboots and other events.

Register terrad as a service

First, create a service definition file in /etc/systemd/system.

Sample file: /etc/systemd/system/terrad.service

[Unit]
Description=Terra Daemon
After=network.target

[Service]
Type=simple
User=terra
ExecStart=/data/terra/go/bin/terrad start
Restart=on-abort

[Install]
WantedBy=multi-user.target

[Service]
LimitNOFILE=65535

Modify the Service section from the given sample above to suit your settings. Note that even if you raised the number of open files for a process, you still need to include LimitNOFILE.

After creating a service definition file, you should execute systemctl daemon-reload.

Start, stop, or restart service

Use systemctl to control (start, stop, restart)

# Start
systemctl start terrad
# Stop
systemctl stop terrad
# Restart
systemctl restart terrad

Access logs

# Entire log
journalctl -t terrad
# Entire log reversed
journalctl -t terrad -r
# Latest and continuous
journalctl -t terrad -f

Using docker-compose

  1. Install Docker

  2. Create a new folder on your local machine and copy docker-compose\docker-compose.yml

  3. Review the docker-compose.yml contents

  4. Bring up your stack by running

    docker-compose up -d
  5. Add your wallet

    docker-compose exec node sh /keys-add.sh
  6. Copy your terra wallet address and go to the terra faucet here -> http://45.79.139.229:3000/ Put your address in and give yourself luna coins.

  7. Start the validator

    docker-compose exec node sh /create-validator.sh

Cheat Sheet:

Start

docker-compose up -d

Stop

docker-compose down

View Logs

docker-compose logs -f

Run Terrad Commands Example

docker-compose exec node terrad status

Upgrade

docker-compose down
docker-compose pull
docker-compose up -d

Build from source

make build-all -f contrib/terra-operator/Makefile

Resources

Community

Contributing

If you are interested in contributing to Terra Core source, please review our code of conduct.

License

This software is licensed under the Apache 2.0 license. Read more about it here.

© 2022 Terraform Labs, PTE LTD


 

Powering the innovation of money.

More Repositories

1

core

GO implementation of the Terra Protocol
JavaScript
357
star
2

terra.js

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

LocalTerra

One-click local Terra testnet and ecosystem for rapid prototyping
Dockerfile
177
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
94
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
47
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

enterprise-app

TypeScript
7
star
49

feather-core

Templates for feather chain scaffolding
Go
7
star
50

bridge-sdk

Javascript Terra Bridge SDK
TypeScript
7
star
51

terra.kt

Kotlin, Java SDK for Terra
Kotlin
6
star
52

warp-web-app

TypeScript
6
star
53

terra-wallet-java

Native Terra wallet library for Android
Java
6
star
54

testnet

Testnet Infos of Terra 2.0
6
star
55

api-public

API for some Station features
TypeScript
5
star
56

wallet-kit

new version of wallet-provider
TypeScript
5
star
57

fcd

HTML
5
star
58

libp2p-episub

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

terrain-desktop

TypeScript
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

amino-js

TypeScript
3
star
64

mainnet

3
star
65

warp-docs

The official Warp documentation.
JavaScript
3
star
66

classic-docs

CSS
3
star
67

TIPs

Terra Improvement Proposals (TIPs) main repository
3
star
68

terrain-core-template

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

level-to-rocks

LevelDB to RocksDB converter
Go
3
star
70

enterprise-sdk

TypeScript
2
star
71

cra-react18-wallet-provider-template

TypeScript
2
star
72

react-base-components

TypeScript
2
star
73

bounties

2
star
74

mantle-compatibility

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

alliance-estimator

TypeScript
2
star
76

alliance-docs

SCSS
2
star
77

msg-reader

JavaScript
2
star
78

ledger-station-js

TypeScript
2
star
79

terra-web-extensions

Next Browser extensions (In development)
TypeScript
2
star
80

validator-images

JavaScript
2
star
81

oracle-feeder-go

Oracle Feeder Daemon
Go
2
star
82

key-utils

TypeScript
2
star
83

santa

Santa subsidizes block rewards on Columbus!
Go
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

terra-tutorials

A collection of example code used for tutorials
2
star
88

templates

Terra app template registry
1
star
89

alliance-nft-collection

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

log-finder-ruleset

TypeScript
1
star
91

templates.terra.money

TypeScript
1
star
92

terrariums

TypeScript
1
star
93

screening-test-backend

1
star
94

gitcoin-onboarding

1
star
95

cosmwasm-cache-rebuilder

Simple runtime dedicated for rebuilding cosmwasm cache
Rust
1
star
96

ics-proxy

Rust
1
star
97

airdrop

This app is used to claim the airdrops from other chains into Terra with support for Terra Station, Metamask, Wallet Connect and Phantom Wallet.
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