Securing Digital Assets – a Bitcoin Full Node API for kdb+

31 October 2018 | 5 minutes

By Jeremy Lucid

In this article KX engineer Jeremy Lucid describes the qbitcoind library that he has created and shared on GitHub. The library allows individual users or applications to communicate with the Bitcoin Core full node and wallet implementation, facilitating direct bitcoin transactions. Jeremy is also the author of an earlier KX blog on Bitcoin, Kdb+ and Factom: Securing data on the block chain with qfactom as well as a blog and white paper about a C API for kdb+.

 

The cryptocurrency domain is a rapidly developing parallel financial system based on open decentralized networks with permissionless access, peer-to-peer transactions and 24/7 availability. Bitcoin in particular is arguably the most trusted and secure network, with a large and active development community who continue to innovate scaling and privacy solutions on both the base protocol, and layer two protocols like the lightning network.

On the investment and trading side, bitcoin (BTC) can be purchased on cryptocurrency exchanges like Coinbase, Kraken, Poloniex and Bitfinex, but it is also possible to gain exposure through Bitcoin futures trading at the CME or CBOE, and through physically-settled bitcoin swaps and options at the CFTC-approved trading platform, LedgerX.

At KX, growing client interest in such options has been recognized, with the KX for Flow electronic trading platform being expanded to support trading of cryptocurrencies including Bitcoin and Litecoin. This addition further extends the usage of kdb+ technology in the domain, continuing previous usage as an efficient scaling technology at the bitcoin denominated trading platform BitMEX.

With exposure and usage of Bitcoin increasing worldwide, the question of how best to securely store and control this new digital asset is becoming increasingly important. To own and control bitcoin as it was originally intended requires being in possession of the private keys which cryptographically control the funds. A private key is  a secret number in the form of an alphanumeric password which is used to move bitcoin from one address to another on the network (spending). The main responsibility for a bitcoin owner is to keep these keys private and secure, as revealing them can result in stolen funds.

Today, most cryptocurrency exchanges have taken on this responsibility to simplify and improve the user experience for millions of retail investors. Likewise, to meet the storage and legal requirements of large institutions, specialized third party custodian services are now being developed, for example, Fidelity Digital Asset Services, ICE Digital Asset Warehouse (Bakkt), Xapo Vault, BitGo, Nomura and Ledger, Gemini Segregated Custody and Coinbase Custody.

Notably, however, there also exist new structures in the form of non-custodian peer-to-peer exchanges like Bisq, which enable users to trade while still retaining full custody. Although such non-traditional exchanges represent a small fraction of global trading volume, their practicality and usage is likely to grow with continued development, and in step with the increased sophistication and usability of modern hardware wallets like Trezor, Ledger and ColdCard, which make secure self-custody much easier.

However, regardless of which party has custody of the private keys, one tool which is essential for both power users and third party custodian services are Bitcoin full nodes. These are computers which participate in the global Bitcoin network and fully verify all of the rules of the Bitcoin protocol. Nodes are used to broadcast new transactions to the network, validate all transactions and blocks, and keep a local copy of all transaction history.The full node software is essential for users who wish to use Bitcoin without needing to trust a third party service provider.

Removing third party dependencies helps maximize security, improve privacy, and allows the user to avail of the full Bitcoin functionality, all of which may not be supported by a third party service. Therefore, this software is often run by individual Bitcoin users, miners, cryptocurrency exchanges, wallet providers, payment processors, custodian services and blockchain analytic providers.

The qbitcoind library, available on GitHub, is a library which allows an individual user or application to communicate with the Bitcoin Core full node and wallet implementation, see Bitcoin full node setup. This library is designed as a convenient option for q enthusiasts, dealing primarily with the q dictionary, list and table structures. It can be used to help introduce many of the essential security practices and functionality of Bitcoin. The supplementary documentation provides multiple examples of how the library can be used to communicate with a locally running node and wallet software to perform the following actions:

• Generate wallet receive addresses, enable watch-only addresses and create multi-signature addresses. The use of multi-signature escrow accounts helps protect funds by requiring multiple keys to be provided in order to authorize a transaction.

• Monitor incoming funds, specify fund settlement criteria, and view all transactional information.

• Cryptographically sign messages using Bitcoin private keys, and validate signatures. This is a simple and effective way for an individual or institution to provide definitive proof of the funds under their control.

• Create transactions, sign offline transactions, and broadcast transactions to the network. Being able to create and broadcast transactions independently ensures maximum privacy and control.

Jeremy Lucid is a KX consultant based in Belfast who has worked on real-time Best Execution projects and market surveillance.

Demo kdb, the fastest time-series data analytics engine in the cloud








    For information on how we collect and use your data, please see our privacy notice. By clicking “Download Now” you understand and accept the terms of the License Agreement and the Acceptable Use Policy.