To know how much CKB your device can mine in a day, you can simply follow the steps in this article. Let's see how to run a CKB node and mine to receive rewards.
1. Introduction to Basic Principles
Before we start, let's understand a few important concepts.
First, what is a node? Simply put, a node is a computer that has the $CKB client installed. This client allows your computer to interact with the CKB network.
Next, let's talk about the CKB testnet. CKB is a blockchain project with a peer-to-peer network structure, meaning there is no central server; instead, the entire network is composed of all nodes. These nodes achieve consensus through equal communication to ensure the reliability of the blockchain. The testnet is a network specifically for testing, distinct from the official mainnet.
2. CKB Testnet Mining Steps
Now, let's see how to run a $CKB node on MacOS and mine.
Download and install the CKB client
First, you need to download the binary package of CKB from Nervos's official GitHub repository. Once downloaded, unzip and install it.
After installation, you can check if it was successful by running ckb --version. If you see the version number output, congratulations, the CKB client is installed!
Generate testnet configuration file
Next, you need to generate the configuration file for the testnet. Run the command ckb init -C ckb-testnet --spec testnet, which will create a folder named ckb-testnet containing the configuration file.
Start the CKB node
Go into the ckb-testnet folder, then run the ckb run command to start the CKB node. You will see the terminal output indicating that it is downloading the entire blockchain from other nodes, which may take some time.
Generate your own wallet
To mine and receive rewards, you need to generate your own wallet. Here, we will use Node.js and the JavaScript SDK provided by Nervos to generate the wallet.
First, ensure that your Node.js version is at least 10.10.0. Then, create a new Node.js project and install the @nervosnetwork/ckb-sdk-core package.
Next, you can use the code in the SDK to generate the wallet. After running the corresponding command, you will get a private key and an address. This address is your wallet address, which you can use to receive mining rewards.
Configure the node to use its own wallet
Now, you need to configure the generated wallet into the CKB node. Open the ckb.toml file, find the relevant configuration items, and replace your wallet address and private key.
Start mining
Once the configuration is complete, you can start mining. Open a new terminal window and run the ckb miner command. This will start the mining process, and your computer will begin calculating hash values that meet the network requirements.
Once a qualifying hash value is found, you will see a message like 'found seal' in the terminal, which means you have successfully mined a block!
Check mining rewards
Finally, you can search your wallet address on CKB's testnet blockchain explorer (https://explorer.nervos.org/) to see if you have received mining rewards.
3. Precautions
The testnet resets every two weeks, at which point all coins will be cleared.
Mining requires a certain amount of computing power and time, so please be patient.
If you are not familiar with Node.js or JavaScript, don't worry, just follow the steps above.
Alright, this is the main content of this issue. Together, we built a CKB node and mined a block.
#CKB助力比特币生态 @CKB Eco Fund