bitcoin-deposit-handling-lld
Objective
This document is intended to outline generic design of a Bitcoin deposit handler, a component used for monitoring and processing deposits from a Bitcoin network.
For general information on deposit handlers, read: Generic Sidechain Deposit HLD
Asumptions
Peerplays SON network is able to control (transfer or create) assets on Peerplays network - FULFILLED
Peerplays SON network have full control over address/account on Bitcoin sidechain - FULFILLED (multisig addresses)
Sidechain operating node has access to assets exchange rate list, containing exchange rates for every asset on every supported sidechain network - FULFILLED For Bitcoin, exchange rate is fixed 1 BTC = 1 PPY
Sidechain operating node has access to user accounts mapping list, containing user addresses on supported sidechains - FULLFILLED
Block diagram
Link to draw.io file
https://drive.google.com/file/d/14HFGLqD8IV3ics1ojFcZ2xC6hRtFXLck/view?usp=sharing
Description
Deposit process is initiated by sending BTC to a Bitcoin address which is registered as a sidechain user address for deposits
Bitcoin listener will pick up this transaction
Bitcoin sidechain handler will create sidechain_event_data data structure, with the information about transaction, and pass it to the sidechain_event_data_received
sidechain_event_data_received will create a proposal for creating deposit descriptor object son_wallet_deposit_object
When proposal is approved, object will be created, or if it is already created by another SON, it will be confirmed
Scheduled SON will start processing withdrawals by creating Bitcoin transaction for sending funds from Bitcoin address which is registered as a sidechain user address for deposits to primary wallet (Bitcoin multisig address controlled by active SONs)
Bitcoin transaction will be signed and sent to Bitcoin node
User will receive Peerplays core asset matching the amount of deposited BTC
Scheduled SON will mark son_wallet_deposit_object as processed
Last updated