1. Project Overview & Quickstart (octalmage/LICENSE)
LICENSE
Open-source repository octalmage/LICENSE
Repository Details
- Repository: octalmage/LICENSE
- Primary Language: Code
Note: High-volume repository documentation is actively indexed and synchronized by YakaAI.
2. Official Technical Reference & Guides (octalmage/docs)
File: README.md
Building
Getting the repo
If you are contributing to the repository, make sure to fork this repo, and then clone your own fork. You will need to do this to make creating pull requests easier.
git clone https://github.com/<your-username>/terra-docsAdding an article
All articles are markdown files, placed under the /docs/ directory. You can create folders underneath the /docs directory, such as the following:
/docs
/dev
spec-auth.md
...
/node
installation.md
...Notice how README.md serves as the default root of the folder.
Editing the navigation
To edit the navigation to include your new article, edit /docs/.vuepress/config.js and add your new article in the appropriate section in themeConfig.sidebar, following the other paths as examples.
Test it out locally
Make sure you install all the dependencies:
npm installBuild and run locally (hot-reloading dev server):
npm run devOrganization
Module Specs
Each module should be documented with the following subheaders:
Abstract (no header)
Maximum 2 paragraphs to explain, in broad terms, the general purpose of the module, to provide a "big-picture" perspective of how the module provides functionality and organization to the Terra protocol, and how it interacts with other modules.
Concepts
A section dedicated to the concepts that are required to understand how the module works. This may include:
- layman primer
- math formulas (formatted with LaTeX)
- diagrams
Data
A section that covers the various data structures used by the module.
State
A section that covers the keeper state for that module key-value store
Messages
A section that covers the various types of messages and gives a rough explanation on how they are handled.
Proposals
A section that covers the related governance proposals
Transitions
A section that covers the begin-blocker and end-blocker transition functions
Parameters
A section that covers the chain parameters that can be modified by governance via the
paramsmodule
Built With
- Vuepress
- MathJax
- Terra Docs custom theme
License
This software is licensed under the MIT license. See LICENSE for full disclosure.
ยฉ 2020 Terraform Labs, PTE.
File: docs/Concepts/Fees.md
Fees on Terra
On the Terra network, all transactions incur a gas fee. Transactions invloving stablecoins incur additional fees depending on the type of transaction being made. The following table explains which extra fee is added to the different types of stablecoin transactions:
| Gas | Tobin | Spread | Stability | |
|---|---|---|---|---|
| Market swaps between stablecoins | x | x | ||
| Market swaps between stablecoins and Luna | x | x | ||
| All other stablecoin transactions (non market swap) | x | x |
Transactions that only involve Luna, such as sending Luna, delegating, or voting only incur gas fees.
Terraswap or other dApps may charge their own transaction fees on top of Terra network fees.
Gas
Gas is a small computational fee that covers the cost of processing a transaction. Gas is estimated and added to every transaction in Terra Station. Any transaction that does not contain enough gas will not process.
Gas on Terra works differently than it works on other blockchains:
- Validators can set their own minimum gas fees.
- Most transactions will estimate more than the minimum amount of gas, ensuring the transaction gets completed.
- Unused gas is not refunded.
- Transactions are not queued based on gas amounts, but in the order received.
For an in-depth explanation of how gas fees are calculated, visit the terrad reference page.
To view current gas rates in your browser, visit the gas rates FCD page.
Stability fee
Stability fees are the most common fee type, and are added to any transaction using Terra stablecoins, excluding market swaps. This fee is called the tax rate and varies between .01% to 1%. Stability fees are capped at 1 SDT per transaction. The current tax rate can be found on the tax rate FCD page. For more information on the tax rate and how it works, visit the treasury module.
Tobin tax
The Tobin tax is a fixed percentage fee added to any market swap between Terra stablecoin denominations. The rate varies depending on each Terra stablecoin. For example, while the rate for most denominations is .35%, the rate for MNT is 2%. To see the Tobin tax rates, query the oracle. When stablecoins have different Tobin tax rates, the higher tax rate will be used for the transaction.
The Tobin tax was created to discourage front-running the oracle and foreign exchange trading at the expense of users. For more information on the implementation of the Tobin tax, read "On swap fees: the greedy and the wise".
Spread fee
Spread fees are added to any market swap between Terra and Luna. The minimum spread fee is .5%. During times of extreme volatility, the market module adjusts the spread fee to maintain a constant product between the size of the Terra pool and the fiat value of the Luna pool, ensuring stability in the protocol. As the pools reach constant product equilibrium, The spread rate returns to a normal value.
For more information on spread fees, visit the market module.
File: docs/Concepts/glossary.md
Glossary
Use this glossary to learn about terms specific to the Terra Protocol.
Active set
The top 130 validators that participate in consensus and receive rewards.
Air drops
Additional rewards given to delegators through certain validators, separate from staking rewards. Airdrops come from protocols in the Terra ecosystem to increase visibility. To claim an airdrop, visit the webpage of the protocol giving out the airdrop.
Algorithmic stablecoin
A cryptocurrency that tracks the price of any asset, usually currency. Algorithmic stablecoins maintain their price peg through a set of rules or software instead of an underlying asset.
For more information on stablecoins created by the Terra protocol, see Terra stablecoins
Arbitrage
To profit from price differences across different markets. Arbitrageurs buy coins in one market and sell them on another market for a higher price.
Blockchain
An unchangeable ledger of transactions copied among a network of independent computer systems.
Blocks
Groups of information stored on a blockchain. Each block contains transactions that are grouped, verified, and signed by validators.
bLuna
A token representing bonded Luna that can be traded freely or used as collateral on other protocols in the Terra network, such as Anchor and Mirror. Bonded Luna takes 21 days to become unbonded.
Bonded validator
A validator in the active set participating in consensus. Bonded validators earn rewards.
Bonding
When a user delegates or bonds Luna to a validator to receive staking rewards. Validators never have ownership of a delegator's Luna, even when bonded. Delegating, bonding, and staking generally refer to the same process.
Burn
The destruction of coins. The Terra protocol burns Luna to mint Terra stablecoins and vice versa. Burned coins are destroyed.
CHAI
A mobile payments app powered by Terra's blockchain network.
Columbus-5
The current version of the Terra mainnet.
Commission
The percentage of staking rewards a validator keeps before distributing the rest of the rewards to delegators. Commission is a validatorโs income. Validators set their own commission rates.
Community pool
A special fund designated for funding community projects. Any community member can create a governance proposal to spend the tokens in the community pool. If the proposal passes, the funds are spent as specified in the proposal.
Consensus
A system used by validators or miners to agree that each block of transactions in a blockchain is correct. The Terra blockchain uses the Tendermint consensus. Validators earn rewards for participating in consensus. Visit the Tendermint official documentation site for more information.
Cosmos-SDK
The open-source framework the Terra blockchain is built on. For more information, check out the Cosmos SDK Documentation.
dApp
An application built on a decentralized platform. Protocolโs built on Terra are dApps.
DDoS
Distributed denial of service attack. When an attacker floods a network with traffic or requests in order to disrupt service.
DeFi
Decentralized finance. A movement away from traditional finance and toward systems that do not require financial intermediaries.
Delegate
When users or delegators add their Luna to a validator's stake in exchange for rewards. Delegated Luna is bonded to a validator. Validators never have ownership of a delegator's Luna. Delegating, bonding, and staking generally refer to the same process.
Delegator
A user who delegates, bonds, or stakes Luna to a validator to earn rewards. Delegating, bonding, and staking generally refer to the same process.
Fees
Gas: Compute fees added on to all transactions to avoid spamming. Validators set minimum gas prices and reject transactions that have implied gas prices below this threshold.
Stability fee: A fee added to any Terra stablecoin transaction excluding market swaps. Stability fees are capped at 1 SDT and are also referred to as taxes.
Spread fee: A variable fee on any transaction between Terra and Luna.
Tobin tax: A fee on any transaction between Terra stablecoin denominations.
For more information on fees, visit Fees on Terra.
Fiat currency
Currency issued by a government that is not backed by an underlying asset. USD is the fiat currency of the United States.
Full node
A computer connected to the Terra mainnet able to validate transactions and interact with the Terra blockchain. All active validators run full nodes.
Luna
The native staking token of the Terra protocol. Luna supply expands and contracts in order to maintain the prices of Terra stablecoins. Luna is also used as a governance token. Delegators can stake Luna to recieve rewards.
Governance
Governance is the democratic process that allows users and validators to make changes to the Terra protocol. Community members submit, vote, and implement proposals. One staked Luna is equal to one vote.
Governance proposal
A written submission for a change or addition to the Terra protocol. Topics of proposals can vary from community pool spending, software changes, parameter changes, or any change pertaining to the Terra protocol.
Inactive set
Validators that are not in the active set. These validators do not participate in consensus and do not earn rewards.
Jailed
Validators who misbehave are jailed or excluded from the active set for a period amount of time.
Market swap
A swap in Terra Station that uses the Terra protocol's market function. Market swaps occur between Terra stablecoin denominations or between Terra and Luna. Market swaps spend gas and incur either a Tobin tax or a Spread fee, but are not subject to a stability fee.
Examples
- Swapping UST for KRT in Terra Station will charge a Tobin tax and gas fees.
- Swapping Luna for UST in Terra Station will charge a spread fee and gas fees.
To learn how to use the market swap feature in Terra station, visit how to use Terra Station.
For more information on fees, visit Fees on Terra.
Mint
The creation of new coins. Minting is the opposite of burning. The Terra protocol burns Luna to mint Terra stablecoins and vice versa.
Module
A section of the Terra core that represents a particular function of the Terra protocol. Visit the Terra core module specifications for more information.
Oracle
A software that monitors the real-world price and exchange rates of different assets. Validators submit exchange rates to the protocol and vote on the correct rates. Oracles are used to relay current external exchange rates to the protocol.
For more information, visit the Oracle reference documentation.
Peg
A currency rate that directly tracks an asset's price. The peg for UST is the price of USD. The ideal peg ratio is 1:1.
Pools
Groups of tokens. Supply pools represent the total supply of tokens in a market.
Proof of Stake
Proof of Stake. A style of blockchain where validators are chosen to propose blocks according to the number of coins they hold.
Redelegate
When a delegator wants to transfer their bonded luna to a different validator. Redelegating Luna is instant and does not require a 21-day unbonding period.
Rewards
Revenue generated from fees given to validators and disbursed to delegators.
SDR
Special Drawing Rights. An international reserve asset and unit of account created by the IMF. SDR value is calculated daily using a basket of the world's largest economies. The Terra protocol uses TerraSDR or SDT as its base currency for calculations and to set standards.
Seigniorage
The value of a coin minus the cost of its production. In the Terra protocol, the cost of minting is very small. All seigniorage in the Terra protocol is burned.
Self-delegation
The amount of Luna a validator bonds to themselves. Also referred to as self-bond.
Slashing
Punishment for validators that misbehave. Validators lose part of their stake when they get slashed.
For more information on slashing, visit the concepts page
Slippage
The difference in a coin's price between the start and end of a transaction.
Stake
The amount of Luna bonded to a validator.
Staking
When a user delegates or bonds their Luna to an active validator in order to receive rewards. Bonded Luna adds to a validator's stake. Validators provide their stakes as collateral to participate in the consensus process. Validators with larger stakes are chosen to participate more often. Validators receive staking rewards for their participation. A validator's stake can be slashed if the validator misbehaves. Validators never have ownership of a delegator's Luna, even when staking.
For more information on staking, visit the concepts page.
Tendermint consensus
The consensus procedure used by the Terra protocol. First, a validator proposes a new block. Other validators vote on the block in two rounds. If a block receives a two-thirds majority or greater of yes votes in both rounds, it gets added to the blockchain. Validators get rewarded with the block's transaction fees. Proposers get rewarded extra. Each validator is chosen to propose based on their weight. Checkout the Tendermint official documentation for more information.
Terra core
The official source code for the Terra protocol.
For more information on the Terra core, visit the core developer guide.
Terra mainnet
The Terra protocol's blockchain network where all transactions take place.
Terra stablecoins
Crypto assets that track the price of fiat currency enabled by the Terra protocol. Users mint new Terra stablecoins by burning Luna. Stablecoins are named for their fiat counterparts. For example, the base Terra stablecoin tracks the price of the IMFโs SDR, named TerraSDR, or SDT. Other stablecoin denominations include TerraUSD or UST, and TerraKRW or KRT. All Terra stablecoin denominations exist in the same pool.
For more information on Terra stablecoins, visit the concepts page.
Terra Station
Terra's native wallet and platform for swaps, governance, and staking. In Station, you can send, receive, swap, and stake Terra coins. You can also participate in governance and vote on proposals.
To learn how to install and get started using Terra Station, visit the Terra Station tutorial.
To learn how to use the advanced features of Terra Station, visit the Terra Station how-to guide.
terrad
The command line interface for interacting with a Terra node.
For more information on terrad, visit Using terrad.
Terravaloper address
A validator's public address beginning with terravaloper followed by a string of characters.
Testnet
A version of the mainnet just for testing. The testnet does not use real coins. You can use the testnet to get familiar with transactions.
The Terra ecosystem
A quickly expanding network of decentralized applications built on the Terra protocol.
The Terra protocol
The leading decentralized and open-source public blockchain protocol for algorithmic stablecoins. Using a combination of open market arbitrage incentives and decentralized oracle voting, the Terra protocol creates stablecoins that consistently track the price of any fiat currency.
For more information on how the Terra protocol works, visit the concepts page
Tobin tax
A fee added to every swap between Terra stablecoins (spot-trading). The rate varies, depending on the denomination. For example, while the rate for most denominations is .35%, the rate for MNT is 2%. To see the rates, query the oracle.
Total stake
The total amount of Luna bonded to a delegator, including self-bonded Luna.
Unbonded validator
A validator that is not in the active set and does not participate in consensus or receive rewards. Some unbonded validators may be jailed.
Unbonding validator
A validator transitioning from the active set to the inactive set. An unbonding validator does not participate in consensus or earn rewards. The unbonding process takes 21 days.
Unbonded Luna
Luna that can be freely traded and is not staked to a validator.
Unbonding
When a delegator decides to undelegate their Luna from a validator. This process takes 21 days. No rewards accrue during this period. This action cannot be stopped once executed.
Unbonding Luna
Luna that is transitioning from bonded to unbonded. Luna that is unbonding cannot be traded freely. The unbonding process takes 21 days. No rewards accrue during this period. This action cannot be stopped once executed.
Undelegate
When a delegator no longer wishes to have their Luna bonded to a validator. This process takes 21 days. No rewards accrue during this period. This action cannot be stopped once executed.
Uptime
The amount of time a validator has been active in a given timeframe. Validators with low up time may be slashed.
Validator
A Terra blockchain miner responsible for verifying transactions on the blockchain. Validators run programs called full nodes that allow them to participate in consensus, verify blocks, participate in governance, and receive rewards. The top 130 validators with the highest total stake can participate in consensus.
For more information on validators, visit the concepts page.
Weight
The measure of a validator's total stake. Validators with higher weights get selected more often to propose blocks. A validator's weight is also a measure of their voting power in governance.
File: docs/Concepts/Protocol.md
The Terra protocol
The Terra protocol is the leading decentralized and open-source public blockchain protocol for algorithmic stablecoins. Using a combination of open market arbitrage incentives and decentralized oracle voting, the Terra protocol creates stablecoins that consistently track the price of any fiat currency. Users can spend, save, trade, or exchange Terra stablecoins instantly, all on the Terra blockchain. Luna provides its holders with staking rewards and governance power. The Terra ecosystem is a quickly expanding network of decentralized applications, creating a stable demand for Terra and increasing the price of Luna.
Terra and Luna
The protocol consists of two main tokens, Terra and Luna.
Terra: Stablecoins that track the price of fiat currencies. Users mint new Terra by burning Luna. Stablecoins are named for their fiat counterparts. For example, the base Terra stablecoin tracks the price of the IMFโs SDR, named TerraSDR, or SDT. Other stablecoin denominations include TerraUSD or UST, and TerraKRW or KRT. All Terra denominations exist in the same pool.
Luna: The Terra protocolโs native staking token that absorbs the price volatility of Terra. Luna is used for governance and in mining. Users stake Luna to validators who record and verify transactions on the blockchain in exchange for rewards from transaction fees. The more Terra is used, the more Luna is worth.
How the Terra protocol works
Stablecoin
Stablecoins are the main feature of the Terra protocol: crypto assets that track the price of an underlying currency. As a digital form of currency, Terra stablecoins can be used just like fiat currency with blockchain's added benefits: an unchangeable public ledger, instant transactions, faster settlement times, and fewer fees.
Stablecoins are only valuable to users if they maintain their price peg. The Terra protocol uses the basic market forces of supply and demand to maintain the price of Terra. When the demand for Terra is high and the supply is limited, the price of Terra increases. When the demand for Terra is low and the supply is too large, the price of Terra decreases. The protocol ensures the supply and demand of Terra is always balanced, leading to a stable price.
Expansion and contraction
Imagine the whole Terra economy as two pools: one for Terra and one for Luna. To maintain the price of Terra, the Luna supply pool adds to or subtracts from Terraโs supply. Users burn Luna to mint Terra and burn Terra to mint Luna, all incentivized by the protocol's algorithmic market module.
Expansion: When the price of Terra is high relative to its peg, supply is too small and demand is too high. The protocol incentivizes users to burn Luna and mint Terra. The new supply of Terra makes its pool larger, balancing supply with demand. Users mint more Terra from burned Luna until Terra reaches its target price. The Luna pool gets smaller in this process, increasing the price of Luna.
Contraction: When the price of Terra is too low relative to its peg, supply is too large and demand is too low. The protocol incentives users to burn Terra and mint Luna. The decrease in Terraโs supply causes scarcity, and the price of Terra increases. More Luna is minted from burned Terra until Terra reaches its target price. The Luna pool increases and lowers in price.
Luna is the variable counterpart to the stable asset Terra. By modulating supply, Luna's price increases as the demand for stablecoins increases.
The market module and arbitrage
The price stability of Terra is achieved by the protocol's algorithmic market module, which incentivizes the minting or burning of Terra through arbitrage opportunities. Arbitrage occurs when a user profits from price differences between markets.
The Terra protocol's market module enables users to always trade 1 USD worth of Luna for 1 UST, and vice versa, incentivizing users to maintain the price of Terra. This same principle is true for all Terra stablecoin denominations.
Users can access the mint and burn function of the market module by performing market swaps in Terra Station.
To learn how to use the market swap feature of Terra Station, visit the Terra Station market swap guide.
- Example
If 1 UST is trading at 1.01 USD, users can use the market swap feature of Terra Station to trade 1 USD of Luna for 1 UST. The market burns 1 USD of Luna and mints 1 UST. Users can then sell their 1 UST for 1.01 USD, profiting .01 USD through arbitrage, adding to the UST pool. This arbitrage continues until UST price falls back to match the price of USD, maintaining Terra's peg.
The same arbitrage mechanism works in reverse for contraction.
- Example
If 1 UST is trading at .99 USD, users can buy 1 UST for .99 USD. Users then utilize Terra Station's market swap function to trade 1 UST for 1 USD of Luna. The swap burns 1 UST and mints 1 USD of Luna. Users profit .01 UST from the swap. This arbitrage continues, and UST is burned to mint Luna until the price of UST rises back to 1 USD.
Scalability
The Terra protocol is scalable: it is designed to maintain Terra's price stability regardless of market size, volatility, or demand. The monetary policies encoded into the protocol ensure its durability and resilience in all market fluctuations.
Seigniorage and deflation
Seigniorage is the value of a coin minus the cost of its production. In early versions of the Terra protocol, seigniorage was diverted to fund various community projects. While seigniorage can create enormous value, it also creates inflation in the system.
All seigniorage in the Terra protocol is burned, making Luna deflationary in nature.
Validators
Validators are the miners of the Terra blockchain. They are responsible for securing the Terra blockchain and ensuring its accuracy. Validators run programs called full nodes which allow them to verify each transaction made on the Terra network. Validators propose blocks, vote on their validity, and add each new block to the chain in exchange for staking rewards from transaction fees. Users can stake their Luna to validators in exchange for staking rewards. Validators also play an important role in the governance of the Terra protocol.
For more information on validators, visit the Validator FAQ.
Consensus
The Terra blockchain is a proof-of-stake blockchain, powered by the Cosmos SDK and secured by a system of verification called the Tendermint consensus.
The following process explains how Tendermint consensus works. For more information on the Tendermint consensus, visit the official Tendermint documentation.
- A validator called a proposer is chosen to submit a new block of transactions.
- Validators vote in two rounds on whether they accept or reject the proposed block. If a block is rejected, a new proposer is selected and the process starts again.
- If accepted, the block is signed and added to the chain.
- The transaction fees from the block are distributed as staking rewards to validators and delegators. Proposers get rewarded extra for their participation.
This process repeats, adding new blocks of transactions to the chain. Each validator has a copy of all transactions made on the network, which they compare against the proposed block of transactions before voting. Because multiple independent validators take place in consensus voting, it is infeasible for any false block to be accepted. In this way, validators protect the integrity of the Terra blockchain and ensure the validity of each transaction.
Staking
Staking is the process of bonding Luna to a validator in exchange for staking rewards.
The Terra protocol only allows the top 130 validators to participate in consensus. A validator's rank is determined by their stake or the total amount of Luna bonded to them. Although validators can bond Luna to themselves, they mainly amass larger stakes from delegators. Validators with larger stakes get chosen more often to propose new blocks and earn proportionally more rewards.
Delegators
Delegators are users who want to receive rewards from consensus without running a full node. Any user that stakes Luna is a delegator. Delegators stake their Luna to a validator, adding to a validatorโs weight, or total stake. In return, delegators receive a portion of transaction fees as staking rewards.
:::tip Who owns staked Luna?
Staked Luna never leaves the possession of the delegator. Even though it canโt be traded freely, staked Luna is never owned by a validator. For more information, visit the Validator FAQ
:::
Phases of Luna
To start receiving rewards, delegators bond their Luna to a validator. The bonding process adds a delegator's Luna to a validator's stake, which helps validators to participate in consensus.
Luna exists in the following three phrases:
- Unbonded: Luna that can be freely traded and is not staked to a validator.
- Bonded: Luna that is staked to a validator. Bonded Luna accrues staking rewards. Although Luna bonded to validators in Terra Station canโt be traded freely, bLuna is a token that represents bonded Luna that can be traded freely or used as collateral on other protocols in the Terra network, such as Anchor and Mirror.
- Unbonding: Luna that is in the process of becoming unbonded from a validator and does not accrue rewards. This process takes 21 days to complete.
Bonding, staking, and delegating
Generally, the terms bonding, staking, and delegating can be used interchangeably, as they happen in the same step. A delegator delegates Luna to a validator, the Luna gets bonded to the validator, and the bonded Luna gets added to the validator's stake.
Delegators can bond Luna to any validator in the active set using the delegate function in Terra Station. Delegators start earning staking rewards the moment they bond or stake to a validator.
Unbonding
Delegators can unbond or unstake their Luna using the undelegate function in Terra Station. The unbonding process takes 21 days to complete. During this period, the unbonding Luna can't be traded, and no staking rewards accrue.
::: warning Warning
Once started, the delegating or undelegating processes can't be stopped.
Undelegating takes 21 days to complete. The only way to undo a delegating or undelegating transaction is to wait for the unbonding process to pass. Alternatively, you can redelegate staked Luna to a different validator without waiting 21 days.
:::
The 21-day unbonding process helps the long-term stability of the Terra protocol. The unbonding period discourages volatility by locking staked Luna in the system for at least 21 days. In exchange, delegators receive staking rewards, further incentivizing network stability.
Redelegation
Redelegating instantly sends staked Luna from one validator to another. Instead of waiting for the 21-day unstaking period, a user can redelegate their staked Luna at any time using Terra Station's redelegate function. Validators receiving redelegations are barred from further redelegating any amount of Luna to any validator for 21 days.
::: warning Warning
When a user redelegates staked Luna from one validator to another, the validator receiving the staked Luna is barred from making further redelegation transactions for 21 days. This requirement only applies to the wallet that made the redelegation transaction.
:::
Rewards
The Terra protocol incentivizes validators and delegators with staking rewards. Staking rewards come from three sources: gas, stability fees, and swap fees.
Gas: Compute fees added on to each transaction to avoid spamming. Validators set minimum gas prices and reject transactions that have implied gas prices below this threshold.
Stability fees: Fees added to any Terra stablecoin transaction, excluding market swaps, to provide stability in the market. Fees are capped at 1SDT. The fee rate, called the tax rate, is variable.
Swap fees: The fee for swapping Terra stablecoin denominations is called a Tobin tax. Exchanges between Terra and Luna are subject to a spread fee.
For more information on fees, visit the fee page.
At the end of every block, all transaction fees are distributed to each validator and their delegators proportional to their staked amount. Validators can keep a portion of rewards to pay for their services. This portion is called commission. The rest of the rewards are distributed to delegators according to their staked amounts.
Staking rewards also play a key role in the stability of the Terra protocol. During periods of volatility, the Terra protocol modulates tax rates to maintain a stable mining incentive. This mechanism is described in detail in the treasury module. Steady rewards regardless of market volatility ensure steady demand for staking. Staking locks value in the system, ensuring long- and short-term stability for the price of Terra.
Slashing
Running a validator is a big responsibility. Validators must meet strict standards and constantly monitor and participate in the consensus process. Slashing is the penalty for misbehaving validators. When a validator gets slashed, they lose a small portion of their stake as well as a small portion of their delegator's stake. Slashed validators also get jailed, or excluded, from consensus for a period of time.
::: danger The risks of staking
Slashing affects validators and delegators. When a validator gets slashed, delegators who stake to that validator also get slashed. Slashing is proportional to a delegator's staked amount. Though slashing is rare and usually results in a small penalty, it does occur. Delegators should monitor their validators closely, do their research, and understand the risks of staking Luna.
:::
Slashing occurs under the following conditions:
- Double signing: When a validator signs two different blocks with the same chain ID at the same height.
- Downtime: When a validator is unresponsive or can't be reached for a period of time.
- Missed votes: When a validator misses votes in consensus or fails to vote correctly in the oracle process.
Validators monitor each other closely and can submit evidence of misbehavior. Once discovered, the misbehaving validator will have a small portion of their funds slashed. Offending validators will also be jailed or excluded from consensus for a period of time. Even simple issues such as malfunctions or downtimes from upgrading can lead to slashing.
For more information on slashing, visit the slashing module.
Governance
The Terra protocol is a decentralized public blockchain governed by community members. Governance is the democratic process that allows users and validators to make changes to the Terra protocol. Community members submit, vote, and implement proposals.
Proposals
Proposals start as ideas within the community. A community member drafts and submits a proposal alongside an initial deposit.
The most common proposal types include:
ParameterChangeProposal: To change the parameters defined in each module.TaxRateUpdateProposal: To update tax rate monetary policy lever.RewardWeightUpdateProposal: To update the reward weight monetary policy leverCommunityPoolSpendProposal: To spend funds in the community pool
Other issues like large directional changes or any decision requiring manual implementation are submitted as a TextProposal.
Voting process
Community members vote with their staked Luna. One staked Luna equals one vote. If a user fails to specify a vote, their vote defaults to the validator they are staked to. Validators vote with their entire stake unless specified by delegators. For this reason, it is very important that each delegator votes according to their preferences.
The following is a basic outline of the governance process. Visit the governance module for more details.
- A user submits a proposal and a two-week deposit period begins.
- Users deposit Luna as collateral to back the proposal. This period ends once a minimum threshold of 50 Luna is deposited. Deposits are to protect against spam.
- The one-week vote period begins.
The voting options are:Yes: In favor.No: Not in favor.NoWithVeto: Not in favor, the deposit should be burned.Abstain: Voter abstains.
- The votes are tallied.
Proposals pass if they meet three conditions:Quorumis met: at least 40% of all staked Luna must vote.- The total number of
NoWithVetovotes is less than 33.4% of the total vote. - The number of
Yesvotes reaches a 50% majority.
If the previous conditions are not met, the proposal is rejected.
- Accepted proposals get put into effect.
- Deposits get refunded or burned.
Once accepted, the changes described in a governance proposal are automatically put into effect by the proposal handler. Generic proposals, such as a passed TextProposal, must be reviewed by the Terra team and community, and they must be manually implemented.
Deposits
Deposits protect against unnecessary proposals and spam. Users can veto any proposal they deem to be spam by voting NoWithVeto.
Deposits get refunded if all of the following conditions are met:
- The minimum deposit of 50 Luna is reached within the two-week deposit period.
Quorumis met: the number of total votes is greater than 40% of all staked Luna- The total number of
NoWithVetovotes is less than 33.4% of the total vote. - A vote returns a majority of
YesorNovotes.
Deposits are burned under any of the following conditions:
- The minimum deposit of 50 Luna is not reached within the two-week deposit period.
Quorumis not met: the number of total votes after the one-week voting period is less than 40% of all staked Luna.- the number of
NoWithVetovotes is above 33.4% of the total vote.
File: docs/Concepts/README.md
Concepts
Learn more about Terra and Luna, how the protocol works, validators, staking, and governance by exploring the concepts explained in this section. Use the glossary to learn more about specific terms.
File: docs/Concepts/Smart-contracts.md
Smart contracts
A smart contract is a contract whose terms are expressed as a computer program with logic and state persisted on the blockchain. Smart contracts can automatically carry out its terms and conditions with total transparency and no counter-party risk.
Smart contracts allow users to extend the capabilities of the Terra blockchain by introducing custom logic that can be composed against the Terra blockchain's financial primitives such as its stablecoin available in any world currency, robust oracle price feed, and on-chain atomic swap. These decentralized applications unlock new avenues of value-transfer through enabling unique transaction flows not provided by Terra's native modules.
Developer tools
The following table maps commonly-used Ethereum developer tools to their Terra counterparts.
| Terra | Ethereum | |
|---|---|---|
| Frontend SDK | Terra.js, Terra SDK | Web3.js, Web3py |
| Browser Extension | Station CX | MetaMask, MEW |
| Local Testnet | LocalTerra | Ganache |
| Contract Language | Rust | Solidity, Vyper |
| Contract Toolchain | Houston | Truffle |
Why build on Terra?
Robust consensus and fast block finality
Terra is powered by Tendermint BFT consensus, using a dPoS-like scheme driven by a set of 100 top validators. This efficient consensus model enables batches of transactions to occur in only 6 seconds (only a fraction of the time it takes for Bitcoin and Ethereum).
Ready for DeFi applications
With fundamental infrastructure such as price oracles, on-chain swaps, stablecoin assets in a variety of denominations, community governance and automated monetary and fiscal policy, the Terra blockchain acts as its own autonomous sovereign economy driven by its users, and provides all the necessary incentive mechanics and modular plumbing to power modern DeFi smart contracts.
Growing, active user base with real-world usage
With over 1.5 million total users and a highly active user base from a variety of integrations (like Terra-powered payment gateways such as CHAI and MemePay), the Terra economy is a thriving new home for the future of innovative DeFi products. And unlike many other stablecoin protocols, Terra stablecoins are directly integrated in payments solutions where they are used everyday purchases such as groceries, movie tickets, taxis, and more.
File: docs/How-to/Manage-a-Terra-validator/Court-delegations.md
Court delegations
Consider the following options to help improve your visibility and make yourself known to potential delegators.
Set up a website
Set up a website so that your delegators can find you. We recommend making a custom section for Terra delegators that instructs how to delegate Luna tokens.
Announce yourself on Discord
Join the Terra Validators Discord channel, and introduce yourself.
Submit a validator profile
Submit a Validator Profile to make it official.
Put a thumbnail on Terra Station
Create a Keybase Account follow the Keybase instructions to set up a PGP key, and upload a profile picture.
For best continuity use the same GitHub account to verify your Keybase, and your Validator Profile
Now link your Keybase profile to your validator. Open your validator terminal and execute this command:
terrad tx staking edit-validator \
--identity="keybase identity"File: docs/How-to/Manage-a-Terra-validator/faq.md
Validator FAQ
::: warning Recommendation
Please read this document thoroughly before becoming a validator.
:::
General Concepts
What is a validator?
The Terra Core is powered by the Tendermint consensus. Validators run full nodes, participate in consensus by broadcasting votes, commit new blocks to the blockchain, and participate in governance of the blockchain. Validators are able to cast votes on behalf of their delegators. A validator's voting power is weighted according to their total stake.
What is a full node?
A full node is a program that validates the transactions and blocks of a blockchain. Validators must run full nodes. Full nodes require more resources than light nodes, which only processes block headers and a small subset of transactions. Running a full node means you are running a non-compromised and up-to-date version of the Terra Core software with low network latency and no downtime.
It is possible and encouraged for any user to run full nodes even if they do not plan to be validators.
What is staking?
When Luna holders delegate their Luna to a validator, they are staking. Staking increases a validator's weight, which helps them, and in return delegators get rewarded.
The Columbus-5 Mainnet is a public Proof of Stake (PoS) blockchain. This means a validator's weight (total stake) is determined by the amount of staking tokens (Luna) they delegate to themselves plus the Luna bonded to them by external delegators. The weight of a validator determines whether or not they are an active validator and how frequently they can propose a block. Validators with a higher weight will propose more blocks, and in turn make more revenue.
The active validator set is made up of 130 validators, who hold the most Luna. The bottom validatorโs stake always forms the barrier for entry into the network. Creating a validator with more stake than the bottom validator is the only way to enter the active set. If validators double-sign, or are frequently offline, they risk their staked Luna, including Luna delegated by users, being slashed by the protocol to penalize negligence and misbehavior.
What is a delegator?
Delegators are Luna holders who want to receive staking rewards without the responsibility of running a validator. Through Terra Station, a user can delegate Luna to a validator and in exchange receive a part of a validator's revenue. For more detail on how revenue is distributed, see What are the incentives to stake? and What is a validator's commission?.
Delegators share the benefits and rewards of staking with their Validator. If a Validator is successful, its delegators will consistently share in the rewards structure. If a Validator is slashed, the delegatorโs stake will also be slashed. This is why delegators should perform due-diligence on validators before delegating. Delegators can also diversify by spreading their stake over multiple validators.
Delegators play a critical role in the system, as they are responsible for choosing validators. Being a delegator is not a passive role. Delegators should remain vigilant, actively monitor the actions of their validators, and re-delegate whenever they feel their current validator does not meet their needs.
Becoming a Validator
How do I become a validator?
Any participant in the network can signal their intent to become a validator by creating a validator and registering its validator profile. The candidate then broadcasts a create-validator transaction, which contains the following data:
PubKey: Validator operators can have different accounts for validating and holding liquid funds. The PubKey submitted must be associated with the private key the validator will use to sign prevotes and precommits.
Address: A
terravaloper-address. This is the address used to identify your validator publicly. The private key associated with this address is used to bond, unbond, and claim rewards.Name (also known as the moniker)
Website (optional but recommended)
Description (optional but recommended)
Initial commission rate: The commission rate on block provisions, block rewards and fees charged to delegators.
Maximum commission: The maximum commission rate which the validator will be allowed to charge. (This cannot be changed)
Commission change rate: The maximum daily increase of the validator's commission.(This cannot be changed)
Minimum self-bond amount: The minimum amount of bonded Luna the validator needs at all times. If the validator's self-bonded stake falls below this limit, its entire staking pool will be unbonded.
Initial self-bond amount: The initial amount of Luna the validator self-bonds.
Example:
terrad tx staking create-validator
--pubkey terravalconspub1zcjduepqs5s0vddx5m65h5ntjzwd0x8g3245rgrytpds4ds7vdtlwx06mcesmnkzly
--amount "2uluna"
--from tmp
--commission-rate="0.20"
--commission-max-rate="1.00"
--commission-max-change-rate="0.01"
--min-self-delegation "1"
--moniker "gazua"
--chain-id "test-chain-uEe0bV"
--gas auto
--node tcp://127.0.0.1:26647Once a validator is created and registered, Luna holders can delegate Luna to them, effectively adding stake to its pool. The total stake of a validator is the total of their self-bonded Luna plus the Luna bonded by external delegators.
Only the top 130 validators are considered active or bonded validators. If a validator's total stake dips below the top 130, the validator loses its validator privileges and no longer serves as part of the active set, entering into unbonding mode and eventually becoming unbonded, or inactive.
Validator keys and states
What are the different types of keys?
There are two types of keys:
Tendermint Key: A unique key used to sign block hashes associated with a public key
terravalconspub.This Key is generated when a node is created with
terrad init.Use
terrad tendermint show-validatorto see a keyExample:
terravalconspub1zcjduc3qcyj09qc03elte23zwshdx92jm6ce88fgc90rtqhjx8v0608qh5ssp0w94c
Application Keys: These keys are created from an application and are used to sign transactions. As a validator, you will probably use one key to sign staking-related transactions and another key to sign oracle-related transactions. Application keys are associated with a public key
terrapub-and an addressterra-. Both are derived from account keys generated byterrad keys add.
::: warning Warning
A validator's operator key is directly tied to an application key, but uses reserved prefixes solely for this purpose: terravaloper and terravaloperpub
:::
What are the different states a validator can be in?
After a validator is created with the create-validator transaction, it can be in three states:
bonded: A validator that is in the active set and participates in consensus. This validator is earning rewards and can be slashed for misbehavior.unbonding: A validator that is not in the active set and can't not participate in consensus. This validator is not earning rewards but can still be slashed for misbehaviour. This is a transition state frombondedtounbonded. If a validator does not send arebondtransaction while inunbondingmode, it will take three weeks for the state transition to complete.unbonded: A validator that is not in the active set and not signing blocks. Unbonded validators can't be slashed and can't earn any rewards from their operation. It is still possible to delegate Luna to unbonded validators. Un-delegating from anunbondedvalidator is immediate.
All Delegators have the same state as their validator.
Delegations are not necessarily bonded. Luna can be delegated and bonded, delegated and unbonding, delegated and unbonded, or liquid.
What is "self-bonding"? How can I increase my "self-bond"?
A validator operator's "self-bond" refers to the amount of Luna delegated to itself. You can increase your self-bond by delegating more Luna to your validator account.
Can I delegate to a validator outside of the active set?
You can still delegate to a validator even if they do not appear on Terra Station. Simply add the terravaloper address of your desired validator to the end of the following URL:
https://station.terra.money/validator/<terravaloper-address>
Ask your validator for their terravaloper address.
Be careful when delegating to validators outside of the active set. Some inactive validators may be jailed or are no longer supported. Station only displays active or recently active validators who are able to participate in consensus.
Is there a faucet?
Use the Terra faucet to obtain coins for the testnet.
Is there a minimum amount of Luna that must be staked to be an active (bonded) validator?
There is no set minimum. The top 130 validators with the highest total stake (where total stake = self-bonded stake + delegated stake) make up the active validator set. The bottom 130th validator sets the barrier to entry for the active set.
How will delegators choose their validators?
Delegators are free to choose validators according to their own criteria. This may include:
Amount of self-bonded Luna: The amount of Luna a validator self-bonds to its staking pool. A validator with a higher amount of self-bonded Luna has more skin in the game, making it more liable for its actions.
Amount of delegated Luna: The total amount of Luna delegated to a validator. A high stake shows that the community trusts this validator; however, this also means that a validator is a bigger target for hackers. Large stakes provide large voting power. This weakens the network. At any given time, if 33% or more of staked luna becomes inaccessible, the network will halt. Through incentives and education, we can prevent this by delegating away from validators that have too much voting power. Validators sometimes become less attractive as their amount of delegated Luna grows.
Commission rate: The commission applied to rewards by a validator before being distributed to its delegators.
Track record: Delegators can look at the track record of a validator they plan to delegate to. This includes seniority, past votes on proposals, historical average uptime, and how often the node was compromised.
Validators can also provide a website address to complete their resume. Validators need to build a good reputation to attract delegators. It's good practice for validators to have their setup audited by third parties. Please note that the Terra team will not approve or conduct any audits.
Responsibilities
Do validators need to be publicly identified?
No, they do not. Each delegator will value validators based on their own criteria. Validators are typically advised to register a website address when they nominate themselves so they can advertise their operation as they see fit.
What are the responsibilities of a validator?
A validator must:
Run the correct software versions: Validators need to make sure that their servers are always online, and that their private keys are not compromised.
Actively participate in price discovery and stabilization: Validators are highly incentivized to submit honest and correct votes of the real market prices of Luna. Validators are also encouraged to engage in arbitrage swaps that stabilize the prices of Terra stablecoins.
Provide oversight and feedback on the correct deployment of community pool funds: The Terra protocol includes a governance system for proposals to facilitate the adoption of its currencies. Validators are expected to hold budget executors to provide transparency and to use funds efficiently.
Be active members of the community: Validators should always be up-to-date with the current state of the ecosystem so that they can easily adapt to any change.
What does staking imply?
Think of staked Luna as a safety deposit on a validator's activities. When a validator or a delegator wants to retrieve part or all of their deposit, they send an unbonding transaction. The staked Luna then undergoes a three weeks unbonding period, during which it is vulnerable to slashing risks for potential misbehavior committed by the validator before the start of the unbonding process.
Validators receive block provisions, block rewards, and fee rewards and share these with their delegators. If a validator misbehaves, a certain portion of their total stake is slashed (the severity of the penalty depends on the type of misbehavior). This means that every user that bonds Luna to a slashed validator gets penalized in proportion to their stake. Delegators are incentivized to delegate to validators that function safely.
Can a validator run away with a delegators' Luna?
No. By delegating to a validator, users delegate staking power. The more staking power a validator has, the more weight it has in the consensus and processes. This does not mean that the validator has custody of its delegators' Luna.
::: warning Warning
It is impossible for a validator to run away with a delegator's funds.
:::
Although delegated funds cannot be stolen by validators, delegators are still liable if a validator misbehaves. When this happens, a delegator's stake will be partially slashed in proportion to their relative stake.
How often will a validator be chosen to propose the next block? Does it go up with the quantity of Luna staked?
The validator that is selected to mine the next block is called the proposer, or the "leader" in the consensus for the round. Each proposer is selected deterministically, and the frequency of being chosen is equal to the relative total stake of the validator (Total stake = self-bonded stake + delegators stake). For example, if the total bonded stake across all validators is 100 Luna, and a validator's total stake is 10 Luna, then this validator will be chosen 10% of the time as the proposer.
To understand more about the proposer selection process in Tendermint BFT consensus, read more in their official docs.
Incentives
What are the incentives to stake?
Each member of a validator's staking pool earns different types of revenue:
Compute fees (gas): To prevent spamming, validators can set minimum gas fees for transactions to be included in their mempool. At the end of every block, compute fees are disbursed to the participating validators proportional to their stake.
Stability fees: To stabilize the value of Luna, the protocol charges a small fee ranging from 0.1% to 1% on every Terra transaction, capped at 1 TerraSDR. This is paid in any Terra currency, and is disbursed proportional to each validators' stake at the end of every block in TerraSDR.
This total revenue is divided among a validator's staking pool according to each validator's weight. The revenue is then divided among delegators in proportion to each delegator's stake. Note that a commission on delegators' revenue is applied by the validator before it is distributed.
- Swap fees: A small spread is charged on market swap transactions between Luna and any Terra currency, which is then used to reward validators that faithfully report oracle exchange rates. The fee for swaps between different Terra stablecoins is called the Tobin tax.
What is the incentive to run a validator?
Validators earn more revenue than their delegators through commission. They also play a major role in determining on-chain exchange rates through the Oracle, where they get rewarded for faithfully reporting exchange rates with swap fees.
What is a validator's commission?
The revenue received by a validator's pool is split between a validator and their delegators. A validator can apply a commission on the part of the revenue that goes to its delegators. This commission is set as a percentage. Each validator is free to set its initial commission, maximum daily commission change rate, and maximum commission. The mainnet enforces the parameters that each validator sets. These parameters can only be defined when initially declaring candidacy, and may only be constrained further after being declared.
How are block provisions distributed?
Block provisions are distributed proportionally to each validator relative to their total stake. This means that even though each validator gains TerraSDR (SDT) with each provision, all validators will still maintain equal weight.
Example: Take 10 validators with equal staking power and a commission rate of 1%. The block provision is 1000 SDT and each validator has 20% self-bonded Luna. These tokens do not go directly to the proposer. Instead, they are evenly spread among validators. So now each validator's pool has 100 SDT, which is distributed according to each participant's stake:
Commission: 100 SDT ~ * ~ 80% ~ * ~ 1%$ = 0.8 SDT
Each validator gets: 100 SDT ~ * ~ 20% ~ + ~ Commission$ = 20.8 SDT
All delegators get: 100 SDT ~ * ~ 80% ~ - ~ Commission$ = 79.2 SDT
Each delegator can claim its part of the 79.2 SDT in proportion to their stake in the pool. Note that the validator's commission is not applied on block provisions. Block rewards (paid in SDT) are distributed according to the same mechanism.
How are fees distributed?
Fees are distributed to validators in the same way as commission: proportionally to each validator relative to their total stake. A Block proposer can also get a bonus if the proposer includes more than the minimum of required precommits.
Rewards
When a validator is selected to propose the next block, they must include at least two thirds of the precommits for the previous block in the form of validator signatures. Proposers who include more than two thirds receive a bonus proportional to the amount of additional precomits. This reward ranges from 1% if the proposer includes two thirds of the precommits to 5% if the proposer includes 100% of the precommits. If a proposer waits too long however, other validators may timeout and move on to the next proposer. This is why validators have to find a balance between wait time to get the most signatures and the risk of losing out on proposing the next block. This feature aims to incentivize non-empty block proposals, better networking between validators, and to mitigate censorship.
Example: There are 10 validators with equal stake. Each has a 1% commission and 20% self-bonded Luna. If a successful block collects 1005 SDT in fees, and the proposer includes 100% of the signatures in their block, they will receive the full 5% bonus.
We can use a simple equation to find the reward $R$ for each validator:
$$9R ~ + ~ R ~ + ~ 5%(R) ~ = ~ 1005 ~ \Leftrightarrow ~ R ~ = ~ 1005 ~/ ~10.05 ~ = ~ 100$$
For the validator that proposes a block:
- The pool obtains $R ~ + ~ 5%(R)$: 105 SDT
- Commission: 105 SDT ~ * ~ 80% ~ * ~ 1%$ = 0.84 SDT
- Validator's reward: 105 SDT ~ * ~ 20% ~ + ~ Commission$ = 21.84 SDT
- Delegators' rewards: 105 SDT ~ * ~ 80% ~ - ~ Commission$ = 83.16 SDT (each delegator will be able to claim its portion of these rewards in proportion to their stake)
For all other validators:
- The pool obtains $R$: 100 SDT
- Commission: 100 SDT ~ * ~ 80% ~ * ~ 1%$ = 0.8 SDT
- Validator's reward: 100 SDT ~ * ~ 20% ~ + ~ Commission$ = 20.8 SDT
- Delegators' rewards: 100 SDT ~ * ~ 80% ~ - ~ Commission$ = 79.2 SDT (each delegator will be able to claim its portion of these rewards in proportion to their stake)
How does Luna supply behave over time?
Luna is the native staking token for the Terra Proof of Stake chain. Luna represents mining power and serves as collateral for Terra stablecoins. When a Terra stablecoin's price is low, the relevant Terra stablecoin is burned, and Luna is minted. This increases the price of the Terra stablecoin. In order to constrain Luna inflation, the protocol burns all seigniorage and dividends swap fees to the exchange rate oracle ballot winners, which then returns Luna supply towards a target. The Terra Protocol is deflationary in nature.
What are the slashing conditions?
If a validator misbehaves, their bonded stake along with their delegators' stake will be slashed. The severity of the punishment depends on the type of fault. There are 3 main faults that can result in slashing of funds:
Double-signing: If someone reports on chain A that a validator signed two blocks at the same height on chain A and chain B, and if chain A and chain B share a common ancestor, then this validator will get slashed on chain A.
Unavailability: If a validator's signature has not been included in the last X blocks, the validator will get slashed by a marginal amount proportional to X. If X is above a certain limit, then the validator will get unbonded.
Non-voting: If a validator does not vote on a proposal, its stake will receive a minor slash.
:::warning Warning
Even if a validator does not intentionally misbehave, it can still be slashed if its node crashes, loses connectivity, gets DDoSed, or if its private key is compromised.
:::
Are validators required to self-bond Luna?
No, but self-bonding has benefits. A validator's total stake is made up of their self-bonded stake plus their delegated stake. This means that a validator can compensate for low amounts of self-bonded Luna by attracting more delegators. This is why reputation is very important for validators.
Although validators are not required to self-bond Luna, we suggest all validators to have skin-in-the-game. This can help make a validator more trustworthy.
In order for delegators to have some guarantee about how much skin-in-the-game their validator has, validators can signal a minimum amount of self-bonded Luna. If a validator's self-bond goes below the limit that it has predefined, this validator and all of its delegators will unbond.
Technical Requirements
What are the hardware requirements?
We recommend the following for running Terra Core:
- 4 core Compute Optimized CPU
- 16GB RAM (32GB to export genesis)
- 1TB storage (SSD or better)
- At least 100mbps network bandwidth
What are the software requirements?
In addition to running a Terra Core node, validators should develop monitoring, alerting and management solutions.
Validators should expect to perform regular software updates to accommodate upgrades and bug fixes. There will inevitably be issues with the network, and this requires vigilance.
What are the personnel requirements?
A successful validator operation will require the efforts of multiple highly skilled individuals and continuous operational attention. Running a validator is considerably more involved than mining bitcoin.
Running an effective operation is critical to avoiding unexpected unbonding or being slashed. This includes being able to respond to attacks, outages, as well as to maintain security and isolation in your data center.
How can validators protect themselves from Denial-of-Service attacks?
Denial-of-service attacks occur when an attacker sends a flood of internet traffic to a validator's IP address. This can prevent a validator's server from connecting to the internet.
To do this, an attacker scans the network, tries to learn the IP address of various validator nodes, and disconnects them by flooding them with traffic.
One way to mitigate these risks is to carefully structure a validator network with a sentry node architecture.
Validator nodes should only connect to full-nodes they trust. They can be run by the same validator or other validators they know. A validator node will typically run in a data center. Most data centers provide direct links to major cloud providers. A validator can use these links to connect to sentry nodes in the cloud. This shifts the burden of denial-of-service from the validator's node directly to its sentry nodes. This may require new sentry nodes to be spun up or activated to mitigate attacks on existing ones.
Sentry nodes can be quickly spun up or used to change IP addresses. Because links to the sentry nodes are in private IP space, an internet based attack can't disturb them directly. This will ensure a validator's block proposals and votes always make it to the rest of the network.
For more on sentry node architecture, see this.
File: docs/How-to/Manage-a-Terra-validator/Implement-security.md
Implement security practices
Each validator candidate is encouraged to run its operations independently. Diverse individual setups increase the resilience of the network.
Manage digital keys with HSM
Key management is mission critical for validators. If an attacker gains access to a validator's private key, it puts the validator's entire delegated stake at risk. Hardware security modules are an important strategy for mitigating this risk.
Consider implementing this key-management method by Iqulusion.
Defend against DDoS attacks
Validators are responsible for ensuring that the network can defend against denial of service attacks.
Validators can mitigate these attacks by carefully structuring their network topology in a sentry node architecture.
Validator nodes should only connect to full nodes they trust. They can be run by the same validator or other validators they know. A validator node will typically run in a data center. Most data centers provide direct links to major cloud providers. A validator can use these links to connect to sentry nodes in the cloud. This shifts the burden of denial-of-service from the validator's node directly to its sentry nodes. This may require new sentry nodes to be spun up or activated to mitigate attacks on existing ones.
Sentry nodes can be quickly spun up or used to change IP addresses. Because links to the sentry nodes are in private IP space, an internet based attack can't disturb them directly. This will ensure a validator's block proposals and votes always make it to the rest of the network.
Learn more about sentry-node architecture.
- For validators nodes, edit the
config.toml:
# Comma separated list of nodes to keep persistent connections to
# Do not add private peers to this list if you don't want them advertised
persistent_peers =[list of sentry nodes]
# Set true to enable the peer-exchange reactor
pex = false- For sentry nodes, edit the
config.toml:
# Comma separated list of peer IDs to keep private (will not be gossiped to other peers)
private_peer_ids = "ipaddress of validator nodes"Environment Variables
By default, uppercase environment variables with the following prefixes will replace lowercase command-line flags:
TE(for Terra flags)TM(for Tendermint flags)BC(for democli or basecli flags)
For example, the environment variable TE_CHAIN_ID will map to the command line flag --chain-id. While explicit command-line flags will take precedence over environment variables, environment variables will take precedence over any of your configuration files. For this reason, it is imperative that you lock down your environment so that any critical parameters are defined as flags on the CLI, or that you prevent modification of any environment variables.
File: docs/How-to/Manage-a-Terra-validator/Overview.md
Overview
The tasks in this section describe how to set up a Terra validator. While setting up a rudimentary validating node is easy, running a production-quality validator node with a robust architecture and security features requires an extensive setup.
The Terra core is powered by the Tendermint consensus. Validators run full nodes, participate in consensus by broadcasting votes, commit new blocks to the blockchain, and participate in governance of the blockchain. Validators can cast votes on behalf of their delegators. A validator's voting power is weighted according to their total stake. The top 130 validators make up the Active Validator Set and are the only validators that sign blocks and receive revenue.
Validators and their delegators earn the following fees:
Gas: Fees added on to each transaction to avoid spamming and pay for computing power. Validators set minimum gas prices and reject transactions that have implied gas prices below this threshold.
Stability fees: Fees added on to any Terra stablecoin transaction (excluding market swaps) to provide stability in the market, capped at 1SDT. The fee rate is variable and called the tax rate.
Swap fees: The fee for swapping Terra stablecoin denominations is called a Tobin tax. Exchanges between Terra and Luna are subject to a spread fee.
For more information on fees, visit the fee page.
Validators can set commissions on the fees they receive as an additional incentive.
If validators double sign, are frequently offline, or do not participate in governance, their staked Luna (including Luna of users that delegated to them) can be slashed. Penalties can vary depending on the severity of the violation.
For more general information on validators, visit the validator section of the concepts page.