
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
flare-stake-tool-test
Advanced tools
The repo contains a cli app for adding (staking) FTSO validators on Flare and Coston2 networks. FTSO validators are data providers for Flare Time Series Oracles (FTSO) on respective networks. By submitting price signals and competing for the reward they earn a certain weight, which allows them to add their validator node for a limited time with exactly the earned weight. Adding a validator node is equivalent to opening a staking session for the prescribed duration with a staking amount equal to the prescribed weight, earned by the data providing activity. The amount (weight) is between 1 and 10000 FLR (or C2FLR). A validator can get (or calculate) their staking amount on this repository.
Installation of the cli app is done by running
npm install @flarenetwork/flare-stake-tool --global
Or, for development purposes, you can first clone the repo with
git clone https://github.com/flare-foundation/p-chain-staking-code.git
and then set up the app with
yarn
yarn build
npm link
Flare has three chains - X-chain (exchange chain), C-chain (contract chain), and P-chain (platform chain). For stake flow, we use C-chain and P-chain. An account on each chain is defined by a public-private key pair. The addresses on each of the two chains are derived from the public key. Note that each chain has different address representations. On the P-chain there is no standard format and usually Bech32 format is used, while on the C-chain the usual Ethereum format is used (to comply with Ethereum Virtual Machine).
A usual stake flow works as follows.
duration and amount from his account (defined by the private key).duration) ends, the validator is automatically removed (staking is finished).To use the flare-stake-tool cli app, one has to first obtain a private key (either a length 64 hexadecimal or cb58 format) and paste it into .env
file (make sure that you run the app on a secure machine), that has the following format
PRIVATE_KEY_HEX = ""
PRIVATE_KEY_CB58 = ""
The app is stateless and requires users to provide a path to their .env file,
which has to be passed to a global option --env-path. Another global option is --network,
which can be set to either flare or costwo (default is flare).
To obtain the derived C-chain and P-chain addresses, along with the associated public key, use
flare-stake-tool info addresses --env-path /path/to/.env
To perform full stake flow, run the following scripts
flare-stake-tool crosschain exportCP -a <amount> -f <fee> --env-path /path/to/.env
flare-stake-tool crosschain importCP --env-path /path/to/.env
flare-stake-tool stake -n <nodeId> -d <duration> -w <amount/weight> --env-path /path/to/.env
Above, amount specifies the funds to export / stake (in FLR / C2FLR),
fee is an optional parameter that specifies the fee of a transaction (in FLR / C2FLR),
duration is the staking time (in seconds), and nodeId is the id of the node being deployed as a validator.
Checking whether a validator has been added successfully can be done by fetching lists of both pending and current validators. This is done by running
flare-stake-tool info validators
Funds can also be returned from P-chain back to C-chain by running the following scripts
flare-stake-tool crosschain exportPC -a <amount> --env-path /path/to/.env
flare-stake-tool crosschain importPC -f <fee> --env-path /path/to/.env
Above, amount and fee are optional. Omitting amount drains the P-chain of all funds.
Note that methods affecting the P-chain (importCP and exportPC) always use a fixed fee of 0.001,
while methods affecting the C-chain (exportCP and importPC) have variable fees and can thus be
either set or else calculated automatically.
go-flare nodeThis code can be tested locally on the localflare network, using a node with code sourced from here.
First, add a private key with some funds on C-chain into .env - you can use a well-funded test account
with the private key 0xd49743deccbccc5dc7baa8e69e5be03298da8688a15dd202e20f15d5e0e9a9fb.
Then, you have to hardcode your validator configuration hash directly into the node code.
Say you want to use the node with id NodeID-DMAS3hKKWMydmWGmGd265EYCoV7zFWEHK to stake 10000 FLR
for a duration of 1512000 seconds. To calculate the hash, run
flare-stake-tool hash -n NodeID-DMAS3hKKWMydmWGmGd265EYCoV7zFWEHK -w 10000 -d 1512000 --env-path /path/to/.env --network localflare
The above produces 2b52aae672d041ec5ec597bb72b6c1815f01f2b895ed5cddb42c45ca0e629317.
Add this hash to the array here in your cloned go-flare repo. Now you can setup the node(s) as described in here.
Staking requires first exporting funds from C-chain, importing them to P-chain, and then stake them by adding a validator node with specific configurations to the network. This is done by running the following scripts
flare-stake-tool crosschain exportCP -a 10000 -f <fee> --env-path /path/to/.env --network localflare
flare-stake-tool crosschain importCP --env-path /path/to/.env --network localflare
flare-stake-tool stake -n NodeID-DMAS3hKKWMydmWGmGd265EYCoV7zFWEHK -w 10000 -d 1512000 --env-path /path/to/.env --network localflare
In case of errInsufficientFunds error, try raising the fee when exporting funds.
Some info on upgrading to a new version.
yarn buildnpm packnpm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git]npm publishgit pushFAQs
Utilities for staking on the Flare network
The npm package flare-stake-tool-test receives a total of 0 weekly downloads. As such, flare-stake-tool-test popularity was classified as not popular.
We found that flare-stake-tool-test demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.