bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 19쪽 중 10쪽
de has one vote on a Mimir.
2. A node can vote at any time on any key, and can change that vote at any time.
3. A node's vote counts only while that node is active.
4. The number of votes needed depends on the Mimir type, described in [Mimir Types](/technical-documentation/technical-deep-dive/governance#mimir-types).
5. If that count is not reached, the stored value stays as it is. Where no Mimir value is set, the constant applies.
6. A node can delete their vote by using a -1 value. That removes the node's vote and leaves the stored value as it is.
7. Voting costs one native transaction fee, which is deducted from their bond. The fee is taken even when the stored value does not change.
An Operational Mimir vote stays until that node changes it, deletes it with -1, or the active set gains or loses a node. When the active set changes, those votes are deleted and the stored value stays. A churn that does not change the active set leaves the votes in place. An economic vote stays through that change, and it counts only while that node is active.
With `OperationalVotesMin` at 3, three active nodes voting the same value, since the last chrun, set an Operational Mimir.
# Node Operations
Running a THORNode
## Churning
As new nodes join/leave the network, this triggers a “churning event”. Which means the list of validators that can commit blocks to the chain changes, and also creates a new Asgard vault, while retiring an old one. All funds in this retiring vault are moved to the new Asgard vault.
Normally, a churning event happens roughly every 2 1/2 days (43,200 blocks or [`CHURNINTERVAL`](https://gateway.liquify.com/chain/thorchain_api/thorchain/mimir)).
Nodes that targged for the next churn in and out can be seen [here](https://thorchain.network/nodes). The next churn interval can be seen [here](https://thorchain.net/nodes).
### Churning Out
On every churn, the network selects one or more nodes to be churned out of the network (which can be typically churned back in later). In a given churning event, multiple nodes may be selected to be churned out, but never more than 1/3rd of the current validator set. The criterion the network will take into account is the following:
1. Requests to leave the network (self-removal)
2. Banned by other nodes (network-removal)
3. How long an active nodes has been committing blocks (oldest gets removed)
4. Bad behavior (accrued slash points for poor node operation)
5. Nodes that do not meet the minimum version requirement (capped by [`MAXNODETOCHURNOUTFORLOWVERSION`](https://gateway.liquify.com/chain/thorchain_api/thorchain/mimir))
#### Churning In
On every churn, the network may select one or more nodes to be churned into the network but never adds more than one to the total. Which nodes that are selected are purely by validator bond size. Larger bond nodes are selected over lower bond nodes.
## THORNode Details
### **Node Statuses**
Types of node status:
1. **Unknown** - this should never be possible for a valid node account
2. **Whitelisted** - node has been bonded, but hasn’t set their keys yet
3. **Standby** - waiting to have minimum requirements verified to become “ready” status. This check happens on each churn event (3 days on average).
4. **Ready** - node has met minimum requirements to be churned and is ready to do so. Could be selected to churn into the network. Cannot unbond while in this status.
5. **Active** - node is an active participant of the network, by securing funds and committing new blocks to the THORChain blockchain. Cannot unbond while in this status.
6. **Disabled** - node has been disabled by use of LEAVE while in standby, and cannot re-join.
A node can only unbond if they are in the Standby state and not apart of a vault migration during a chrun out. e.g. (their pub key is not a part of a singer membership).
### **Node Accounts**
When you run a THORNode, each THORNode will have its own node account. An example node account looks like this:
```json
{
"node_address": "thor10rgvc7c44mq5vpcq07dx5fg942eykagm9p6gxh",
"status": "Active",
"pub_key_set": {
"secp256k1": "thorpub1addwnpepq2gmjlu6y0whj8gtfnl3ccta66zx3u5p04wdh834e065x4z6qndzsulj5aa",
"ed25519": "thorpub1zcjduepqxg5dfc27l3tw2xrxtw63025gaxwup723y0t7p8w2ww37vqgvyw7q348pxp"
},
"validator_cons_pub_key": "thorcpub1zcjduepqaxvrp5xjrmg65e3a06sdkr5z7y67xdlzyetlx40p857gxw5g4tqs2xdavr",
"peer_id": "16Uiu2HAm5EX9mPRpLgWYg7uH7WgSdBGXvfkXNhuAinCKUh1Agnas",
"active_block_height": 14561460,
"status_since": 14561460,
"node_operator_address": "thor10afkwx5heh26fjwum682neq7wkkre5md0wp8vc",
"total_bond": "96410371093662",
"bond_providers": {
"node_operator_fee": "2000",
"providers": [
{
"bond_address": "thor10afkwx5heh26fjwum682neq7wkkre5md0wp8vc",
"bond": "96410371093662"
}
]
},
"signer_membership": [...pub keys of asgard vault memembership],
"requested_to_leave": false,
"forced_to_leave": false,
"leave_height": 0,
"ip_address": "<redacted>",
"version": "1.134.0",
"slash_points": 659,
"jail": {
"release_height": 17208649,
"reason": "failed to perform keysign"
},
"current_award": "15968622725",
"observe_chains": [...block heights of last observed tx on external chains],
"preflight_status": {
"status": "Ready",
"reason": "OK",
"code": 0
}
}
```
To get node account information, make an HTTP call to your `thornode` port which will look like the following:
```
http://<host>:1317/thorchain/nodeaccount/<node address>
http://<host>:1317/thorchain/nodeaccounts
```
Or use `https://gateway.liquify.com/chain/thorchain_api/thorchain/node/<node address>.`
Most importantly, this will tell you how many slash points the node account has accrued, their status, and the size of their bond (which is in 1e8 notation, 1 Rune == 100000000).
### Make Relay
Make Relay can be used to send messages into the `#mainnet` channel of the Dev Discord. This allows Node Operators to communicate with Discord members without having post as a Discord user, helping to protect their identiy.
Usage: `make relay "{`*`Message you want to send}`*`"`
<figure><img src="https://3337783180-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfvaTNxU33ciP7UstKtwU%2Fuploads%2Fgit-blob-dddc74a879dd8fabff9285c98fc74e5cf1fdac16%2Fimage%20(48).png?alt=media" alt=""><figcaption><p>Example of make relay as seen in Discord</p></figcaption></figure>
### Bond Providers
Bond Providers can contribute to a Node Operator's bond. Node Operators have the option to add and remove bond providers and set a node operator' fee.
See [Bond Providers details](/thornodes/pooled-thornodes)\\
# THORNode Stack
## THORNode Stack
Each THORNode is comprised of 4 major components.
1. **`thornode`** - this is a daemon that runs the THORChain chain itself and a HTTP server, that gives a RESTful API to the chain.
2. **`bifrost`** - this daemon creates connections to remote chains (like Bitcoin, Ethereum, Binance, etc) to both observe activity on those chains (incoming/outgoing transactions), and also sign/broadcast outgoing transactions (moving funds on remote chains).
3. **`gateway`**: THORNode gateway proxy to get a single IP address for multiple deployments.
4. **Full nodes** - for every chain that is supported by the network, each THORNode operator will run their own full node of each chain (Bitcoin, Ethereum, Binance Smart Chain, Avalanche, etc).
THORNode operators may choose to run the following service:
* **`midgard`** - a layer 2 REST API that provides front-end consumers with semi real-time rolled up data and analytics of the THORChain network. Most requests to the network will come through Midgard. The Midgard API keeps the chain itself from fielding large quantities of requests, allowing THORNode to focus on validating and propagating blocks across the network. You can think of it as a “read-only slave” to the chain.
Endpoints can be accessed at [Connecting to THORChain in the developer docs](https://dev.thorchain.org/concepts/connecting-to-thorchain.html).
## THORNode Endpoints
The THORNode daemon contains three endpoints that run on port `1317` or can be access via the public URL <https://gateway.liquify.com/chain/thorchain_api/>.
* **`<tc:1317>/thorchain`**:
* This endpoint deals specifically with THORChain's native modules and functionality. It provides access to THORChain-specific data such as liquidity pools, nodes, and network configurations. This is where you'll find THORChain-specific operations and data that aren't part of the underlying Cosmos SDK but are unique to THORChain. [`thorchain/doc/`](https://gateway.liquify.com/chain/thorchain_api/thorchain/doc/) contains Swagger documentation for the `thorchain` endpont.
* **`<tc:1317>/cosmos`**:
* This endpoint interfaces with the [Cosmos SDK](/technical-documentation/technology/cosmos-sdk). It provides access to Cosmos SDK endpoints that THORChain inherits by being built on the Cosmos SDK. The endpoints are version specific and the CosmosSDK version THORChain uses can be found at [here](https://gitlab.com/thorchain/thornode/-/blob/develop/go.mod?ref_type=heads#L17). Tendermint informaiton can also be accessed via `cosmos/base/tendermint` - [`node_info` example](https://gateway.liquify.com/chain/thorchain_api/cosmos/base/tendermint/v1beta1/node_info).
* **`<tc:1317>/bank`**:
* The `bank` module in Cosmos SDK handles token transfers and balances. The `<tc:1317>/bank` endpoint allows you to interact with accounts, check balances, and transfer assets. See example [here](https://gateway.liquify.com/chain/thorchain_api/bank/balances/thor1dheycdevq39qlkxs2a6wuuzyn4aqxhve4qxtxt).
## THORNode Keys
There are three key-materials on a THORNode.
1. Your operator key, which sends BOND, UNBOND, LEAVE transactions, and you can run this in any THORChain wallet, asgardex, thorswap, vultisig. You can remotely manage your node and this can UNBOND to get funds out if you brick it. If you lose this key you will lose access to your BOND.
2. All key material related to the Cosmos validator, which does not hold funds, and signs off on blocks, as well as posting in messages to the state machine. These messages are gas-free; the state machine actually will give the node address a free gas-unit. If you delete this key you will brick your THORNode, stop sending observations and accrue slashpoints. You will then get churned out 3 days later for bad performance and will probably lose 3 days of rewards. `make relay` also uses it, as it proves it owns the node pubkey when signing.
3. TSS key-material, which does not hold funds, and simply signs TSS. If you delete this key you will accrue [keySignSlashPoints](/thornodes/overview/risks-costs-and-rewards#risk-to-income) and get churned out. This key is encrypted and backed up in the chain itself every 3 days. It is encrypted with point 2, so you should backup point 2. The reason for this is something *really* bad happening on kubernetes that causes TSS key material to be 0'd out globally, which would permanently brick the vaults. this allows the network to reboot by distributing software to THORNode to extract the stored key-material on-chain and decrypt using the mnemonic for each node.
Ensure you back up your node keys so it can be recovered.
* [Backup documentation](/thornodes/managing#backing-up-a-thornode)
* [Node Validator Restore Validator Guide](https://gitlab.com/thorchain/devops/node-launcher/-/blob/master/docs/Restore-Validator-Backup.md)
* [THORNode snapshot Recovery Guide](https://gitlab.com/thorchain/devops/node-launcher/-/blob/master/docs/Thornode-Snapshot-Recovery-and-Storage-Management.md)
See the following references for more information
* [ADR 004: Keyshare Backups](https://gitlab.com/thorchain/thornode/-/blob/develop/docs/architecture/adr-004-keyshare-backups.md)
* [Implementation of Keyshare MR](https://gitlab.com/thorchain/thornode/-/merge_requests/2235/diffs#7944f2a505e9a68da5d0f0ddf05b2b49591bb61b)
* [Implementation of Backup Tools](https://gitlab.com/thorchain/thornode/-/merge_requests/3683/diffs#836efb6e25a091dcb4ff8e1dbb2f0be6a5cbf14c)
It is critical backups are created matinaned, if there are any questions, reach out in the #bare-metal-nodes channel within the Dev Discord.
### Hardforks
Every few years, THORChain conducts a hardfork. During a hardfork, THORChain's data is moved to an archive, and the chain begins running on a new chain ID. This process ensures that the blockchain continues to operate efficiently and scales with the network's growth.
* **Chain ID**: The current `chainid` can be accessed via [`https://gateway.liquify.com/chain/thorchain_rpc/status`](https://gateway.liquify.com/chain/thorchain_rpc/status) or by querying the `<tc:26657>/status` endpoint on a specific node.
**Hardfork History**:
* **ChainId = thorchain**: Blocks 0 - 4,786,559
* **ChainId = thorchain-mainnet-v1**: Blocks 4,786,560 - 17,562,000
* **ChainId = thorchain-1**: Blocks 17,562,001 - Current
To construct the full history of THORChain, data from all three of these chain IDs are required.
#### Full Nodes vs. Archive Nodes:
* **Full Nodes**: Full nodes only store the most recent blocks, including the latest block. They allow participation in the network and provide up-to-date data but do not maintain the complete historical data, this do not chain data form previous chains.
* **Archive Nodes**: Archive nodes store the entire history of the blockchain, including data from all past blocks and hardforks. These nodes are necessary for retrieving historical data and providing a comprehensive view of the blockchain's state over time.
#### Node Requirements:
* **Separate Node for Each Chain ID**: Each Chain ID requires its own node to be run. You cannot run multiple Chain IDs on a single node. To maintain or access the full history of THORChain, separate nodes must be configured for each of the historical chain IDs.
If you require the full archive node dataset, you will need to request it via THORChain's Discord community. Due to bandwidth costs and DDoS concerns, this data cannot be offered publicly.
# Risks, Costs and Rewards
The risks, costs and rewards of running a THORNode
## Risk of Running a Node
Deciding to run a node should be carefully considered and thought through. While the payoffs/rewards can be significant, there can also be an equally significant costs.
### Risks to Bond
To run a node, you must obtain a significant amount of Rune, minimums [apply](#churning-in). This RUNE is sent into the network as “bond” and held as leverage on each node to ensure they behave in the best interest of the network.
Running a malicious node or stealing from the network results in a slashing of this bond. Here are the ways in which a validator’s bond can get slashed.
* **Double Sign** (5% of minimum bond) - if it is observed that a single validator node is committing blocks on multiple chains. To avoid this, never run two nodes with the same node account at the same time.
* **Unauthorised transaction** (1.5x transaction value) - if a node sends funds without authorization, the bond is slashed 1.5x the value of the stolen funds. The slashed bond is dumped into the pool(s) where the funds were stolen and added to the reserve.
* **Loss of Node Operator Key**: The first address to bond to a new node is known as the node operator address. This is the only address that can UNBOND a Node Provider's BOND. If the private key is lost, a Node Operator may lose control of their Node and provided BOND. See [THORNode Keys](/thornodes/overview/thornode-stack#thornode-keys) for more informaiton.
Bond slashing takes directly from the bond and does not affect rewards.
### **Risk to Income**
When a node is active, it earns rewards from the network in RUNE. Sufficient rewards are required to be earned in order for a Validator to be profitable. Running an unreliable node results in rewards being slashed. Here are the ways in which a validator’s rewards can be slashed.
* **Not Observing** (2 slash pts) - if a node does not observe transactions for all chains, while other nodes do, they get slash points added.
* **Not signing a transaction** (600 slash pts) - if a node does not sign an outbound transaction, as requested by the network, they will get slash points added.
* **Fail to keygen** (1 hr of revenue) - When the network attempts to churn, and attempts to create a new Asgard pubkey for the network, and fails to do so due to a specific node(s), they will lose 1 hr of revenue from their bond.
Slash points undo profits made on the network. For every 1 slash point a node receives, they lose 1 block of rewards. Rewards slashing reduces earned rewards and does not affect a validator’s bond.
## Compensation
### Bond Rewards
Node Operators receive rewards if they are bonded and active on the network and are paid out in RUNE. While revenue is generated every block (approximately every 6 seconds) to each operator, those funds are not available immediately. Rewards can be accessed one of two ways:
* Setting a Node Operator fee in basis points, which causes rewards to be paid directly to the Node Operator address after each churn. See [here](/thornodes/joining#node-operator-fee) for details on how to set a Node Operator fee.
* If no Node Operator fee is set, 100% of rewards will be accrued back to the bond after each churn. A Node Operator must then either LEAVE or wait until the node churns out to unbond principal or rewards.
Node Operators earn rewards relative to their bond; the more they bond, the more they earn, up to the effective bond cap (the highest bond of the bottom 2/3rd active nodes). Over time, this incentive increases the median bonded amount, increasing the security of the network and allows the network to grow. [See Keeping Track of Rewards](#keeping-track) below for more details.
Rewards are affected by the [Emission Schedule](/technical-documentation/technical-deep-dive/economic-model) and the [Incentive Pendulum](/technical-documentation/technical-deep-dive/economic-model). Over time, the Emission Schedule decreases the amount of RUNE allocated to nodes. The Incentive Pendulum increases and decreases the amount of RUNE allocated to nodes according to the security and capital efficiency of the network.
#### Keeping Track
When a node joins the network the current block height is recorded. The system creates one block unit for every active node for every active block, and has a running total of the block units created. When a node leaves, it cashes in its block units for a portion of the bond rewards. The spent block units are destroyed.
For example, there are 10,000 RUNE in bond rewards outstanding. Node A has been active for 30 blocks, and has 33 block units, but accrued 3 slash points. There are 1000 block units in total. Node A leaves the network and cashes in its 30 block units (33 - 3). It receives 300 RUNE ((30/1000) \* 10000), leaving 9700 RUNE in node rewards. Its 33 block units are destroyed, leaving 967 block units left.
### Income
Income for one node can be estimated based on a few inputs:
* Number of active nodes
* Reward emission rate
* % of rewards allocated to nodes, set by the Incentive Pendulum
* Price of RUNE\*
These inputs should be plugged into the following formula:
$$
\frac{RewardAllocation \times EmissionRate}{NumberOfNodes}
$$
An example with mainnet day 1 inputs:
* 33 nodes
* 3.06 million RUNE rewards emitted per month
* 67% of rewards allocated to nodes (stable Incentive Pendulum)
$$
\frac{0.67 ∗ 3060000}{33} = 62,127
$$
## Costs
Depending on how the node was set up, it will likely cost between $2,000 and $3,500 per month using a hosting provider, potentially more as the blockchain scales and more chain integrations are added.
If using a [bare metal set up](https://medium.com/@Runetard/bare-metal-node-n00b-guide-a29c5c067b4a) there will be an up front hardware cost and then electricity costs on going.
The main driver of costs is resource allocation to hosting th프로젝트로 돌아가기