Tutorial: Mining AE on Ubuntu 18.04

gravatar
By admin
 · 
September 26, 2018
 · 
3 min read

A step-by-step guide on how to start mining on the æternity Testnet.

The following step-by-step tutorial was created to help æternity users start mining on the æternity Testnet and be ready to quickly switch to the Mainnet, once it launches. We are grateful to our Chinese æmbassador Zen (imae.one) for preparing this.

I. Preparation

1. Download the epoch release package and decompress it.

2. The epoch version of this guide is 0.22.0

Access the latest release here.

II. Generating the beneficiary account

As an example here we show the installation and use of the Python SDK’s command line tool to generate keys for the beneficiary account. This requires Python 3:

pip install aepp-sdk
(venv) newby@stink:~/projects/aeternity/tmp/aepp-trader-service$ pip install aepp-sdk==0.25.0.1b1^C
(venv) newby@stink:~/projects/aeternity/tmp/aepp-trader-service$ aecli account create ACCOUNTNAME
Enter the account password []: 
<account>
Address ___________________________________________ ak_bFYnkanC8utbxRnG8VN1fXFkWMnm4pUCMxjWuv8MVQArzi5hy
Path ______________________________________________
/home/newby/projects/aeternity/tmp/aepp-trader-service/ACCOUNTNAME
</account>

In the example, replace ACCOUNTNAME with whatever you want your account to be called. The password can be blank.

III. Configuring the beneficiary account

  1. Create an epoch.yaml file in the “node” folder, enter the following configuration info. In the beneficiary field — enter the public key you just generated.

2. Use the epoch script to check if the configuration is valid or not:

./bin/epoch check_config epoch.yaml

3. Start the epoch node by execute this command:

ulimit ‐n 50000
./bin/epoch start

Important: The daemon must not be run through Ubuntu’s ‘root’ account. It will not work. Before you run the epoch node, switch to another Ubuntu user.

4. Check the mining log.

After running the epoch node, several “log/*” files will be generated in the “node” directory. You can try to find them by using related keywords. The log will contain information about new blocks that you have mined.

grep “mined” log/epoch_mining*
Click to enlarge.

When the result has a value, a new block is produced.

Important: It might take some time before a block is produced, depending on the hashing speed of the mining hardware.

5. Possible error.

Check log/epoch_mining.log, if you get the following error:

Failed to mine block, runtime error; retrying with different nonce (was 13078180597498667023). Error:{execution_failed,{signal,sigabrt,true}}

Modify the configuration file epoch.yaml

mining:
autostart: true

Change to:

mining:
autostart: true
cuckoo:
miner:
executable: lean30
extra_args: ""
node_bits: 30

Restart the epoch node:

./bin/epoch/restart

If you are mining, “log/epoch_mining.log” will show “starting mining”.

6. Verify your node is synchronizing with the Testnet:

curl http://18.195.109.60:3013/v2/blocks/top
curl http://127.0.0.1:3013/v2/blocks/top
Click to enlarge.

As you can see in the image above, the node’s hash is the same as the Testnet hash. It is synchronized.

7. Query your mining reward. Use YOUR public address

The public key being used for this test is: ak_jRUEtyqPNzM7krHWxQir5c2peCLEd8hKhgnCmu6PBHeAvNiKE

curl http://localhost:3013/v2/accounts/ak_jRUEtyqPNzM7krHWxQir5c2peCLEd8hKhgnCmu6PBHeAvNiKE
The miner found 3 blocks, each rewarding him with 10 Testent AE tokens.

Important: Due to the Proof of Fraud mechanism, part of Bitcoin-NG, AE token rewards are distributed 180 key blocks after a block is found. That is about 9 hours later.

IV. Final Notes

  1. Compatibility

The different versions epoch are not forward compatible, so when you want to query the reward from the Testnet using the Python SDK, you may not be able to get the right account balance. The reason is that the last epoch version is not compatible with the last Python SDK.

To avoid this, always query the reward from local.

2. epoch has not exposed the swagger interface yet. For related interface documents, see epoch-api-doc:

https://github.com/aeternity/epoch-api-docs

V. Used Resources

Epoch project link: https://github.com/aeternity/epoch
Epoch-api-doc link: https://github.com/aeternity/epoch-api-docs

If you experience any problems mining on Ubuntu using this tutorial, please use this topic in the Forum:

https://forum.aeternity.com/t/tutorial-mining-ae-on-ubuntu-18-04/929/7


Interested in æternity? Get in touch:

GitHub | Forum | Reddit | Bitcointalk | Telegram | Twitter | Facebook | Mail

Tagged: æternity · Blockchain · Mining · Team · Tutorial
Comments

No Comments.