Stake
Razor network is a proof of stake network. In order to participate in the network as a validator, you will need to "Stake" your RAZORs. RAZOR tokens are the native tokens in the network and they are compatible with the ERC20 tokens standard.
Get tokens
You will need some sFUEL to pay for transaction fees. You can get sFUEL from SKALE Portal after connecting your wallet.
In order to get started, you will also need some RAZOR tokens on Europa chain. You can bridge RAZOR tokens from Ethereum to Europa Defi Hub using Skale Portal. More info regarding RAZOR Token bridge can be found here
Add Europa Defi Hub network to metamask
Use an ethereum compatible browser (e.g. Chrome browser with Metamask plugin)
In metamask, click on top right account icon > Settings > Add Network.
Fill in the following details:
Particulars Value Network Name Europa Defi Hub New RPC URL https://mainnet.skalenodes.com/v1/elated-tan-skat Chain ID 2046399126 Currency Symbol sFUEL Block Explorer URL https://elated-tan-skat.explorer.mainnet.skalenodes.com Note: You can also add network from https://razorscan.io/ by clicking on "Connect wallet" and switching network to Skale.
Now you are all set! Let's download the client and start staking!
For testnet use the following details
1. Use an ethereum compatible browser (e.g. Chrome browser with Metamask plugin) 2. In metamask, click on top right account icon > Settings > Add Network. 3. Fill in the following details:
| Particulars | Value |
|---|---|
| Network Name | juicy-low-small-testnet |
| New RPC URL | https://testnet.skalenodes.com/v1/juicy-low-small-testnet |
| Chain ID | 1444673419 |
| Currency Symbol | sFUEL |
| Block Explorer URL | https://juicy-low-small-testnet.explorer.testnet.skalenodes.com/ |
Note: You can also add network from https://staging.razorscan.io/ by clicking on "Connect wallet" and switching network to Skale.
Now you are all set! Let's download the client and start staking!
Using Docker
It is recommended to run a Oracle Node using Docker. This is because you don't need a complete development environment to run a node. Since code is updated and deployed frequently from our github repository, we keep the Oracle Node docker image updated.
Hardware Requirements
16GB RAM
4 Core (arm64 or amd64 architecture)
Software dependencies
Docker: You can find more information about installing docker here.
Oracle-Node(github): You can download the Oracle-Node:2.1.1 from here.
You can download the docker image of Razor-go:v2.1.1 from here.
Run the Razor Network Docker Node
One of the quickest ways to get razor-go up and running on your machine is by using Docker:
- Create docker network
docker network create razor_network
- Start razor-go container
docker run -d -it --entrypoint /bin/sh --network=razor_network --name razor-go -v "$(echo $HOME)"/.razor:/root/.razor razornetwork/razor-go:v2.1.1
For testnet use the following command
docker run -d -it --entrypoint /bin/sh --network=razor_network --name razor-go -v "$(echo $HOME)"/.razor:/root/.razor razornetwork/razor-go:6f59ca8
This spins up a razor-go docker image. You can find all the images on the Razor Network dockerhub.
Set Config
There are a set of parameters that are configurable. These include:
- Provider: The RPC URL of the provider you are using to connect to the blockchain.
- Gas Multiplier: The value with which the gas price will be multiplied while sending every transaction.
- Buffer Size: Buffer size determines, out of all blocks in a state, in how many blocks the voting or any other operation can be performed.
- Wait Time: This is the number of seconds the system will wait while voting.
- Gas Price: The value of gas price if you want to set manually. If you don't provide any value or simply keep it to 1, the razor client will automatically calculate the optimum gas price and send it.
- Log Level: Normally debug logs are not logged into the log file. But if you want you can set
logLeveltodebugand fetch the debug logs. - Gas Limit: The value with which the gas limit will be multiplied while sending every transaction.
- Gas Limit Override: This value would be used as a gas limit for all the transactions instead of estimating for each transaction.
- RPC Timeout: Number of seconds after which any contract and client calls will time out if it's not responding.
- HTTP Timeout: This is the threshold number of seconds after which an HTTP request for a job will time out.
- Maximum size of log file: This is the maximum size of log file in MB
- Maximum number of backups of log file: This is the maximum number of old log files to retain.
- Maximum age of log file: This is the maximum number of days to retain old log files.
docker exec -it razor-go razor setConfig --provider https://mainnet.skalenodes.com/v1/elated-tan-skat --gasmultiplier 1 --buffer 5 --wait 1 --gasprice 0 --logLevel debug --gasLimit 2 --gasLimitOverride 30000000 --rpcTimeout 5 --httpTimeout 5 --logFileMaxSize 200 --logFileMaxBackups 10 --logFileMaxAge 60
For testnet use the following command
docker exec -it razor-go razor setConfig --provider https://testnet.skalenodes.com/v1/juicy-low-small-testnet --gasmultiplier 1 --buffer 5 --wait 1 --gasprice 0 --logLevel debug --gasLimit 2 --gasLimitOverride 30000000 --rpcTimeout 5 --httpTimeout 5 --logFileMaxSize 200 --logFileMaxBackups 10 --logFileMaxAge 60
NOTE:: This will create
razor.yamlwith all necessary parameter at$HOME/.razordirectory. We can view that via command:cat $HOME/.razor/razor.yaml.
NOTE: You can automate all razor-go commands by providing password non-interactively. There are multiple ways to do that
- Provide password via file, All the commands have an additional
--passwordflag that you can provide with the file path from which the password must be picked. To run a command with a password flag with the help of docker, the password file should present in$HOME/.razor/directory
Example:docker exec -it -d razor-go razor command --password /root/.razor/<file_name>- Provide password via echo command.
Example:echo "your password" | docker exec -it -d razor-go razor command
Linux-based system keeps track of the previously executed command., anyone can get the detail of the previous command via thehistorycommand.
To delete command from history:
- List the previously executed command:
history2. Delete command from history:history -d <line-number>
Commands
Run the commands in following way:
docker exec -it razor-go razor <command>
Note: It is recomended to use
--logFile <filename>flag with every razor command this will generate logfile in.razordirectory which will be helpfull in debuging any issue.
Create an account using the following command:
docker exec -it razor-go razor create
Import an account using the following command:
docker exec -it razor-go razor import
Staker needs to import the list of endpoints using importEndpoints command
docker exec -it razor-go razor importEndpoints
Fund this account with sFUEL and RAZOR tokens to start participating in the network.
You can use the full commands (stake) or the short form (s) as shown below.
Start staking using the addStake command
docker exec -it razor-go razor addStake --address <account> --value <value> --logFile <filename>
where address is the address that contains RAZOR tokens and value is the amount of RAZOR that you want to stake.
An example of this command would be:
docker exec -it razor-go razor addStake --address 0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c --value 10000 --logFile logs
Note: --weiRazor flag can be passed to provide values in wei
If you have a 1000.25 RAZOR tokens in your account, you can stake those using the stake command with weiRazor flag.
Example:
$ razor addStake --address 0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c --value 1000250000000000000000 --weiRazor true
If you have a 5678.1001 RAZOR tokens in your account, you can stake those using the stake command with weiRazor flag.
Example:
$ ./razor addStake --address 0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c --value 5678100100000000000000 --weiRazor true
To start accepting delegation, use the delegation command in a new terminal which is mentioned in the set delegation documentation
It will enable delegation, and participants can delegate RAZOR tokens to your staker's account.
Start voting using the vote command
docker exec -it razor-go razor vote --address <account> --logFile <filename>
Note: To run vote command in background you can use
tmuxfor that.
- Run:
tmux new -s razor-go- Run vote command
- To exit from tmux session: press
ctrl+b, release those keys and pressd- To list your session:
tmux ls- To attach Session back:
tmux attach-session -t razor-go
An example of this command would be:
docker exec -it razor-go razor vote --address 0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c --logFile logs
If you have delegation enabled and have some commission set, then you can claim that earned commission anytime via the following command:
docker exec -it razor-go razor claimCommission --address <address> --logFile <filename>
An example of this command would be:
docker exec -it razor-go razor claimCommission --address 0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c --logFile logs
View Logs
tail -f $HOME/.razor/logs/[filename].log
An example of this command would be:
tail -f $HOME/.razor/logs/logs.log
That's it! You should have a staker up and running. Your node will start automatically fetching and answering queries. You must keep your computer online to be able to validate without any interruptions. You can monitor the logs, and use Razorscan to monitor your staker.
For more details around all the commands of razor-go, please check out the oracle-node Readme.
Installation From Source
If you would rather install from source, please follow Instructions here to run a Razor Network node from source.
Update docker image
NOTE:: _If you are updating to
v2on the same machine where thev1node was running, make sure to delete all the the files in the.razor/data_filesdirectory.
To update the razor-go node version
- Get the latest docker image from Docker Hub
Note: -
- Make sure you don't use -alpha and -beta suffixed docker images those are only for internal testing.
- Update the node in the Dispute state in order to reduce the chances of an inactivity penalty. The process of updating the node should be completed in less than 5 minutes. Do the following steps as quickly as possible to avoid any inactivity penalties.
Check your container is running via
docker ps, you should get an output like:CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5f0b7d99a71b razornetwork/razor-go:v2.0.0 "/bin/sh" 3 weeks ago Up 3 weeks razor-goStop the existing container
docker stop razor-goRemove the existing container
docker rm razor-goRun the staker with latest docker image:
docker run -d -it --entrypoint /bin/sh --network=razor_network --name razor-go -v "$(echo $HOME)"/.razor:/root/.razor razornetwork/razor-go:<version>example: If latest version is
v2.1.1then the command would be:docker run -d -it --entrypoint /bin/sh --network=razor_network --name razor-go -v "$(echo $HOME)"/.razor:/root/.razor razornetwork/razor-go:v2.1.1Check your container is running
docker ps, you should get an output like:CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
53ff3ce7c965 razornetwork/razor-go:v2.1.1 "/bin/sh" 17 seconds ago Up 16 seconds razor-goIf you want to update your config file, you can run SetConfig command
Staker needs to run
importEndpointscommand to import the list of endpoints present in the updated release, the command would be like:docker exec -it razor-go razor importEndpoints
Note: If you are running vote command in tmux session
- Check your razor-go session exists:
tmux ls- Attach existing session:
tmux a -t razor-go- To exit from tmux session: press
ctrl+b, release those keys and pressd- To list your session:
tmux ls- To attach Session back:
tmux attach-session -t razor-go
- Start voting again
docker exec -it razor-go razor vote --address <account> --logFile <filename>
Using SKALE Block Explorer (Alternative method)
This method allows you to stake directly by interacting with the StakeManager smart contract through the SKALE Block Explorer. This is an alternative to running the Oracle Node CLI and is recommended for advanced users who are comfortable with direct contract interaction.
Note: This method only covers the staking transaction itself. To run as a validator and participate in voting, you still need to run the Oracle Node software as described in the sections above.
Prerequisites
Before staking via the block explorer, ensure you have:
- Metamask wallet installed and configured
- Europa Defi Hub network added to Metamask (see network details)
- RAZOR tokens on Europa Defi Hub (bridge from Ethereum via SKALE Portal)
- sFUEL tokens for gas fees (get from SKALE Portal after connecting wallet)
- Minimum 100,000 RAZOR tokens (minSafeRazor requirement for new stakers)
Contract Addresses
Mainnet (Europa Defi Hub):
- StakeManager:
0xd492408e4901CF658c7874285984F6D5Db648D1E - BlockManager:
0xEa74913E6Ed2dce4c89c89F5A328b507AfD86c0e - RAZOR Token:
0xCA46B70cA3c510Ce9D0c43D25817032e2F5354c0
Testnet (Europa Defi Hub Testnet):
- StakeManager:
0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012 - BlockManager:
0x3FD90d39d6f6f9EB39E5B0cf733e0aD02241f345 - RAZOR Token:
0x99Be5a5749bA2bccfC4Bb6584cA0E405A16586C4
Step-by-Step Instructions
Step 1: Calculate Current Epoch
The stake function requires the current epoch number to prevent replay attacks. The current epoch must be calculated manually using the formula: block.timestamp / EPOCH_LENGTH (rounded down)
Method 1: Using Block Explorer (Recommended)
Visit the BlockManager contract on the block explorer:
Navigate to the "Read Contract" tab
Get the EPOCH_LENGTH constant:
- Find the
EPOCH_LENGTHfunction - Click "Query" - note this value (e.g.,
300seconds)
- Find the
Get the current block timestamp:
- Look at the top of the page for the latest block number
- Click on the block number to view block details
- Note the "Timestamp" value
Calculate the current epoch:
Current Epoch = block.timestamp / EPOCH_LENGTH (rounded down)Example:
- If block timestamp = 1234567890
- And EPOCH_LENGTH = 450
- Then current epoch = 1234567890 / 450 = 2743484 (after rounding down)
Method 2: Using Razorscan (Easier)
Alternatively, you can see the current epoch displayed on Razorscan homepage.
Important:
- Epochs change every EPOCH_LENGTH seconds
- Calculate the epoch right before staking to avoid transaction failures
- If your transaction fails with an epoch mismatch, recalculate and try again immediately
Step 2: Approve RAZOR Tokens
Before staking, you must approve the StakeManager contract to spend your RAZOR tokens:
- Visit the RAZOR Token contract on the block explorer (use links above)
- Click "Connect Wallet" and approve the Metamask connection
- Verify your wallet is connected and you're on the correct network (Europa Defi Hub)
- Navigate to the "Write Contract" tab
- Find the
approvefunction - Fill in the parameters:
- spender (address): Enter the StakeManager contract address:
- Mainnet:
0xd492408e4901CF658c7874285984F6D5Db648D1E - Testnet:
0xbeCf5d1b74d0C2A6388c65491BBb4aD3880cD012
- Mainnet:
- amount (uint256): Enter the amount in wei (e.g., for 100,000 RAZOR, enter
100000000000000000000000)
- spender (address): Enter the StakeManager contract address:
- Click "Write" and confirm the transaction in Metamask
- Wait for the transaction to be confirmed
Note: 1 RAZOR = 10^18 wei. For the minimum stake of 100,000 RAZOR = 100000000000000000000000 wei
Step 3: Navigate to StakeManager Contract
Visit the StakeManager contract on the block explorer:
Ensure your wallet is still connected (if not, click "Connect Wallet" again)
Step 4: Execute Stake Function
Navigate to the "Write Contract" tab
Scroll down and find the
stakefunctionFill in the parameters:
- epoch (uint32): Enter the current epoch number from Step 1 (e.g.,
42) - amount (uint256): Enter the stake amount in wei (e.g., for 100,000 RAZOR, enter
100000000000000000000000)
- epoch (uint32): Enter the current epoch number from Step 1 (e.g.,
Click "Write" to submit the transaction
Review the transaction details in the Metamask popup
Click "Confirm" in Metamask
Important Notes:
- First-time stakers: Minimum stake is 100,000 RAZOR (100000000000000000000000 wei)
- Adding stake: If you're already a staker, you can add any amount
- The epoch must match the current epoch, otherwise the transaction will fail
- Ensure you've completed the token approval in Step 2
Step 5: Verify Transaction
- After confirming in Metamask, wait for the transaction to be processed
- Once confirmed, you'll see a success message in the block explorer
- Click on the transaction hash to view transaction details
- You can verify your stake by:
- Checking the transaction logs for a
Stakedevent - Visiting your wallet on Razorscan to see your staker information
- Querying
getStakerIdwith your address on the StakeManager contract
- Checking the transaction logs for a
Step 6: Set Up Oracle Node (Required for validators)
Important: Staking tokens is only the first step. To participate as a validator and earn rewards, you must:
- Run the Oracle Node software (see Using Docker section above)
- Start voting with the
votecommand - Keep your node online and operational
Without running the Oracle Node, you'll only be staking tokens but won't be participating in the network or earning rewards.
Common Issues and Troubleshooting
Transaction fails with "less than minimum safe Razor"
- Your stake amount is below the 100,000 RAZOR minimum requirement for new stakers
- Increase your stake amount to at least 100,000 RAZOR
Transaction fails with "ERC20: insufficient allowance"
- You didn't complete Step 2 (token approval), or approved an insufficient amount
- Go back to Step 2 and approve the correct amount
Transaction fails with "Staker is slashed"
- Your staker account has been slashed for malicious behavior
- You cannot add stake to a slashed account
Transaction fails due to epoch mismatch
- The epoch you provided doesn't match the current epoch
- Epochs change approximately every X hours
- Go back to Step 1, get the current epoch, and try again immediately
Transaction fails with "Nonpositive Amount"
- The amount parameter is 0 or invalid
- Check your wei conversion is correct
Wei Conversion Helper
To convert RAZOR amounts to wei for the smart contract:
- 100,000 RAZOR (minimum) =
100000000000000000000000wei - 200,000 RAZOR =
200000000000000000000000wei - 500,000 RAZOR =
500000000000000000000000wei - 1,000,000 RAZOR =
1000000000000000000000000wei
Formula: RAZOR amount × 1,000,000,000,000,000,000
You can also use online converters or tools like web3.utils.toWei() in JavaScript.
Setting Delegation Acceptance
After staking, if you want to accept delegations from other users:
- First, set your commission rate using the
updateCommissioncommand - Then enable delegation acceptance using the
setDelegationAcceptancecommand
These operations are currently only available via the Oracle Node CLI, not through the block explorer.
Related Operations
After staking, you may want to:
- Set Delegation - Enable accepting delegations
- Update Commission - Set commission rate
- Unstake - Begin the unstaking process
- Claim Commission - Claim earned commissions