Skip to content

BlockSettleDB connects BlockSettle Terminal users to the bitcoin network. It indexes all transaction hashes and can support a multiple concurrent connections.

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE-ATI
Unknown
LICENSE-MIT
Notifications You must be signed in to change notification settings

BlockSettle/BlockSettleDB

Repository files navigation

BlockSettleDB - BitoinArmory Headless Runtime

This is a fork of BitcoinArmory that produces a headless runtime of BlocksettleDB. The wallet and trading platfrom from blocksettle.com fully supports this version of BlocksettleDB, and provides all the required UI tools to interact with the backend.

Install BlocksettleDB.

BlockSettle provides binary distribution of the runtime for few platforms, including Ubuntu, Windows, and MacOS.

Ubuntu

To install the binary release on Ubuntu,

sudo add-apt-repository ppa:blocksettle/blocksettledb
sudo apt-get update

sudo apt-get install blocksettledb

For more information and other available packages please visit our Launchpad page [launchpad.net/BlockSettle] (https://launchpad.net/~blocksettle/+archive/ubuntu/blocksettledb )

Running BlocksettleDB

Before you can run BlocksettleDB you have to make sure you have successfully setup bitcoin core on your system and it is fully synced. You can download the bitcoin core for your distribution from bitcoin.org. You can select between "testnet" and "mainnet" depending on what you want to do. Optionally if you whish to save your bitcoin core settings you can use Bitcoin Core Config Generator to easily create a fully functional bitcon.conf file online. Please note that the following parameters are important.

  • enable server=1 or --server
  • disablewallert=0
  • --rest.
  • --testnet or --mainnet.

and example command would look like this.

./bitcoind --server --testnet --rest
#if you saved all your settings to bitcoin.conf
./bitcoind --conf=/home/<your_path>/.bitcon/bitcon.conf 

BlocksettleDB connection design

BlocksettleDB must run alongside the Bitcoin Core node. This is because BlocksettleDB does a memory map on the blockchain files. This can only be done if BlocksettleDB and the node are running on the same OS and, ideally, on the same storage device. The IP address of the Core node is hardcoded (localhost) and can't be changed without recompiling BlocksettleDB (and changing the design at your own risk!). Only the node's port can be changed via the satoshirpc-port parameter. This design may change in the future.

<<<<<<< HEAD It is possible for BlocksettleDB and other clients to talk to BlocksettleDB remotely. Possibilities for reaching BlocksettleDB include placing BlocksettleDB behind an HTTP daemon or logging into the BlocksettleDB machine remotely via VPN. Talking to BlocksettleDB is done via JSON-encoded packets, as seen in the armoryd project.

BlocksettleDB works by reading the blockchain downloaded by Bitcoin Core and finding any transactions relevant to the wallets loaded into BlocksettleDB. This means that the entire blockchain must be rescanned whenever a new wallet or lockbox is loaded. Once a wallet/lockbox has been loaded and the blockchain fully scanned for that wallet, BlocksettleDB will keep an eye on the blockchain. Any transactions relevant to the addresses controlled by wallets/lockboxes will be resolved. In addition, as BlocksettleDB builds its own mempool by talking to the Core node, any relevant zero-confirmation transactions will be resolved by BlocksettleDB.

Instructions for Windows

build.bat Debug|Release

Instructions for macOS Instructions for Ubuntu and Arch Linux

mkdir build
cd build
cmake ..
make -j<N>

Dependencies

upstream/dev

Start BlocksettleDB headless Server.

By default it will try to connect to your running bitcoin core RPC API, and also read data from your bitcoin core block files on your disk. If your bitcoin core configuration differs from the default and you have setup data directories on non standard locations, then you will also have to tell armorydb using command-line parameters or using a config file where it can locate the block files downloaded by bitcoin core. The supported parameters are listed at Armorydb FAQ

The database types are as follows:

  • DB_BARE: Tracks wallet history only. Smallest DB, as the DB doesn't resolve a wallet's relevant transaction hashes until requested. (In other words, database accesses will be relatively slow.) This was the default database type in Armory v0.94.
  • DB_FULL: Tracks wallet history and resolves all relevant transaction hashes. (In other words, the database can instantly pull up relevant transaction data). ~1GB minimum size for the database. This was the default database type in Armory v0.96.5.
  • DB_SUPER: Tracks the entire blockchain history. Any transaction hash can be instantly resolved into its relevant data. The database will be at least ~100GB large. Default database type.

Note that the flags may be added to the BlocksettleDB root data directory in an BlocksettleDB config file (armorydb.conf). The file will set the parameters every time BlocksettleDB is started. Command line flags, including flags used by BlocksettleDB, will override config values. (Changing BlocksettleDB's default values will require recompilation.) An example file that mirrors the default parameters used by BlocksettleDB can be seen below.

db-type="DB_SUPER"
cookie=1
satoshi-datadir="/home/snakamoto/.bitcoin/blocks""
datadir="/home/snakamoto/blocksettledb/"
dbdir="/home/snakamoto/blocksettledb/databases"

Build instructions

Prerequisites

The following should be the only apt prerequisite you need that isn't common for devs. If anything's missing, it'll be added here later.

sudo apt install libprotobuf-dev protobuf-compiler

on mac make sure Homebrew, XCode and XCode command line tools are installed, and get protobuf from Homebrew:

brew install protobuf

On Windows dependencies are handled automatically with vcpkg.Addtinally a proper development setup would include the following.

  • Install Visual Studio 2019 Community Edition
  • This build was done using windows10 1809 build - activated licence.
  • Only Desktop Development with C++ needs to be installed.
  • Git has to be setup or you can install it with visual studio additional components.
  • Windows 10 SDK at least one version (in our case 10.0.18363.xx)( these numbers can disappear so just for reference if it's a recent enough installation.)
  • Also double check MSVC build tools are installed.

BlocksettleDB build instructions for Ubuntu/MacOS

The following steps will build BlocksettleDB:

cd /path/to/BlocksettleDB
mkdir build
cd build
cmake ..
make -j`nproc`

BlocksettleDB build instructions for Windows 10.

  • Clone and Setup ArmodyDB and Build Environment.
%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
cd c:\projects\
git clone https://github.com/BlockSettle/BlocksettleDB.git
cd BlocksettleDB
mkdir build
cd build
cmake .. -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_CXX_FLAGS="/MP /EHa" -DCMAKE_C_FLAGS="/MP"
msbuild -m -p:BuildInParallel=true -p:Configuration=Release ALL_BUILD.vcxproj

vcpkg will be installed automatically.

Overall, BlocksettleDB tries to use static linking. There will still be a few dependencies, as seen by ldd (Ubuntu) or otool -L (macOS). This should be fine. If there are any issues, they can be addressed as they are encountered.

On Windows on the other hand, there will be .dll files built along with the binary, and they must be in the same directory as the BlocksettleDB binary if it is to be distributed or moved. Or somewhere in the PATH environment variable.

TODO: use static vcpkg triplet for windows

CMake Options

Option Description Default
WITH_HOST_CPU_FEATURES use -march=native and supported cpu feature flags, gcc only ON
ENABLE_LTO enable link-time-optimizations OFF for Debug, ON otherwise
WITH_CRYPTOPP use Crypto++ library for cryptography functions OFF
WITH_CLIENT build Python client AUTO
WITH_GUI build GUI support using Qt4 for the Python client AUTO
ENABLE_TESTS build the test binaries OFF
LIBBTC_WITH_WALLET enable libbtc wallet OFF
LIBBTC_WITH_TESTS enable libbtc tests OFF
LIBBTC_WITH_TOOLS build libbtc tools binaries OFF
LIBBTC_RANDOM_DEVICE device to use for random numbers /dev/urandom
SECP256K1_ENABLE_ASM enable asm routines in the secp256k1 library ON
SECP256K1_USE_LIBGMP use libgmp for numeric routines in the secp256k1 library AUTO
SECP256K1_MODULE_ECDH enable the ecdh module in the secp256k1 library OFF
SECP256K1_MODULE_SCHNORR enable the schnorr module in the secp256k1 library OFF
SECP256K1_ECMULT_STATIC_PRECOMPUTATION use a statically generated ecmult table for the secp256k1 library OFF
SECP256K1_ENDOMORPHISM use endomorphism optiomization for the secp256k1 library OFF
SECP256K1_WITH_FIELD field for the secp256k1 library, can be '32bit', '64bit' or 'AUTO' AUTO
SECP256K1_WITH_SCALAR scalar for the secp256k1 library, can be '32bit', '64bit' or 'AUTO' AUTO
VCPKG_TARGET_TRIPLET see below not set

CMake Windows/vcpkg Build Type

When building on windows, set the cmake variable VCPKG_TARGET_TRIPLET to x64-windows or x86-windows depending on whether the build is for 64 bit or 32 bit.

All vcpkg supported triplets should work in theory, assuming the protobuf port will build on that platform.

When building with the Visual Studio IDE, the build products will be located under C:\Users\<your-user>\CMakeBuilds.

Changes From Upstream

The following changes have been made compared to the upstream version of Armory:

  • The build system is now cmake (needs to be upstreamed.)

  • The Armory-specific "public mode" of BIP 150 is the default (i.e., verify the server but not the client). Users who wish to do two-way verification will need to invoke BlocksettleDB with the --fullbip150 flag, which restores BlocksettleDB to the default BIP 150 behavior for the upstream BlocksettleDB.

  • The default config type is changed from FULL node to SUPERNODE.

  • FULL node support currently does NOT work.

  • The python and GUI support is not built by default unless all the dependencies are available. This fork is concerned only with BlocksettleDB.

  • The datadir is $HOME/.blocksettledb by default.

Merging Upstream

Make sure you have the upstream remote in git, this will list your configured remotes:

git remote -v

to add it do:

git remote add upstream [email protected]:goatpig/BitcoinArmory

to fetch upstream changes and merge them, do:

git fetch --all --prune
git merge upstream/dev --signoff -S

if you get conflicts you will need to resolve them.

License

Distributed under the MIT License. See the LICENSE file for more information.

About

BlockSettleDB connects BlockSettle Terminal users to the bitcoin network. It indexes all transaction hashes and can support a multiple concurrent connections.

Topics

Resources

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE-ATI
Unknown
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published