Introduction
As the world of cryptocurrency continues to expand, the Gramcoin Miner emerges as a pivotal tool for those looking to delve into the mining of Grams, a digital asset on the TON Blockchain. This article serves as a comprehensive guide to setting up and running the Gramcoin Miner, available on GitHub.
Setting Up the Gramcoin Miner
-
Compiling TON from Sources:
Start by compiling TON from the sources available at TON Documentation. This is the first step in preparing your system for Gramcoin mining. -
Navigating to Build Folder:
Once compiled, navigate to your build folder (ton-build
) using the command:cd ton-build
-
Setting Environment Variables:
Environment variables are crucial for the smooth functioning of the miner. Fill out all required environment variables as per the.example.env
file. This includes API keys from TONCenter and TONConsole, your wallet address, the minter address, and your mnemonic phrase. Ensure accuracy while filling out this information.TONCENTER_API_KEY= "" # from https://t.me/tonapibot TONCONSOLE_BEARER= "" # from https://tonconsole.com/dashboard MY_ADDRESS = "Your Wallet Address" # your wallet address v4 MINTER_ADDRESS = "Minter Address" # from https://gramcoin.org/Grams-HOWTO.txt MNEMONIC = "Your 24-word Mnemonic Phrase" # 24 words
-
Running the Miner:
With the environment set up, run the following commands in your terminal to initiate the mining process:pnpm i npx ts-node main.ts
Understanding the Code
The Gramcoin Miner utilizes various packages and functions to facilitate mining. Key aspects include:
- TonClient and WalletContractV4: These are used for interacting with the TON blockchain.
- Functions like
mnemonicToPrivateKey
: Converts your mnemonic phrase to a private key, crucial for wallet interactions. - Fetching and Parsing Parameters: The script fetches and parses parameters required for mining from the minter address.
- Mining and Handling Results: The miner runs a command to obtain mined Grams and handles the results accordingly, including error management.
- Transaction Process: Upon successful mining, the script prepares and sends a transaction containing the proof of work to the blockchain.
Continuous Mining
The script is designed to continuously attempt mining. It repeatedly calls runCommandAndHandleResult
, ensuring that your system constantly tries to mine Grams, thus maximizing your chances of success.
Conclusion
The Gramcoin Miner is a powerful tool for those interested in mining Grams on the TON Blockchain. By following this guide, you can set up and run the miner efficiently, paving the way for potentially lucrative mining endeavors. Remember to double-check your configurations and stay updated with the latest developments in the TON community for an optimized mining experience. Happy mining!