
Subscribe to Daniel Josiah

Subscribe to Daniel Josiah
Share Dialog
Share Dialog
<100 subscribers
<100 subscribers


This article is a detailed guide on how to stake zenchain’s testnet tokens on zenchain’s testnet using https://docs.zenchain.io/docs/how-to-stake/stake-with-code as a reference.
To get started you will need to get the INativeStaking.sol code or file from zenchain’s code repository,which is located here — https://github.com/zenchain-protocol/precompile-interfaces/blob/main/INativeStaking.sol.

After copying the code or downloading the file locally to your device,You have two options to import your code:
🔹 Copy & Paste Method: If you copied the code from a webpage, click "New File" in RemixIDE and paste the code into the editor.
🔹 Download & Upload Method: If you downloaded the code as a raw file, click "Open Files" in RemixIDE and select the downloaded file from your computer.

When you have the code on your remix terminal go to Solidity Compiler tab, and expand Advanced Configuration, next select EVM Version — shanghai. And click “Compile INativeStaking.sol” button for compile contract.

Now, navigate to the Deploy & Run Transactions section. Under Environment, choose Injected Provider — MetaMask. Make sure that MetaMask is connected to the Zenchain testnet — this will be confirmed in RemixIDE by displaying Custom (8408) network.
If the Account field is empty, go to the Environment dropdown and select WalletConnect. Then click the Connect Wallet button and choose MetaMask from the available wallet options.
If MetaMask prompts you to switch to another network, decline the request as this may occasionally occur. In the Account field you can see your wallet address.
Next, enter the contract address 0x00000000000000000000000000000000000000000800 in the field beside the At Address button, then click the button. You should now see the contract's methods listed under the Deployed Contracts section below.

You will notice a window will pop up under the deployed contract section

STAKING PROCESS
According to the Zenchain staking documentation, you'll need to use two key methods: bondWithRewardDestination and bondExtra.
Start by calling bondWithRewardDestination. Here, you’ll specify the number of ZCX tokens you want to stake and indicate where the rewards should be sent using the value and dest parameters. For example, if you're staking 1,000 ZCX and want the rewards to be added back to your stake, set dest to 0.
Note that the value must be multiplied by 10000000000000000000 (since integer values are used to describe floating point numbers).
The values in this scenario are:
bondWithRewardDestination
value: 1000000000000000000000
dest: 0

Click the “transact” button and after that you will need to confirm the transaction in MetaMask.
We can also call bondExtra to add tokens to the stake (the amount is specified the same as in the previous example). After confirmation, the amount in the stake will be increased.
Using activate-your-stake for reference, you need to call either validate (if you are a validator) or nominate (if you want to support any validators).
For validators
If you're acting as a validator, the validate method allows you to set your commission rate as a percentage (multiplied by 10,000,000). For instance, a 10% commission would be represented as 100000000. You can also set the blocked parameter, which determines whether new nominations are allowed. For example:
validate
commission: 100000000
blocked: false

For nominators
If you're not a validator, use the nominate method instead. This method requires only one parameter: the wallet addresses of the validators you want to delegate your tokens to. Keep in mind that each time you call this method, it will replace the previously set values. You can delegate to up to 16 validators at once.
nominate
targets: ["0x6D5....B459", "0x6D5....B459"]
You can get the validators’ addresses from the documentation: nominate(["0x46A148316EBA94539642f3fD6908dcAB10994D1A", "0x10e4f95a5655b932A724eaDea4766eb6671d0cA5"])*.Alternatively, you can copy the addresses from an API query to Zentrace: https://zentrace.io/api/v2/blocks?type=block%20%7C%20uncle%20%7C%20reorg, and retrieve the *miner.hash values for the latest blocks.
This article is a detailed guide on how to stake zenchain’s testnet tokens on zenchain’s testnet using https://docs.zenchain.io/docs/how-to-stake/stake-with-code as a reference.
To get started you will need to get the INativeStaking.sol code or file from zenchain’s code repository,which is located here — https://github.com/zenchain-protocol/precompile-interfaces/blob/main/INativeStaking.sol.

After copying the code or downloading the file locally to your device,You have two options to import your code:
🔹 Copy & Paste Method: If you copied the code from a webpage, click "New File" in RemixIDE and paste the code into the editor.
🔹 Download & Upload Method: If you downloaded the code as a raw file, click "Open Files" in RemixIDE and select the downloaded file from your computer.

When you have the code on your remix terminal go to Solidity Compiler tab, and expand Advanced Configuration, next select EVM Version — shanghai. And click “Compile INativeStaking.sol” button for compile contract.

Now, navigate to the Deploy & Run Transactions section. Under Environment, choose Injected Provider — MetaMask. Make sure that MetaMask is connected to the Zenchain testnet — this will be confirmed in RemixIDE by displaying Custom (8408) network.
If the Account field is empty, go to the Environment dropdown and select WalletConnect. Then click the Connect Wallet button and choose MetaMask from the available wallet options.
If MetaMask prompts you to switch to another network, decline the request as this may occasionally occur. In the Account field you can see your wallet address.
Next, enter the contract address 0x00000000000000000000000000000000000000000800 in the field beside the At Address button, then click the button. You should now see the contract's methods listed under the Deployed Contracts section below.

You will notice a window will pop up under the deployed contract section

STAKING PROCESS
According to the Zenchain staking documentation, you'll need to use two key methods: bondWithRewardDestination and bondExtra.
Start by calling bondWithRewardDestination. Here, you’ll specify the number of ZCX tokens you want to stake and indicate where the rewards should be sent using the value and dest parameters. For example, if you're staking 1,000 ZCX and want the rewards to be added back to your stake, set dest to 0.
Note that the value must be multiplied by 10000000000000000000 (since integer values are used to describe floating point numbers).
The values in this scenario are:
bondWithRewardDestination
value: 1000000000000000000000
dest: 0

Click the “transact” button and after that you will need to confirm the transaction in MetaMask.
We can also call bondExtra to add tokens to the stake (the amount is specified the same as in the previous example). After confirmation, the amount in the stake will be increased.
Using activate-your-stake for reference, you need to call either validate (if you are a validator) or nominate (if you want to support any validators).
For validators
If you're acting as a validator, the validate method allows you to set your commission rate as a percentage (multiplied by 10,000,000). For instance, a 10% commission would be represented as 100000000. You can also set the blocked parameter, which determines whether new nominations are allowed. For example:
validate
commission: 100000000
blocked: false

For nominators
If you're not a validator, use the nominate method instead. This method requires only one parameter: the wallet addresses of the validators you want to delegate your tokens to. Keep in mind that each time you call this method, it will replace the previously set values. You can delegate to up to 16 validators at once.
nominate
targets: ["0x6D5....B459", "0x6D5....B459"]
You can get the validators’ addresses from the documentation: nominate(["0x46A148316EBA94539642f3fD6908dcAB10994D1A", "0x10e4f95a5655b932A724eaDea4766eb6671d0cA5"])*.Alternatively, you can copy the addresses from an API query to Zentrace: https://zentrace.io/api/v2/blocks?type=block%20%7C%20uncle%20%7C%20reorg, and retrieve the *miner.hash values for the latest blocks.
No activity yet