-
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
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.
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:
-
Every Notary generates a key pair.
-
Every Notary creates a MultiSig address using public keys generated by all the Notaries.
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.
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.
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 TransferAsset
.
The withdrawal process works the following way:
- D3 client sends assets to a dedicated Iroha withdrawal account.
- Every node reacts to this transfer by creating a Bitcoin transaction.
- Once a transaction is created, all nodes try to sign recently created Bitcoin transaction if possible.
- When enough signatures are collected (supermajority threshold), Notary forms a transaction with all the signatures and sends it to the Bitcoin network.
- 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.
There is a dedicated endpoint for testing purposes. Visit Swagger for more details.