cess-bucket

module
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2023 License: Apache-2.0

README

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 out any system bugs or you have a better suggestions, please send an email to frode@cess.one or join CESS discord to communicate with us.

System Requirements

  • Linux 64-bit Intel/AMD

⚠ 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

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-bucket 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

Build from source

Step 1: Install go

CESS-Bucket requires Go 1.19 or higher, 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"

Step 2: Clone code

git clone https://github.com/CESSProject/cess-bucket.git

Step 3: Build a bucket

cd cess-bucket/
go build -o bucket cmd/main.go

Step 4: Grant execute permission

chmod +x bucket

If all goes well, you will get a mining program called bucket.

Configure Wallet

Step 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.

Step 2: Recharge your staking account

The staking amount is calculated based on the space you configure. The minimum staking amount is 2000CESS, and an additional 2000CESS 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.

View bucket features

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

  • Flags
Flag Description
-c,--config custom configuration file (default "conf.yaml")
-h,--help help for bucket
--earnings earnings account
--port listening port
--rpc rpc endpoint list
--space maximum space used(GiB)
--ws workspace
  • Available Commands
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 Increase the stakes of storage miner
withdraw Withdraw stakes
update earnings Update earnings account
reward Query reward information
claim Claim reward

Start mining

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

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 bucket and ensure that the window always exists. Create and enter the bucket window command:

screen -S bucket

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

View window list command:

screen -ls

Re-enter the bucket window command:

screen -r bucket

method one

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

# ./bucket run
>> Please enter the rpc address of the chain, multiple addresses are separated by spaces:
wss://testnet-rpc0.cess.cloud/ws/ wss://testnet-rpc1.cess.cloud/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:
*******************************************************************************
OK /cXgDBpxj2vHhR9qP8wTkZ5ZST9YMu6WznFsEAZi3SZPD4b4qw/bucket

method two

# ./bucket run --rpc wss://testnet-rpc0.cess.cloud/ws/,wss://testnet-rpc1.cess.cloud/ws/ --ws / --earnings cXfyomKDABfehLkvARFE854wgDJFMbsxwAJEHezRb6mfcAi2y --port 15001 --space 2000
>> Please enter the mnemonic of the staking account:
*******************************************************************************
OK /cXgDBpxj2vHhR9qP8wTkZ5ZST9YMu6WznFsEAZi3SZPD4b4qw/bucket

Background operation mode

Generate configuration file:

./bucket config
OK /root/bucket/conf.yaml

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

nohup ./bucket run -c /root/bucket/conf.yaml &

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

nohup ./bucket run &

⚠ If you are not running the bucket program with root privileges, make sure the user you are currently logged in to has all the permissions for the workspace directory you have configured, if the user you are logged in to is user and the configured directory is /cess, please execute the following command to grant permissions:

sudo chown -R  user:user /cess/bucket

Other commands

  • stat
./bucket stat --rpc wss://testnet-rpc0.cess.cloud/ws/
>> Please enter the mnemonic of the staking account:
*******************************************************************************
+------------------+------------------------------------------------------+
| role             | bucket                                               |
| peer id          | 12D3KooWSEX3UkyU2R6S1wERs4iH7yp2yVCWX2YkReaokvCg7uxU |
| state            | positive                                             |
| staking amount   | 2400 TCESS                                           |
| validated space  | 1.00 GiB                                             |
| used space       | 25.00 MiB                                            |
| locked space     | 0 bytes                                              |
| staking account  | cXgDBpxj2vHhR9qP8wTkZ5ZST9YMu6WznFsEAZi3SZPD4b4qw    |
| earnings account | cXfyomKDABfehLkvARFE854wgDJFMbsxwAJEHezRb6mfcAi2y    |
+------------------+------------------------------------------------------+
  • increase
./bucket increase 1000 --rpc wss://testnet-rpc0.cess.cloud/ws/
>> Please enter the mnemonic of the staking account:
*******************************************************************************
OK 0xe098179a4a668690f28947d20083014e5a510b8907aac918e7b96efe1845e053
  • update earnings
./bucket update earnings cXgDBpxj2vHhR9qP8wTkZ5ZST9YMu6WznFsEAZi3SZPD4b4qw --rpc wss://testnet-rpc0.cess.cloud/ws/
>> Please enter the mnemonic of the staking account:
*******************************************************************************
OK 0x0fa67b89d9f8ff134b45e4e507ccda00c0923d43c3b8166a2d75d3f42e5a269a
  • version
./bucket version
bucket v0.6.0
  • exit
./bucket exit --rpc wss://testnet-rpc0.cess.cloud/ws/
>> Please enter the mnemonic of the staking account:
*******************************************************************************
OK 0xf6e9573ba53a90c4bbd8c3784ef97bbf74bdb1cf8c01df697310a64c2a7d4513
  • withdraw
./bucket withdraw --rpc wss://testnet-rpc0.cess.cloud/ws/
>> Please enter the mnemonic of the staking account:
*******************************************************************************
OK 0xfbcc77c072f88668a83f2dd3ea00f3ba2e5806aae8265cfba1582346d6ada3f1
  • claim
./bucket claim --rpc wss://testnet-rpc0.cess.cloud/ws/
>> Please enter the mnemonic of the staking account:
*******************************************************************************
OK 0x59096fd095b66665c838f89ae4f1384ab31255cdc9c80003b05b50124cfdcfee
  • reward
./bucket reward --rpc wss://testnet-rpc0.cess.cloud/ws/
>> Please enter the mnemonic of the staking account:
*******************************************************************************
+------------------+---------------------------+
| total reward     | 2_613_109_650_924_024_640 |
| claimed reward   | 534_235_750_855_578_370   |
| available reward | 0                         |
+------------------+---------------------------+

License

Licensed under Apache 2.0

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL