StakingPool Smart Contract Tutorial

Staking Pool Contract User Guide

DISCLAIMER: THIS IS A REFERENCE IMPLEMENTATION AND NOT AUDITED. USE IT AT YOUR OWN RISK. WE WILL NOT ACCEPT RESPONSIBILITY FOR COSTS YOU MAY INCUR AS A RESULT OF USING THIS CONTRACT.

注意:StakingPool.sol为QuarkChain团队开源的合约,未经严格审核,社区可以免费试用,在部署和操作使用中出现的一切问题概不负责,均由用户自己承担。

Deploy Contract

  1. Use your favorite Ethereum tooling like solc and remix to compile the StakingPool contract, copy the byteCode and abi.

    • Paste your smart contract code in Remix and compile the smart contract. Click on start to compile to compile your smart contract. QuarkChain VM hasn’t supported Istanbul, complier version should be <= 0.5.13

    • Choose the contract name that we want to deploy from the left dropdown and click on the details tab. You will see the bytecode and ABI while you scroll down the details.

    • Copy ABI by clicking on the ABI.

    Admin should be a trusted entity (preferrably on the staker side). He/she can adjust minerFeerateBp by using method adjustMinerFeeRate which could prevent miner doing evil. For example, miner doesn’t stop mining when stakers want to withdraw their stakes.

    Max feeRateBp is 10000 which equal to 100%.

    • Check the transaction on etherscan and copy Input Data.
  2. Deploy your contract on QuarkChain Mainet Explorer.

    • Choose the right shard which you want to mine on Address area.

    • Paste copied Input Data to Deploy tab and set gas limit >= 2000000 (make sure you have enough qkc on this shard), then click deploy button.

    • On the transaction status page you may find the contract address once the transaction is confirmed.

Stake QKC

  • You can interact with your contract on our QuarkChain Mainet Explorer. Make sure you have enough QKC for paying the gas fee on the right chain.

  • QKC holder can transfer their QKC to the contract address. Please try the contract methods before staking to make sure the contract is working as expected.

Mine QKC

Here uses hiveos.farm with ethminer as an example. You may use your own tooling with similar procedures.

  • Paste the contract address to your mining settings instead of the regular QKC wallet address. Start mining. Miner address should be ETH like, so we need delete last eight digits of the contract address.

    You can only mine the the same chain as the contract deployed.

  • You can check the mining result on QuarkChain Mainet Explorer

Withdraw Profits

Staker, Miner and PoolMaintainer can withdraw their profits by methods withdrawStakers(amount), withdrawMinerReward and transferMaintainerFee.