Full-node software implementing the Terra protocol
Explore the Docs »
Dev Guide
·
Go API
·
REST API
·
SDKs
·
Finder
·
Station
Terra is a 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.
The Terra blockchain is secured through distributed consensus over native staked asset Luna, and supports the issuance of price-tracking stablecoins (TerraKRW, TerraUSD, etc.) that are pegged to major world currencies. Smart contracts on Terra run on WebAssembly and can take advantage of core modules like on-chain swaps, price oracle, and staking rewards to power modern DeFi apps. Through fiscal policy managed by community governance, Terra is a democratized economy regulated by its users.
Terra Core 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.
You can find the latest binaries on our releases page.
We recommend the following for running Terra Core:
- 2 or more CPU cores
- At least 300GB of disk storage
- At least 2.5 - 5mbps network bandwidth
Go v1.14+ or higher 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.
Use git
to retrieve Terra Core from the official repo, and checkout the master
branch, which contains the latest stable release. That should install the terrad
binary.
git clone https://github.com/terra-money/core/
cd core
git checkout master
You can now build Terra Core. Running the following command will install executable terrad
(Terra node daemon and CLI for interacting with the node) to your GOPATH
.
make install
Verify that everything is OK. If you get something like the following, you've successfully installed Terra Core on your system.
terrad version --long
name: terra
server_name: terrad
version: 0.5.0-rc0-9-g640fd0ed
commit: 640fd0ed921d029f4d1c3d88435bd5dbd67d14cd
build_tags: netgo,ledger
go: go version go1.16.5 darwin/amd64
terrad
provides you a command-line interface to a running node, communicating over RPC. You can find comprehensive coverage on how to use the CMD on our official docs. The various subcommands and their expected arguments can also be discovered by issuing:
$ terrad --help Command line interface for interacting with terrad 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/yeoyunseog/.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 "terracli [command] --help" for more information about a command.
Chain ID | Description | Public Node (LCD) |
---|---|---|
columbus-4 |
Mainnet | https://lcd.terra.dev |
tequila-0004 |
Columbus-4 Testnet | https://tequila-lcd.terra.dev |
bombay-0008 |
Columbus-5 Testnet | https://bombay-lcd.terra.dev |
The simplest Terra network you can set up will be a local testnet with just a single node. You will create one account and be the sole validator signing blocks for the network.
First, initialize your genesis file that will bootstrap the network. Set a name for your local testnet, and provide a moniker to refer to your node.
terrad init --chain-id=<testnet_name> <node_moniker>
You will need a Terra account to start. You can generate one with:
terrad keys add <account_name>
Next, you need to add your account to the genesis. The following commands add your account and set the initial balance:
terrad add-genesis-account $(terrad keys show <account_name> -a) 100000000uluna,1000usd
terrad gentx --name my_account --amount 10000000uluna
terrad collect-gentxs
Now, you can start your private Terra network:
terrad start
Your terrad
node should now be running a node on tcp://localhost:26656
, listening for incoming transactions and signing blocks. You've successfully set up your local Terra network!
The mainnet repo contains snapshot of the launch as well as network updates.
Our testnet repo contains latest configuration files for the testnet.
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 in our Validator Guide
For the moment, this guide has only been tested against RPM-based Linux distributions.
terrad
can open more than 1024 files (which is default maximum) concurrently.
You will want to increase this limit.
Modify /etc/security/limits.conf
to raise the nofile
capability.
* soft nofile 65535
* hard nofile 65535
terrad
does not require the super user account. We strongly recommend using a normal user to run terrad
. However, during the setup process you'll need super user permission to create and modify some files.
terrad
uses several TCP ports for different purposes.
-
26656
is the default port for the P2P protocol. This port is opened in order to communicate with other nodes, and must be open to join a network. However, it does not have to be open to the public. For validator nodes, we recommend configuringpersistent_peers
and closing this port to the public. -
26657
is the default port for the RPC protocol. This port is used for querying / sending transactions. In other words, this port needs to be opened for serving queries fromterracli
. It is safe to NOT to open this port to the public unless you are planning to run a public node. -
1317
is the default port for Lite Client Daemon (LCD), which can be enabled at~/.terra/config/app.toml
. LCD provides HTTP RESTful API layer to allow applications and services to interact with yourterrad
instance through RPC. Check the Terra REST API for usage examples. You don't need to open this port unless you have use of it. -
26660
is the default port for interacting with the Prometheus database which can be used for monitoring the environment. This port is not opened in the default configuration.
It is important to keep terrad
running at all times. There are several ways to achieve this, and the simplest solution we recommend is to register terrad
as a systemd
service so that it will automatically get started upon system reboots and other events.
First, create a service definition file in /etc/systemd/system
.
[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 we raised the number of open files for a process, we still need to include LimitNOFILE
.
After creating a service definition file, you should execute systemctl daemon-reload
.
Use systemctl
to control (start, stop, restart)
# Start
systemctl start terrad
# Stop
systemctl stop terrad
# Restart
systemctl restart terrad
# Entire log
journalctl -t terrad
# Entire log reversed
journalctl -t terrad -r
# Latest and continuous
journalctl -t terrad -f
-
Developer Tools
- SDKs
- Faucet can be used to get tokens for testnets
- LocalTerra can be used to set up a private local testnet with configurable world state
-
Block Explorers
-
Wallets
-
Research
- Agora - Research forum
- White Paper
We are currently finalizing contribution standards and guidelines. In the meanwhile, if you are interested in contributing to the Terra Project, please contact our admin.
This software is licensed under the Apache 2.0 license. Read more about it here.
© 2020 Terraform Labs, PTE LTD