Panther Protocol Miner Client
1.6K
The Panther Miner repository contains the code for a miner specifically developed to interact with a blockchain network. Its main functionality revolves around fetching pending queues from the BusTree Smart Contract, processing the data, generating Zero-Knowledge proofs, and submitting these proofs back to the BusTree Smart Contract for mining Unspent Transaction Outputs (UTXOs) batches.
The Panther Miner script provides the following functionality:
Batch and Queue Processing: The Miner fetches utxos from a subgraph service, inserts them into a Merkle tree, and keeps track of all inserted utxos in a form of MinerTree (special type of the tree that stores information required for mining). It also fetches the highest reward queue from the BusTree smart contract, retrieves the corresponding UTXOs, and prepares the ZK proof for that queue.
ZK Proof Generation and Submission: The Miner generates ZK proof using the proof inputs prepared in the Queue Processing phase and submits the ZK proof to the BusTree Smart Contract. If the operation is successful, it updates the local copy of the MinerTree.
Repetitive Work: The script periodically performs functions described above. This periodic execution is managed using an interval mechanism.
Follow these steps to install and configure the Panther Miner:
git clone [email protected]:pantherprotocol/tech-team/miner-client.git
yarn install && ./gen-types.sh 1
cp .env.example .env
Usage To start using the Panther Miner script, run the following command:
yarn start
To run the Panther Miner in a Docker container, perform the following steps:
docker build -t miner-app .
docker run miner-app start
Or use docker-compose:
docker-compose up --build
There are two methods to claim rewards, each suited for different scenarios:
Method 1: Claiming Without Signature (For Miner Private Key Holders)
This method is used when you have direct access to the miner's private key:
yarn claimReward \
-r <receiverAddress> \
-a <PantherTreesContractAddress> \
--pk <privateKey> \
--rpc <rpcEndpoint>
Method 2: Claiming With Signature (For Delegated Claims)
This method enables a two-step process where:
yarn generate:signature \
-o <outputDirectoryToStoreSignature> \
--rpc <rpcEndpoint> \
--pk <privateKey> \
-a <PantherTreesContractAddress> \
-r <receiverAddress>
This will create a JSON file containing: {"signature": ""}
yarn claimRewardWithSignature \
-s <pathToSignatureContainingJsonFile> \
--rpc <rpcEndpoint> \
--pk <anyPrivateKey> \
-a <PantherTreesContractAddress> \
-r <receiverAddress>
Note: This step doesn't require the miner's private key
If you're using Docker (ensure you've built the image with docker build -t miner-app .), you have the following options:
docker run miner-app claimReward \
-r <receiverAddress> \
-a <PantherTreesContractAddress> \
--pk <privateKey> \
--rpc <rpcEndpoint>
a. Generate signature file:
docker run -v $(pwd)/sdk:/app miner-app generate:signature \
-o /app \
--pk <privateKey> \
--rpc <rpcEndpoint> \
-a <PantherTreesContractAddress> \
-r <receiverAddress>
b. Claim using generated signature (ensure signature.json is in sdk folder):
docker run -v $(pwd)/sdk:/app miner-app claimRewardWithSignature \
-s signature.json \
--rpc <rpcEndpoint> \
--pk <anyPrivateKey> \
-r <receiverAddress> \
-a <PantherTreesContractAddress>
Note: This step doesn't require the miner's private key
Parameter Description
<receiverAddress>: The address that will receive the claimed rewards<PantherTreesContractAddress>: The address of the Panther Trees contract<privateKey>: The miner's private key (only needed for Method 1 and signature generation)<anyPrivateKey>: The private key of any account with Matic<rpcEndpoint>: URL of the RPC node<outputDirectoryToStoreSignature>: Directory where the signature file will be saved<pathToSignatureContainingJsonFile>: Path to the generated signature JSON fileThe Panther Miner script needs certain configurations to be set in the .env file:
RPC_URL: This is the URL of the RPC node.SUBGRAPH_ID: This is the ID of the subgraph.CONTRACT_ADDRESS: This is the address of the BusTree Smart Contract.GENESIS_BLOCK_NUMBER: This represents the block number when the BusTree Smart Contract was deployed.INTERVAL: This is the duration between each repetitive execution in seconds.PRIVATE_KEY: This is the private key of the wallet that will submit the proofs as a Miner.MIN_REWARD: This is the minimum reward that the Miner will submit the proofs for.RPC_URL: The Polygon JSON-RPC endpoint.SUBGRAPH_ID: QmXyscf7tXYp2BdtWeQpvjLLVPrH2dxgVocsEJgYojyRreCONTRACT_ADDRESS: 0xF34d1BF74B98f0a67621F14633E4c807457E1400GENESIS_BLOCK_NUMBER: 69237935Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
This project is licensed under the BUSL License. See the LICENSE file for details.
Content type
Image
Digest
sha256:f0e534b0d…
Size
558 MB
Last updated
8 months ago
docker pull pantherprotocol/miner-client