CESSProject / cess-miner

A mining program based on cess storage system.
Apache License 2.0
72 stars 26 forks source link
blockchain golang

CESS-BUCKET
GitHub license Go Reference build Go Report Card

CESS-Bucket is a mining program provided by cess platform for storage miners.

πŸ“ Reporting a Vulnerability

If you find any system errors or you have better suggestions, please submit an issue or submit a pull request. You can also join the CESS discord to communicate with us.

πŸ“’ Announcement

CESS test network rpc endpoints

wss://testnet-rpc.cess.network/ws/

CESS test network bootstrap node

_dnsaddr.boot-miner-testnet.cess.network

🚰 CESS test network faucet

https://www.cess.network/faucet.html

⚠ Attention

The following commands are executed with root privileges, if the prompt Permission denied appears, you need to switch to root privileges, or add sudo at the top of these commands.

βš™ System configuration

System requirements

Install application tools

For the Debian and ubuntu families of linux systems:

# apt install git curl wget vim util-linux -y

For the Fedora, RedHat and CentOS families of linux systems:

# yum install git curl wget vim util-linux -y

Firewall configuration

By default, cess-miner uses port 4001 to listen for incoming connections, if your platform blocks these two ports by default, you may need to enable access to these port.

ufw

For hosts with ufw enabled (Debian, Ubuntu, etc.), you can use the ufw command to allow traffic to flow to specific ports. Use the following command to allow access to a port:

# ufw allow 4001

firewall-cmd

For hosts with firewall-cmd enabled (CentOS), you can use the firewall-cmd command to allow traffic on specific ports. Use the following command to allow access to a port:

# firewall-cmd --get-active-zones

This command gets the active zone(s). Now, apply port rules to the relevant zones returned above. For example if the zone is public, use

# firewall-cmd --zone=public --add-port=4001/tcp --permanent

Note that permanent makes sure the rules are persistent across firewall start, restart or reload. Finally reload the firewall for changes to take effect.

# firewall-cmd --reload

iptables

For hosts with iptables enabled (RHEL, CentOS, etc.), you can use the iptables command to enable all traffic to a specific port. Use the following command to allow access to a port:

iptables -A INPUT -p tcp --dport 4001 -j ACCEPT
service iptables restart

Network optimization (optional)

sysctl -w net.ipv4.tcp_syncookies = 1
sysctl -w net.ipv4.tcp_tw_reuse = 1
sysctl -w net.ipv4.tcp_tw_recycle = 1
sysctl -w net.ipv4.tcp_fin_timeout = 30
sysctl -w net.ipv4.tcp_max_syn_backlog = 8192
sysctl -w net.ipv4.tcp_max_tw_buckets = 6000
sysctl -w net.ipv4.tcp_timestsmps = 0
sysctl -w net.ipv4.ip_local_port_range = 10000 65500

πŸ’° Configure CESS wallet

1) Register two cess wallet

For wallet one, it is called an earnings account, which is used to receive rewards from mining, and you should keep the private key carefully.

For wallet two, it is called a staking account and is used to staking some tokens and sign blockchain transactions.

Please refer to Create-CESS-Wallet to create your cess wallet.

2) Recharge your staking account

The staking amount is calculated based on the space you configure. The minimum staking amount is 4000CESS, and an additional 4000CESS staking is required for each additional 1TiB of space.

If you are using the test network, Please join the CESS discord to get it for free. If you are using the official network, please buy CESS tokens.

πŸ— Get the binary program

Method one

Download the latest release code directly at: Releases

Method two

Compile the binary program from the storage node source code and follow the process as follows:

1) install go CESS-Bucket requires Go 1.21, See the official Golang installation instructions.

Open gomod mode:

# go env -w GO111MODULE="on"

Users in China can add go proxy to speed up the download:

# go env -w GOPROXY="https://goproxy.cn,direct"

2) clone code

# git clone https://github.com/CESSProject/cess-miner.git

3) compile code

# cd cess-miner/
# go build -o miner cmd/main.go

4) Grant execute permission

# chmod +x miner

5) View miner features (optional)

The miner has many functions, you can use ./miner -h or ./miner --help to view, as follows:

Flag Description
-c,--config custom configuration file (default "conf.yaml")
-h,--help help for cess-miner
--earnings earnings account
--port listening port
--rpc rpc endpoint list
--space maximum space used(GiB)
--ws workspace
Command Subcommand Description
version Print version number
config Generate configuration file
stat Query storage miner information
run Automatically register and run
exit Unregister the storage miner role
increase staking Increase the staking
increase space Increase the declaration space
withdraw Withdraw stakes
update earnings Update earnings account
reward Query reward information
claim Claim reward

🟒 Start mining

The miner program has two running modes: foreground and background.

:warning: If you are not running the miner program with root privileges, make sure that the user you are currently logged in to has all permissions for the workspace directory you have configured. If you are logged in as user, the configured directory is /cess, and your signature account is cXfyomKDABfehLkvARFE854wgDJFMbsxwAJEHezRb6mfcAi2y, execute the following command to grant permissions:

# chown -R  user:user /cess/cXfyomKDABfehLkvARFE854wgDJFMbsxwAJEHezRb6mfcAi2y/

Foreground operation mode

The foreground operation mode requires the terminal window to be kept all the time, and the window cannot be closed. You can use the screen command to create a window for the miner and ensure that the window always exists. Create and enter the miner window command:

# screen -S miner

Press ctrl + A + D to exit the miner window without closing it.

View window list command:

# screen -ls

Re-enter the miner window command:

# screen -r miner

method one

Enter the miner run command to run directly, and enter the information according to the prompt to complete the startup:

# ./miner run
>> Please enter the rpc address of the chain, multiple addresses are separated by spaces:
wss://testnet-rpc.cess.network/ws/
>> Please enter the workspace, press enter to use / by default workspace:
/
>> Please enter your earnings account, if you are already registered and do not want to update, please press enter to skip:
cXfyomKDABfehLkvARFE854wgDJFMbsxwAJEHezRb6mfcAi2y
>> Please enter your service port:
15001
>> Please enter the maximum space used by the storage node in GiB:
2000
>> Please enter the mnemonic of the staking account:
*******************************************************************************

method two

# ./miner run --rpc wss://testnet-rpc.cess.network/ws/ --ws / --earnings cXfyomKDABfehLkvARFE854wgDJFMbsxwAJEHezRb6mfcAi2y --port 4001 --space 2000
>> Please enter the mnemonic of the staking account:
*******************************************************************************

Background operation mode

Generate configuration file:

# ./miner config
OK /root/miner/conf.yaml

Edit the configuration file and fill in the correct information, then run:

# nohup ./miner run -c /root/miner/conf.yaml &

If the configuration file is named conf.yaml and is located in the same directory as the miner program, you can specify without -c:

# nohup ./miner run &

πŸ’‘ Other commands

License

Licensed under Apache 2.0