Skip to content

Latest commit

 

History

History
56 lines (39 loc) · 2.35 KB

db.md

File metadata and controls

56 lines (39 loc) · 2.35 KB

Database Interactions

This part describes the database schema and interactions used in the relayer.

Schema

The relayer uses a SQLite database to store and manage transaction data. The database has three tables:

ika_sign_requests

Column Data Type Description
id INTEGER The ID of the IKA sign request (primary key)
payload BLOB The raw transaction data as a byte array
dwallet_id TEXT The ID of the dWallet used for signing
user_sig TEXT The user's signature on the transaction
final_sig BLOB The final signature generated by IKA (initially NULL)
timestamp INTEGER The timestamp of the request (Unix timestamp)

ika_txs

Column Data Type Description
sr_id INTEGER The ID of the IKA sign request (foreign key to ika_sign_requests)
status INTEGER The status of the IKA transaction (0: Success, 1: Failed)
ika_tx_id TEXT The ID of the IKA transaction
timestamp INTEGER The timestamp of the IKA transaction (Unix timestamp)
note TEXT Any notes or error messages related to the IKA transaction
sr_id, ika_tx_id Primary Key The combination of sr_id and ika_tx_id uniquely identifies a row in this table

bitcoin_txs

Column Data Type Description
sr_id INTEGER The ID of the IKA sign request (foreign key to ika_sign_requests)
status INTEGER The status of the Bitcoin transaction (0: Pending, 1: Broadcasted, 2: Confirmed)
btc_tx_id TEXT The ID of the Bitcoin transaction (hash)
timestamp INTEGER The timestamp of the Bitcoin transaction (Unix timestamp)
note TEXT Any notes or error messages related to the Bitcoin transaction
sr_id, btc_tx_id Primary Key The combination of sr_id and btc_tx_id uniquely identifies a row in this table

Functions

The dal package handles all interactions with the database. The functions within this package can be grouped into the following categories:

IKA Sign Request

These functions manage the lifecycle of IKA sign requests within the ika_sign_requests table.

IKA Transaction

These functions manage IKA transaction records in the ika_txs table.

Bitcoin Transaction

These functions manage Bitcoin transaction records in the bitcoin_txs table.