Qubic bxid Archival Service.png

Qubic bxid Archival Service

A unique bxid hash represents confirmed Qubic transactions, simplifying integration into traditional crypto systems, such as wallets and exchanges, via an API indexed by bxid.

Qsilver · Jan 6, 2024.

Introduction

Qubic's unique characteristics make it challenging to interface directly with existing crypto infrastructure. This proposal defines a unique hash, bxid, representing a confirmed and instantly final proof of value transfer. An API indexed by bxid would simplify integrating Qubic into systems that expect traditional confirmed txid.

Defining bxid

The bxid (Balance Transfer ID) can be calculated locally before inclusion in a tick, allowing wallets to display the bxid to users and query an API service. If the bxid is absent after the specified tick, it indicates a transaction failure.

For normal QU transfers, the bxid is defined by the K12 hash of epoch + tick + srcpubkey + destpubkey + amount, in a byte format matching the logfile entry. For other transaction types, the bxid follows the same convention by hashing the logfile entry directly, skipping date fields.

Handling transactionless SC balance changes requires a unique bxid per balance change. By calculating SC balance changes with an amount of 0, the query for that bxid returns the sum of all balance changes for that destination in the tick.

Using bxid

1. Calculating bxid

./bxid calcbxid epoch tick source dest amount

2. Fetching bxid Data

curl 93.190.139.223:9200/txid/_doc/(txid)
curl 93.190.139.223:9200/bxid/_doc/(bxid)

3. Validating bxid Information

Implementation

1. Setting Up bxid Archival Service

Clone and build the repository:

git clone <https://github.com/Qsilver97/qubic-cli>
cd qubic-cli
mkdir build
cd build
cmake ..
make
g++ -I.. ../bxid.cpp ../connection.cpp -o bxid

2. Creating JSON Output

Example JSON from a logfile entry:

{ "index": { "_index": "bxid", "_id": "397e947847ada93de80907d88a835419fb532b3ca1fd68b3c95ebab11cd24190" } }
{
  "utime": "1707059413",
  "epoch": "90",
  "tick": "11867469",
  "type": "1",
  "src": "LZLDOEIBQWIUGGMZGOISLOAACDGAFVAMAYXSSJMLQBHSHWDBPMSDFTGAYRMN",
  "dest": "QHQPMJVNGZJGZDSQREFXHHAZFYPBIYDOTFAOTTWGYCWGTIRNGBVMKBGGNDDA",
  "amount": "1521139"
}

Use the Charmed OpenSearch system to process these JSON lines:

curl --cacert demo-ca.pem -XGET https://<username>:<password>@<ipaddr>:9200/bxid/_doc/397e947847ada93de80907d88a835419fb532b3ca1fd68b3c95ebab11cd24190
{
  "_index": "bxid",
  "_id": "397e947847ada93de80907d88a835419fb532b3ca1fd68b3c95ebab11cd24190",
  "_version": 2,
  "_seq_no": 32754,
  "_primary_term": 1,
  "found": true,
  "_source": {
    "utime": "1707059413",
    "epoch": "90",
    "tick": "11867469",
    "type": "1",
    "src": "LZLDOEIBQWIUGGMZGOISLOAACDGAFVAMAYXSSJMLQBHSHWDBPMSDFTGAYRMN",
    "dest": "QHQPMJVNGZJGZDSQREFXHHAZFYPBIYDOTFAOTTWGYCWGTIRNGBVMKBGGNDDA",
    "amount": "1521139"
  }
}

3. Setting Up Log Processing Loop

Create a log processing loop to maintain the archival service and REST API:

while true; do
  ./bxid processlog
done

Conclusion

Implementing a bxid archival service simplifies integrating Qubic into existing crypto services by providing a confirmed and instantly final proof of value transfer. By leveraging bxid and the bxid archival service, Qubic transactions can be seamlessly incorporated into traditional crypto infrastructure.

For the latest updates, join the Valis Discord, follow us on X, and bookmark our blog.

← Previous

Test bxid/txid API server

Next →

Arbitrator is not an Alligator

On this Page