Technical
Templates
Here's an example that produces content for a genesis.json
file that can be used to spin up a new chain. It described a simple setup wherein 2 global and 2 are selected in each round and each is responsible for producing 3 consecutive blocks. The selection of GVs is based on the proportional distribution of delegate votes. This example has one "pinned" validator that's always picked, and the other is randomly selected from delegates whose weighted rank falls in the top 100.
In order to be eligible, validators must register and stake at least 5000 FIRE
for 1 Epoch (5,184,000 blocks โ 3 months) to become bonded.
This is a complete example, meaning you can use it to spin up a node.
const genesisConfig = {
// Feature Flags
"UpgradeCfg": {
"Level": "latest"
},
// Governance
"GovernanceInfo": {
"ConsensusGroupInfoMap": {
// Groups:
// - Global Block Producers
"00000000000000000001": {
// Number of validators active at a time
"NodeCount": 2,
// Target block time (in seconds)
"Interval": 1,
// Number of consecutive blocks to be produced by a validator
"PerCount": 3,
// Number of randomly selected candidates
"RandCount": 1,
// Maximum rank of randomly selected candidates
"RandRank": 100,
// Number of rounds until re-election of validators
"Repeat": 1,
// Pre-flight Validation Level
// - 0: Full (address + nonce) - default
// - 1: Address (address only) - faster, but more prone to collisions and replays
"CheckLevel": 0,
// Token used for voting
"CountingTokenId": "t4649524520544f4b454e8eb5",
// Registration Conditions
// - 1: Must meet staking requirements
// - 2: Must be a registered validator
"RegisterConditionId": 1,
"RegisterConditionParam": {
// Token used for staking
"StakeToken": "t4649524520544f4b454e8eb5",
// Minimum stake amount
"StakeAmount": 5000000000000000000000,
// Minimum stake duration (in blocks โ seconds)
"StakeHeight": 5184000
},
// Voting Conditions
"VoteConditionId": 1,
"VoteConditionParam": {}
},
// - Account Block Producers
"00000000000000000002": {
"NodeCount": 2,
"Interval": 3,
"PerCount": 1,
"RandCount": 2,
"RandRank": 100,
"Repeat": 48,
"CheckLevel": 0,
"CountingTokenId": "t4649524520544f4b454e8eb5",
"RegisterConditionId": 1,
"RegisterConditionParam": {
"StakeAmount": 5000000000000000000000,
"StakeToken": "t4649524520544f4b454e8eb5",
"StakeHeight": 5184000
},
"VoteConditionId": 1,
"VoteConditionParam": {}
}
},
// Registered Validators
"RegistrationInfoMap": {
"00000000000000000001": {
// Node ID => Validator Info
"uno": {
// Address from which blocks are produced
"NodeAddr": "fx67244b1e041242740976fe55780fd587b7ab21469dcc763dc2",
// Address used for staking
"StakeAddr": "fx67244b1e041242740976fe55780fd587b7ab21469dcc763dc2",
// Amount staked
"Amount": 1000000000000000000000000,
// Staking duration (in blocks โ seconds)
"WithdrawHeight": 5184000,
// Block rewards are claimable after N blocks (1 = next block)
"RewardTime": 1,
// Block height at which the group was dissolved (0 = still active)
"RevokeTime": 0,
// Array of all producer addresses ever registered by this validator
"Members": [
"fx67244b1e041242740976fe55780fd587b7ab21469dcc763dc2"
]
},
// Validator 2
"dos": {
"NodeAddr": "fx73d4a2a3667231950206bf79fe8be10fda4e3341d626ed42ac",
"StakeAddr": "fx73d4a2a3667231950206bf79fe8be10fda4e3341d626ed42ac",
"Amount": 1000000000000000000000000,
"WithdrawHeight": 5184000,
"RewardTime": 1,
"RevokeTime": 0,
"Members": [
"fx73d4a2a3667231950206bf79fe8be10fda4e3341d626ed42ac"
]
}
}
},
// Election Results
"VoteStatusMap": {
// Group ID => Results
"00000000000000000001": {
// Voter address => Validator ID
"fx0cb9a65cff58bea9215d778bcdd178146610c2a3de9281642b": "uno",
"fxc63501234bbd65d8ad2b73316f632c1c9405dd056494b74918": "dos"
}
}
},
// Assets
"AssetInfo": {
"TokenInfoMap": {
// Token ID => Token Info
"t4649524520544f4b454e8eb5": {
// Name
"TokenName": "Firechain Token",
// Symbol
"TokenSymbol": "FIRE",
// Total supply (in base units)
"TotalSupply": 1000000000000000000000000000,
// Decimals
"Decimals": 18,
// Token owner/creator
"Owner": "fx0cb9a65cff58bea9215d778bcdd178146610c2a3de9281642b",
// Maximum supply (in base units)
"MaxSupply": 100000000000000000000000000000,
// Burning restricted? (true = only creator can burn)
"BurnRestricted": false,
// Mintable? (true = supply is not fixed)
"IsMintable": true
}
}
},
// Heat-related Staking
"HeatInfo": {
// Beneficiaries
"StakeBeneficialMap": {
// Address => Total Committed (Self-Staked + Delegated)
"fx0cb9a65cff58bea9215d778bcdd178146610c2a3de9281642b": 1000000000000000000000,
"fx73d4a2a3667231950206bf79fe8be10fda4e3341d626ed42ac": 1000000000000000000000,
"fx67244b1e041242740976fe55780fd587b7ab21469dcc763dc2": 500000000000000000000
},
// Stakeholders
"StakeInfoMap": {
// Staker => [Stake Info]
"fx0cb9a65cff58bea9215d778bcdd178146610c2a3de9281642b": [
{
// Amount staked
"Amount": 1000000000000000000000,
// Staking duration (in blocks โ seconds, min = 600)
"WithdrawHeight": 86400,
// Beneficiary of heat capacity (can be different from staker)
"BeneficialAddr": "fx0cb9a65cff58bea9215d778bcdd178146610c2a3de9281642b"
}
],
"fx73d4a2a3667231950206bf79fe8be10fda4e3341d626ed42ac": [
{
"Amount": 1000000000000000000000,
"WithdrawHeight": 86400,
"BeneficialAddr": "fx73d4a2a3667231950206bf79fe8be10fda4e3341d626ed42ac"
},
{
"Amount": 500000000000000000000,
"WithdrawHeight": 86400,
"BeneficialAddr": "fx67244b1e041242740976fe55780fd587b7ab21469dcc763dc2"
}
]
}
},
// Initial Account States
"AccountBalanceMap": {
// Address => Balances
"fx0cb9a65cff58bea9215d778bcdd178146610c2a3de9281642b": {
// Token ID => Balance
"t4649524520544f4b454e8eb5": 100000000000000000000
},
"fx67244b1e041242740976fe55780fd587b7ab21469dcc763dc2": {
"t4649524520544f4b454e8eb5": 100000000000000000000
}
}
};
console.log(JSON.stringify(genesisConfig, null, 2));
:::info This document explains the high-level concepts involved with running validators, including staking requirements, election criteria, and incentives. Definitions of Terms: Staking: Locking an amount of FIRE of the account for certain purpose. In this document, this is GV registration. One Round: A time period lasting exactly 75 seconds. One Cycle: Exactly 1,152 rounds, which is approximately one day. Staking Address: The candidate's registered and bonded address. Block Creation Address: The candidate's block signing address.
Apr 17, 2023Overview Firechain uses a protocol-based voting mechanism for governance. There are two voting categories: global voting and delegated voting. The weighting of an account's vote is based on the amount of $FIRE held at the time of the vote, and weighting is applied to all elections for members of the global consensus group. Delegated voting is a more involved form of governance that's designed for use by smart contracts. For example, when a contract is deployed, it can designate a certain token whose holders can elect one or more specific nodes, or a specific consensus group, to process and validate the contract's responses. In addition to the "sealing" of account-level transactions through reference in global blocks, the global consensus group are responsible for performing breaking upgrades at the global level of the Firechain network. :::info Definitions: Super nodes are members of the global consensus group which are responsible for producing global blocks. Delegate nodes are part of a delegated consensus group and are tasked with producing blocks for delegated accounts (e.g. contracts and EOAs that opt-in).
Jan 2, 2023Firechain.js is a JavaScript library for interacting with the Firechain network. It provides a set of simple APIs for things like sending transactions, querying the state of the blockchain, and deploying smart contracts, as well as a set of utility functions for encoding and decoding data. It also provides a set of networking modules for connecting to Firechain nodes. Firechain.js is available as an ES6 module and can be used in both Node.js and the browser. Installation Firechain.js is available as an npm package. We recommend using yarn to install it. yarn add @firechain/firechainjs yarn add @firechain/firechainjs-ws
Dec 9, 2022The Firechain Network is a shared resource. It is a public good that is available to all users. In order to ensure that the network is available to all users, Firechain uses a dynamic resource sharing mechanism called Heat. It's a measure of the amount of demand that an account has placed on the network recently. Accounts generate heat when they interact with the network, and that heat dissipates over time automatically. The easiest way to think about Heat is as a form of congestion control which ensures that the network remains useful to the most inclusive group of users possible by way of limiting the load that any one account can put on the network. Understanding Heat Most blockchains require accounts to pay some sort of fee in order to transact over the network, primarily to prevent spam and misuse of the network's resources. Firechain does not use transaction fees. Instead, we developed the concept of heat which enables the network to operate without economic barriers that can be untenable for a large percentage of the population. To obtain heat capacity, you can: Stake FIRE (staking ~268 FIRE grants about 1 transaction per minute); or Produce a PoW solution to generate transient heat capacity when you need it.
Nov 28, 2022or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up