Difference between revisions of "HowTo Setup vBFI"

From Veriblock Wiki
Jump to: navigation, search
Line 5: Line 5:
 
== Background ==
 
== Background ==
  
vBFI provides the equivalent number of bitcoin confirmations that a VeriBlock block has.
+
vBFI provides the equivalent number of Bitcoin confirmations that a VeriBlock block (and the transactions it contains) has.
  
A 3rd Party requires a certain number of confirmations. In general, a higher number of confirmations corresponds to more security. But the tradeoff is longer wait times.
+
Third parties require specific numbers of confirmations to confirm a transaction (for example, an exchange accepting incoming deposits). In general, a higher number of confirmations corresponds to more security, with the trade-off of longer waiting period.
  
 
vBFI provides the best of both worlds:
 
vBFI provides the best of both worlds:
# Less wait time: About 2 hours worth of wait time
+
# Less wait time: About 2 hours under normal network conditions
# More security: Bitcoin level security
+
# More security: Bitcoin level security (which depending on the chain can be 100x+ the security that would normally be available after 2 hours).
  
 
Useful links:
 
Useful links:
Line 22: Line 22:
 
vBFI is contained within NodeCore. It is an optional plugin, not run by default (to conserve resources).
 
vBFI is contained within NodeCore. It is an optional plugin, not run by default (to conserve resources).
  
It is available with 0.4.13-rc8 and later (TODO - this is a pre-release). Requires both NodeCore, and NodeCore CLI (older versions of NC_CLI may not return the new fields)
+
It is available with 0.4.13-rc8 and later (TODO - this is a pre-release). Requires both NodeCore and NodeCore CLI to be 0.4.13-rc8+ (older versions of NC_CLI may not return the new fields)
  
# Run a full nodecore instance: [[NodeCore_QuickStart]]
+
# Run a full NodeCore instance: [[NodeCore_QuickStart]]
 
# Add file bfi.conf
 
# Add file bfi.conf
 
# In nodecore.properties, set bfi.enabled=true
 
# In nodecore.properties, set bfi.enabled=true
Line 66: Line 66:
 
</pre>
 
</pre>
  
There is also a JavaScript sample to call the http api for gettransactions:  
+
There is also a JavaScript sample to call the HTTP API for gettransactions:  
  
 
https://github.com/VeriBlock/nodecore-js/blob/master/packages/core/example/3_get_bfi_score.js
 
https://github.com/VeriBlock/nodecore-js/blob/master/packages/core/example/3_get_bfi_score.js
Line 84: Line 84:
 
== End-to-end example ==
 
== End-to-end example ==
  
If a transaction occurs in block 2713020, and the UI control shows that has "BTC+3", that is equivalent to "3 bitcoin confirmations".
+
If a transaction occurs in block 2713020, and the UI control shows that has "BTC+3", that is equivalent to "3 Bitcoin confirmations," meaning if an attacker wanted to reverse that transaction would have to perform a 3-block reorganization on Bitcoin (in addition to simultaneously reorging approximately 250-300 VBK blocks). In other words, the transaction has the same (technically, higher) security as a transaction on Bitcoin itself with 3 confirmations.
  
For example, if a service required "3 bitcoin confirmations" worth of security to deposit a bitcoin... then that service would want "BTC+3".
+
For example, if a service required "3 Bitcoin confirmations" worth of security to deposit Bitcoin, then that service would want "BTC+3".
  
 
[[File:Vbfi_ui_control.png|1200px]]
 
[[File:Vbfi_ui_control.png|1200px]]

Revision as of 17:48, 30 November 2021

See: Main_Page

Background

vBFI provides the equivalent number of Bitcoin confirmations that a VeriBlock block (and the transactions it contains) has.

Third parties require specific numbers of confirmations to confirm a transaction (for example, an exchange accepting incoming deposits). In general, a higher number of confirmations corresponds to more security, with the trade-off of longer waiting period.

vBFI provides the best of both worlds:

  1. Less wait time: About 2 hours under normal network conditions
  2. More security: Bitcoin level security (which depending on the chain can be 100x+ the security that would normally be available after 2 hours).

Useful links:

How to set up

vBFI is contained within NodeCore. It is an optional plugin, not run by default (to conserve resources).

It is available with 0.4.13-rc8 and later (TODO - this is a pre-release). Requires both NodeCore and NodeCore CLI to be 0.4.13-rc8+ (older versions of NC_CLI may not return the new fields)

  1. Run a full NodeCore instance: NodeCore_QuickStart
  2. Add file bfi.conf
  3. In nodecore.properties, set bfi.enabled=true

If you run getdiagnosticinfo, you will see this flag enabled.

bfi.conf

Put this next to 'nodecore.properties' file:

bfi {
    blockChainNetwork = mainnet
    nodeCoreRpcHost = "127.0.0.1:10500"
    httpApiBindPort = 4567
    httpApiNotificationsTest = true
    forkThreatThreshold = 2
    forkThreatRatioThreshold = 0.8
}

nodecore.properties

# Enable BFI
bfi.enabled=true

Get results

bitcoinConfirmations for each transaction

This is available per transaction via the bitcoinConfirmations field:

gettransactions 2AB3811FD0EDE3B3F89A50926B15AA4C0C2370A4467E6670635A19E5A1CD3AF3 5000

...
"bitcoinConfirmations": 4,
...

There is also a JavaScript sample to call the HTTP API for gettransactions:

https://github.com/VeriBlock/nodecore-js/blob/master/packages/core/example/3_get_bfi_score.js

API results

Two supported APIs are:

#Summary ping that 
<instance>/api/ping

#detailed chain data
<instance>/api/chains

End-to-end example

If a transaction occurs in block 2713020, and the UI control shows that has "BTC+3", that is equivalent to "3 Bitcoin confirmations," meaning if an attacker wanted to reverse that transaction would have to perform a 3-block reorganization on Bitcoin (in addition to simultaneously reorging approximately 250-300 VBK blocks). In other words, the transaction has the same (technically, higher) security as a transaction on Bitcoin itself with 3 confirmations.

For example, if a service required "3 Bitcoin confirmations" worth of security to deposit Bitcoin, then that service would want "BTC+3".

Vbfi ui control.png

When checking the specific transaction, it would also show "BTC+3".

Gettx.png

Docker setup

version: '3'
services:
  nodecore:
    container_name: nodecore
    image: docker-internal.veriblock.com/nodecore:0.4.13-rc.8
    expose:
      - 7500 # p2p
      - 10500 # rpc
      - 10600 # api
      - 4567 # bfi
    ports:
      - "7501:7501"
      - "10500:10500"
      - "127.0.0.1:10600:10600"
      - "127.0.0.1:4567:4567"
    volumes:
      - /root/VeriBlock:/data:Z
    environment:
      - NODECORE_LOG_PATH=/data/logs/
      - NODECORE_LOG_LEVEL=INFO

^ In the above case configuration needs to be placed in /root/VeriBlock