Skip to content

Instantly share code, notes, and snippets.

@FrancisGregori
Last active January 20, 2018 00:27
Show Gist options
  • Save FrancisGregori/3433b4d00bf75afae6f8b2822e937a25 to your computer and use it in GitHub Desktop.
Save FrancisGregori/3433b4d00bf75afae6f8b2822e937a25 to your computer and use it in GitHub Desktop.

1. Instalação

This is a quick start script for compiling HTMLCOIN on Ubuntu

sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils git cmake libboost-all-dev
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install libdb4.8-dev libdb4.8++-dev

If you want to build the Qt GUI:

sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler

git clone https://github.com/HTMLCOIN/HTMLCOIN --recursive
cd HTMLCOIN

Note autogen will prompt to install some more dependencies if needed

./autogen.sh
./configure
make -j2

Source: https://github.com/HTMLCOIN/HTMLCOIN

2. Mineração

Acessa a pasta HTMLCOIN, verifique a nomeclatura com a qual ela está.
Na versão atual ela virá como HTMLCOIN-2.0.0.2

cd HTMLCOIN

Conecta com o cliente

sudo src/htmlcoind

Após conectar com o cliente você conseguirá minerar usando o generatetoaddress.
Exemplo:

src/htmlcoin-cli generatetoaddress 100 YOUR-RECEIVE-ADDRESS 99999999

Pode verificar o status da carteira usando o comando

src/htmlcoin-cli getinfo

O Retorno é algo similar a isso:

$ src/htmlcoin-cli getinfo
{
  "version": 2000004,
  "protocolversion": 70001,
  "walletversion": 130000,
  "balance": 0.00000000,
  "stake": 0.00000000,
  "blocks": 78238,
  "timeoffset": 0,
  "connections": 8,
  "proxy": "",
  "difficulty": {
    "proof-of-work": 11.70692494487398,
    "proof-of-stake": 3598955129.75949
  },
  "testnet": false,
  "moneysupply": 79896800000,
  "keypoololdest": 1515546749,
  "keypoolsize": 100,
  "paytxfee": 0.00000000,  
  "relayfee": 0.00400000,  
  "errors": ""  
}

htmlcoin-cli-mining.sh

#!/bin/bash

# if this file is not executable, plese make sure this file is executable
# copy the line below without the # sign and press enter
# chmod +x htmlcoin-wallet-mining.sh
# now you can run this file by typing
# ./htmlcoin-wallet-miining.sh

clear
count=1

echo "HTMLCoin wallet mining started..."
echo

# change directory into wallet folder. If the folder name is different, then change to the correct folder name
cd HTMLCOIN

while true; do
  echo "$count: $(date)"
  echo "$count: $(date)" >> wallet-mining.log

  # change the address to your address
  src/htmlcoin-cli generatetoaddress 100 YOUR-RECEIVE-ADDRESS 7777777 >> wallet-mining.log
  (( count++ ))
done

Source: https://github.com/richardjoo/HTMLCOIN/blob/master/mining/htmlcoin-cli-mining/

O arquivo htmlcoin-cli-mining.sh pode ser jogado no mesmo nivel da pasta HTMLCOIN.
Caso queria manter dentro da pasta como eu fiz, comente a linha 'cd HTMLCOIN'.

Após salvar o arquivo e estar com o cliente conectado, é só rodar o arquivo.

./htmlcoin-cli-mining.sh

Pode acontecer necessitar mudar a permissão do arquivo para executar ele

chmod +x htmlcoin-cli-mining.sh

Para acompanhar a mineração pode ser utilizado o comando abaixo

tail -f wallet-mining.log

O retorno será algo similiar a isso

1353: Sat Jan 13 17:46:19 -02 2018
[
]
1354: Sat Jan 13 17:46:33 -02 2018
[
]
1355: Sat Jan 13 17:46:48 -02 2018
[
]
1356: Sat Jan 13 17:47:03 -02 2018

Quando algum bloco for minerado o array trará algo similar a isso:

1355: Sat Jan 13 17:46:48 -02 2018
[
  "0000000010f12807cc46394bade7498a7b0598b24b08577008a343bfc99e1489"
]

Ou caso queria verificar o log de tempos em tempos, o comando abaixo pode ser utilizado também

grep -c '"' wallet-mining.log

Com isso, você retornará os blocos minerados.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment