Charles Cao edited this page Dec 14, 2018 · 28 revisions

GPU Mining

Solo Mining

Generate your wallet

http://wallet.nbai.io

[Warning] Please remember your public key and store your keystore safely.

Windows

Start a local node

Download nbai node here(Please choose the latest version) https://github.com/nebulaai/nbai-node/releases

Choose gnbai_windows_10.exe open cmd

c:\user\nbai>"gnbai_windows_10.exe" -rpcaddr 127.0.0.1 --rpcport 8081 --rpc --mine --nbaibase <your wallet address>

Download etherminer

https://github.com/ethereum-mining/ethminer/releases/download/v0.16.1/ethminer-0.16.1-windows-amd64.zip

unzip the file and get the ethminer under bin open cmd cd to the bin folder

c:\user\nbai\bin> ethminer.exe http://127.0.0.1:8081

Ubuntu

Start a local node(Please choose the latest version)

wget https://github.com/nebulaai/nbai-node/releases/download/v0.0.1/gnbai_ubuntu_16.04LTS
chmod +x gnbai_ubuntu_16.04LTS
./gnbai_ubuntu_16.04LTS -rpcaddr 127.0.0.1 --rpcport 8081 --rpc --mine --nbaibase <your wallet address>

Start ethminer

Download etherminer most recent release here

https://github.com/ethereum-mining/ethminer/releases/tag/v0.16.1

./ethminer -U -P  http://127.0.0.1:8081

Mining With Mining Pool

Using http://aegispool.org as an example

Generate your wallet

http://wallet.nbai.io

[Warning] Please remember your public key and save your keystore safely

Download etherminer most recent release here

https://github.com/ethereum-mining/ethminer/releases/tag/v0.16.1

Linux:

./ethminer -U -P --farm-recheck 200 stratum1+tcp://<your public key start with 0x>@aegispool.org:8008

Check your mining account

http://aegispool.org/#/account/<your public key start with 0x>

If you are using claymore, please use the following command

$ vim start_only_eth.bash

export GPU_FORCE_64BIT_PTR=0
export GPU_MAX_HEAP_SIZE=100
export GPU_USE_SYNC_OBJECTS=1
export GPU_MAX_ALLOC_PERCENT=100
export GPU_SINGLE_ALLOC_PERCENT=100

./ethdcrminer64 -epool aegispool.org:8008 -ejobtimeout -allcoins 1 -mode 1 -ewal <wallet address start with0x>

$./start_only_eth.bash

CPU Mining

At Frontier, the first release of NBAI, you'll just need a) a GPU and b) an NBAI client, gnbai. CPU mining will be possible but too inefficient to hold any value.

At the moment, gnbai only includes a CPU miner, and the team is testing a GPU miner branch, but this won't be part of Frontier.

The C++ implementation of NBAI also offers a GPU miner, both as part of Eth (its CLI), AlethZero (its GUI) and EthMiner (the standalone miner).

NOTE: Ensure your blockchain is fully synchronised with the main chain before starting to mine, otherwise you will not be mining on the main chain.

When you start up your NBAI node with gnbai it is not mining by default. To start it in mining mode, you use the --mine command line option. The -minerthreads parameter can be used to set the number parallel mining threads (defaulting to the total number of processor cores).

 gnbai --mine --minerthreads=4

You can also start and stop CPU mining at runtime using the console. miner.start takes an optional parameter for the number of miner threads.

> miner.start(8)
true
> miner.stop()
true

Note that mining for real ether only makes sense if you are in sync with the network (since you mine on top of the consensus block). Therefore the eth blockchain downloader/synchroniser will delay mining until syncing is complete, and after that mining automatically starts unless you cancel your intention with miner.stop().

In order to earn ether you must have your nbaibase (or coinbase) address set. This nbaibase defaults to your primary account. If you don't have an nbaibase address, then gnbai --mine will not start up.

You can set your nbaibase on the command line:

gnbai --nbaibase 1 --mine  2>> gnbai.log // 1 is index: second account by creation order OR
gnbai --nbaibase '0xa4d8e9cae4d04b093aac82e6cd355b6b963fb7ff' --mine 2>> gnbai.log

You can reset your nbaibase on the console too:

miner.setnbaibase(eth.accounts[2])

Note that your nbaibase does not need to be an address of a local account, just an existing one.

There is an option to add extra Data (32 bytes only) to your mined blocks. By convention this is interpreted as a unicode string, so you can set your short vanity tag.

miner.setExtra("0")

See also this proposal

You can check your hashrate with miner.hashrate, the result is in H/s (Hash operations per second).

> miner.hashrate
712000

After you successfully mined some blocks, you can check the ether balance of your nbaibase account. Now assuming your nbaibase is a local account:

eth.getBalance(eth.coinbase).toNumber();

'34698870000000'

In order to spend your earnings you will need to have this account unlocked.

personal.unlockAccount(eth.coinbase) Password true

You can check which blocks are mined by a particular miner (address) with the following code snippet on the console:

function minedBlocks(lastn, addr) {
  addrs = [];
  if (!addr) {
    addr = eth.coinbase
  }
  limit = eth.blockNumber - lastn
  for (i = eth.blockNumber; i >= limit; i--) {
    if (eth.getBlock(i).miner == addr) {
      addrs.push(i)
    }
  }
  return addrs
}


// scans the last 1000 blocks and returns the blocknumbers of blocks mined by your coinbase 
// (more precisely blocks the mining reward for which is sent to your coinbase).   
minedBlocks(1000, eth.coinbase);
//[352708, 352655, 352559]

Note that it will happen often that you find a block yet it never makes it to the canonical chain. This means when you locally include your mined block, the current state will show the mining reward credited to your account, however, after a while, the better chain is discovered and we switch to a chain in which your block is not included and therefore no mining reward is credited. Therefore it is quite possible that as a miner monitoring their coinbase balance will find that it may fluctuate quite a bit.

The logs show locally mined blocks confirmed after 5 blocks. At the moment you may find it easier and faster to generate the list of your mined blocks from these logs.

Mining success depends on the set block difficulty. Block difficulty dynamically adjusts each block in order to regulate the network hashing power to produce a 12 second blocktime. Your chances of finding a block therefore follows from your hashrate relative to difficulty. The time you need to wait you are expected to find a block can be estimated with the following code:

Building Ethminer for Ubuntu 16.04 or 16.10 (Xenial), Ubuntu 17.04 (Zesty) or later

First, install the required drivers for your video card:

For NVidia, use:

sudo apt install cuda-9-0

vim .bashrc

export PATH=/usr/local/cuda-9.0/bin:$PATH

export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH

For AMD, download the latest diver manually and/or use

sudo apt-get install opencl-amdgpu-pro-icd

First, make sure the required packages on your system exist.

apt-get install cmake git mesa-common-dev

The mesa-common-dev fixes most build failures. Now download the latest version from GitHub into a new folder:

mkdir ~/ethminer; 
cd ~/ethminer
git clone https://github.com/ethereum-mining/ethminer .

Finally, build it (command's take some time, so be patient):

For AMD, use:

git submodule update --init --recursive
mkdir build; 
cd build
cmake ..
cmake --build .

For NVidia, CUDA needs to be manually enabled:

git submodule update --init --recursive
mkdir build

cd build
sudo cmake .. -DETHASHCUDA=ON -DETHASHCL=OFF
sudo cmake --build .

Optionally you can install as an executable:

sudo make install
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.