HowTo Setup Altchain vBFI
See: Main_Page, HowTo_Setup_vBFI
See: https://veriblock.org/vbfi
This is for an altchain. For VeriBlock NodeCore, please see HowTo_Setup_vBFI
Contents
Overview
Altchain vBFI (sometimes referred to as ABFI) provides BFI for Altchains, analogous to vBFI for NodeCore.
Eventually this will be directly embedded within the altchain daemon itself (as vBFI is directly embedded within NodeCore), but currently it runs as an external service.
Currently ABFI requires both a full NodeCore instance, and a full Bitcoin instance, and therefore is best run as a service.
Similar to a decentralized PoW mining pool, anyone can run an ABFI instance.
As a convenience, the Dev Team currently runs an instance.
Operational Requirements
- Disk space = 150GB (will run both full NodeCore daemon and full Altchain daemon)
- Memory = 16GB (docker compose will run multiple processes)
- SSD
- OS = linux preferred (i.e. Ubuntu 18.04 and higher)
Software = Docker preferred
How to set up
Video
This video walks through steps:
https://www.youtube.com/watch?v=p5Yb6na5-dI
Proposed default setup
1. Create folder -> /root/VeriBlock
2. Inside of that folder place application.conf with the following content:
downloader { network = "mainnet" url = "https://mirror.veriblock.org/bootstrap" localUrl = false autoClose = true } bfi { # NodeCore RPC timeouts in seconds nodeCoreTimeOuts { getLastBlock = 20 getBlock = 15 ping = 5 listBlocksSince = 15 getAltChainPoPEndorsements = 15 getStateInfo = 5 } altchainId = btcsq blockChainNetwork = mainnet # below setup is for nodecore setup through docker-compose, with rpc on port 10500 nodeCoreRpcHost = "nodecore:10500" api { port = 4568 notificationsTest = false } forkThreatThreshold = 2 forkThreatRatioThreshold = 0.8 } securityInheriting { btcsq: { payoutAddress: "<ADDRESS>" pluginKey: btc id: 252980111103 name: "BTCSQ" host: "http://btcsq:8332" auth: { username: "btcsq" password: "btcsqpass" } network: "mainnet" payoutDelay: 150 blockPeriodSeconds: 120 extraConfig: { daemonConnectionTimeout: 60000 } } }
3. In the same folder (ex. /root/VeriBlock) create "nodecore.properties" file with the following content:
rpc.security.password.enabled=false rpc.security.password=<password_if_above_is_enabled> network=mainnet http.api.bind.address=0.0.0.0 peer.bind.address=0.0.0.0 rpc.whitelist.addresses=0.0.0.0/0 rpc.bind.address=0.0.0.0
4. In the same folder (ex. /root/VeriBlock) create btcsq folder with "btcsq.conf" file inside of it with the following content:
dnsseed=0 upnp=0 debug=0 debugexclude=libevent debugexclude=leveldb poplogverbosity=info fallbackfee=0.0001 zmqpubrawblock=tcp://0.0.0.0:28032 zmqpubhashblock=tcp://0.0.0.0:20332 rpcworkqueue=256 server=1 txindex=1 listen=1 rpcallowip=0.0.0.0/0 rpcport=8332 rpcbind=0.0.0.0 rpcuser=btcsq rpcpassword=btcsqpass addnode=95.216.252.203
Docker instance setup
Note: You have to have docker installed for this part -> link
Since btcsq container runs as it's own user you will need to change btcsq folder ownership to:
chown -R 1001:1001 btcsq
Create a "docker-compose.yml" file in the same parent folder (ex. /root/VeriBlock) that the above folder was created in, with the following content:
version: '3' services: bootstrap-downloader: container_name: bootstrap-downloader image: veriblock/bootstrap-downloader:snapshot environment: - DOWNLOADER_NETWORK=mainnet - DOWNLOADER_NODECORE_DATA_DIRECTORY=/data - CONFIG_FILE=/data/application.conf - DOWNLOADER_AUTO_CLOSE=true volumes: - /root/VeriBlock:/data restart: unless-stopped # name of container btcsq: image: veriblock/btcsq:master-734a3a0 ports: - 0.0.0.0:8033:8033 # p2p - 0.0.0.0:8332:8332 # rpc - 0.0.0.0:28032:28032 # zmq raw blocks volumes: - ./btcsq:/home/btcsq/.btcsq:rw - ./coredumps:/tmp/cores command: sh -c 'sleep 7 && btcsqd' nodecore: container_name: nodecore image: veriblock/nodecore:0.4.13-rc.13.dev.7 expose: - 7500 # p2p - 10500 # rpc - 10600 # api ports: - 0.0.0.0:7500:7500 - 127.0.0.1:10500:10500 - 127.0.0.1:10600:10600 volumes: - /root/VeriBlock:/data:rw environment: - NODECORE_LOG_PATH=/data/ - NODECORE_LOG_LEVEL=INFO entrypoint: "" command: ./nodecore -d /data abfi: container_name: abfi restart: unless-stopped image: veriblock/altchain-bfi:0.4.13-rc.13.dev.7 expose: - 4568 # api ports: - 0.0.0.0:4568:4568 - 0.0.0.0:10001:10001 volumes: - /root/VeriBlock/application.conf:/altchain-bfi/bin/application.conf:rw entrypoint: "" command: ./altchain-bfi logging: driver: "json-file" options: max-size: "10m" max-file: "5"
To run this, use
docker-compose run bootstrap-downloader && docker-compose up -d nodecore btcsq abfi // also add the following after if you want to see logs -> && docker-compose logs -f
in the same folder above-mentioned folder.
Customisation notes
1. '/data' folder in nodecore and 'bin/application.conf' file in abfi are being mounted to the project root (in the example above that's '/root/VeriBlock'). to specify a different mounting point replace '/root/VeriBlock/application.conf' and '/root/VeriBlock' in nodecore and abfi containers with paths you would rather use.
2. Ports that are being exposed inside of docker-compose can also be edited, just make sure the ports are reflected in "application.conf" as well
3. If setting password for nodecore in nodecore.properties or btcsq in btcsq/btcsq.conf make sure it is reflected in application.conf as well
Get results
View in Altchain Explorer
Each Transaction page can show the BFI status:
View in QT Wallet
The transaction page can show the BFI status:
Note that this can be configured to whichever service you would like (such as pointing to your own decentralized instance). Go to "Options", and select the new "vBFI" tab.
API
There are two APIs:
(1) Ping
https://<hosted_instance>/<altchain_id>/ping
Such as: https://testnet.abfi.veriblock.org/16579303907010303/ping
(2) Chain details
https://<hosted_instance>/<altchain_id>/chains
Roadmap
Currently ABFI requires multiple services (Full NodeCore, Full BTC node, Kotlin Service, Altchain daemon).
For easier operations, the eventual roadmap is to have ABFI fully embedded within the altchain daemon.
Troubleshooting
No known block with Bitcoin Finality
While ABFI is doing initial calculations "There's no known block with Bitcoin Finality" message might be shown in /api/ping path. But if this message is still shown after 3 hours make sure to restart with
`docker-compose down` + `docker-compose up -d nodecore btcsq abfi`