Git Product home page Git Product logo

d3-btc's Introduction

D3 Bitcoin

Glossary

  • BitconD - (aka full node) peer and a participant of the Bitcoin network that stores complete Bitcoin blockchain data.

  • SPV - a.k.a Simplified Payment Verification. A special mode of BitcoinD where only headers of Bitcoin blocks are stored.

  • Wallet - special file that stores and manages private/public keys and addresses.

  • BitcoinJ - Java library that we use to communicate with Bitcoin network (see https://bitcoinj.github.io/)

  • MultiSig Address - special address in Bitcoin that requires m (threshold) of n (number of Notaries) signatures to unlock assets.

  • Redeem Script - special script that is used to describe the terms of locking/releasing coins.

  • RegTest - local Bitcoin testing network

  • TestNet - public Bitcoin testing network

  • MainNet - public Bitcoin main network

Bitcoin network

Notary communicates with two entities: BitcoinD and IrohaD. The communication between BitcoinD and Notary goes through SPV node. By doing so, we ensure Notary won't run out of disk space while working with Bitcoin.

Address generation

For each client in D3, a dedicated MultiSig address must be created. A deposit to this address creates a deposit event in Notary and updates related account balance in Iroha.

MultiSig address generation works this way:

  1. Every Notary generates a key pair.

  2. Every Notary creates a MultiSig address using public keys generated by all the Notaries.

Implementation details/issues

Address generation is a time-consuming process. It may take approximately 10-15 seconds to collect all the keys. To speed up the registration process, we generate MultiSig addresses up front.

More details

Client Registration

The service assigns Bitcoin MultiSig addresses to Iroha accounts.

Client sends a registration request to a particular Notary node. Notary chooses MultiSig address and creates a transaction in Iroha to create a "client to Bitcoin address" relationship.

More details

Deposit Service

Each Notary listens to transactions of the MultiSig addresses assigned to our clients in the Bitcoin network. Whenever we see a transaction with coins being sent to one of the addresses, Notaries increase its balance.

Iroha transfer transaction is formed as a multi-signature transaction that has two commands:AddAssetQuantity and TransferAsstet.

More details

Withdrawal Service

The withdrawal process works the following way:

  1. D3 client sends assets to a dedicated Iroha withdrawal account.
  2. Every node reacts to this transfer by creating a Bitcoin transaction.
  3. Once a transaction is created, all nodes try to sign recently created Bitcoin transaction if possible.
  4. When enough signatures are collected (supermajority threshold), Notary forms a transaction with all the signatures and sends it to the Bitcoin network.
  5. Bitcoin withdrawal transaction is formed as a multi-input transfer with 2 outputs: destination address and change address.

The change address is a special MultiSig address used and controlled by Notaries to collect the change.

More details

Testing

There is a dedicated endpoint for testing purposes. Visit Swagger for more details.

d3-btc's People

Contributors

dolgopolovwork avatar alexey-n-chernyshov avatar mingela avatar kenest2 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.