Skip to main content

Nockchain

Install Dependencies

sudo apt install --assume-yes git clang curl libssl-dev llvm libudev-dev make protobuf-compiler nginx
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env

Open port

sudo ufw allow ssh; sudo ufw allow 3005/tcp; sudo ufw allow 3006/tcp; sudo ufw enable

Clone

git clone https://github.com/zorp-corp/nockchain
cd nockchain
cp .env_example .env

Install Hoonc

make install-hoonc

Build

make build

Install Nockchain Wallet

make install-nockchain-wallet

Install Nockchain

make install-nockchain

Setup Keys

nockchain-wallet keygen
BACKUP

Copy every key from output, PubKey Privket Seed Pharse

  • Backup as keys.export file
nockchain-wallet export-keys 
  • edit MINING_PUBKEY in .env file
nano .env

Setup SSL

sudo nano -p /etc/nginx/conf.d/btc-proxy.conf
  • Edit RPC_URL with your own bitcoin json-rpc from getblock
server {
listen 8332;
server_name localhost;

location / {
proxy_pass RPC_URL;
proxy_set_header Host go.getblock.io;
proxy_http_version 1.1;
proxy_set_header Connection close;
proxy_ssl_protocols TLSv1.2 TLSv1.3;
proxy_ssl_server_name on;
}
}
sudo service nginx restart
sudo nginx -t

Create Service

  • Edit PUB_KEY with your own Public Key
sudo tee /etc/systemd/system/nock.service > /dev/null << EOF
[Unit]
Description=Nockchain Mining
After=network-online.target
StartLimitIntervalSec=0
[Service]
User=$USER
Restart=always
RestartSec=3
Environment=RUST_LOG=info,nockchain=trace,debug,nockchain_libp2p_io=info,libp2p=info,libp2p_quic=info
Environment=MINIMAL_LOG_FORMAT=true
ExecStart=$(which nockchain) \
--btc-node-url="http://127.0.0.1:8332/" \
--btc-username="" \
--btc-password="" \
--genesis-watcher \
--mine \
--mining-pubkey="PUB_KEY"
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable nock
sudo systemctl restart nock
  • Check logs
sudo journalctl -u nock -f --no-hostname -o cat