An introduction to ARC for service providers

ARC is a new way to process transactions on the Bitcoin network using a custom format to make transaction validation faster. Learn how to implement ARC as a

Written by

Todd Price

Published On

24 Mar 2023

If you’re looking for a new way to process transactions on the Bitcoin network, look no further than ARC. ARC is a transaction processor that uses a new, yet straightforward Extended Format to make transaction validation faster.

The new service covers 3 use cases: Miners running ARC instances as an on-ramp for transactions, Applications integrating with the endpoints to submit transactions, and, in the future, the possibility to build a transaction processing service. In an upcoming article, we’ll go through the steps required to implement ARC in your application.

To learn more about ARC and access documentation, head over here.

The next generation of transaction processing on Bitcoin

ARC is a microservices-based transaction processor for Bitcoin designed to replace mAPI. It is a flexible and scalable solution that can be customised to fit specific use cases. The system is composed of multiple microservices, each responsible for a specific function. These microservices include the API, Metamorph, BlockTx, and Callbacker.

The API microservice is the main point of entry for transactions into the ARC system. It handles authentication, validation, and sending transactions to Metamorph. The API talks to one or more.

Metamorph instances using client-based, round-robin load balancing. Metamorph is a microservice that processes transactions sent by the API to the Bitcoin network. It takes care of re-sending transactions if they are not acknowledged by the network within a certain time period. Metamorph is designed to be horizontally scalable, with each instance operating independently and having its own transaction store.

BlockTx is a microservice that is responsible for processing blocks mined on the Bitcoin network and propagating the status of transactions to each Metamorph that has subscribed to this service. The main purpose of BlockTx is to de-duplicate processing of large blocks. BlockTx does not store the transaction data, but instead stores only the transaction IDs and the block height in which they were mined.

Callbacker is a very simple microservice that sends callbacks to clients when a transaction has been accepted by the Bitcoin network. To register a callback, the client must add the X-Callback-Url header to the request. The Callbacker will then send a POST request to the URL specified in the header, with the transaction ID in the body.

ARC is highly customisable, with support for different databases and the ability to choose which Bitcoin nodes to connect to. It also offers a number of settings that can be modified to suit specific use cases. For example, users can choose to enable or disable the Jaeger tracer, a tool used for monitoring and diagnosing distributed systems.

ARC is designed to be fast and efficient, with a focus on reducing the load on Bitcoin nodes. For example, the system is built to avoid making RPC calls to Bitcoin nodes whenever possible, which can be slow and resource-intensive.

For monitoring and analytics, ARC offers real-time stats about the Metamorph servers, which can be viewed at a specific URL. It also provides detailed statistics about the internal Metamorph processor, which allows users to see details for a single transaction, even if it has already been mined and evicted from the processor memory.

8 steps to implementing ARC as a service provider

Step 1: Understand the Architecture

ARC consists of four microservices, each with a specific function. The first step to implementing ARC is understanding these microservices:

  1. API: The API microservice is a REST API that interacts with ARC, handling authentication, validation, and sending transactions to Metamorph.
  2. Metamorph: Metamorph is responsible for processing transactions sent by the API to the Bitcoin network.
  3. BlockTX: BlockTX processes blocks mined on the Bitcoin network and propagates the status of transactions to each subscribed Metamorph instance.
  4. Callbacker: The Callbacker microservice sends callbacks to clients when a transaction has been accepted by the Bitcoin network.

Step 2: Set up the API Microservice

The API microservice is the main entry point for transactions in ARC. You’ll need to set up the API microservice and configure it to work with your application. This involves creating a REST API endpoint that can receive transactions and configuring the API microservice to validate and process these transactions.

Step 3: Configure the Metamorph Microservice

Once the API microservice is set up, you’ll need to configure the Metamorph microservice to process the transactions received by the API. Metamorph stores transactions independently and can be run horizontally scalable.

Step 4: Set up the BlockTX Microservice

BlockTX processes blocks mined on the Bitcoin network and propagates the status of transactions to each subscribed Metamorph instance. Its main function is to prevent duplicate processing of large blocks. You’ll need to set up the BlockTX microservice and configure it to work with your application.

Step 5: Configure the Callbacker Microservice

The Callbacker microservice sends callbacks to clients when a transaction has been accepted by the Bitcoin network. You’ll need to configure the Callbacker microservice to send these callbacks to the appropriate client.

Step 6: Choose the Right Database

ARC supports multiple databases, including Sqlite3, Postgres, Badger, and BadgerHold. You’ll need to choose the right database based on your needs.

Step 7: Monitor with ARC Stats

ARC provides real-time stats about the Metamorph servers that are aggregated and displayed on a web page. These stats show information such as the number of transactions processed, the number of transactions sent to the Bitcoin network, and the average time it takes for each step in the process. More detailed statistics are available at /pstats, which show information about the internal Metamorph processor, including details for a single transaction.

Step 8: Monitor and Optimise

After you have implemented ARC into your Bitcoin application, it is important to monitor and optimise its performance. You can monitor the performance of ARC by checking the real-time stats about the Metamorph servers at /stats and the more detailed statistics at /pstats.

You should also monitor the performance of your Bitcoin nodes and ensure that they are configured correctly. In particular, you should check the number of open connections to the nodes, the number of transactions in the mempool, and the number of UTXOs stored in the nodes. You should also monitor the resource usage of the nodes, such as CPU and memory usage.

To optimise the performance of your ARC implementation, you can adjust various settings in the settings.conf and local.settings.conf files. For example, you can adjust the number of Metamorph instances, the database type used by Metamorph and BlockTX, and the batch size for processing transactions. You can also adjust the Prometheus endpoint to monitor the performance of ARC.
In addition, you can optimise the performance of your Bitcoin nodes by using a high-performance database, such as RocksDB or LMDB, and increasing the size of the mempool and the UTXO cache. You should also consider using ZMQ to listen for transaction messages, as it is faster than the P2P network.

Key takeaways

ARC is a powerful tool for ingesting Bitcoin transactions with improved performance, scalability, and stability. By following these 8 steps, you can incorporate ARC into your service offering. However, it is important to remember that ARC is still a relatively new technology, and there may be some bugs and issues that have not yet been discovered. Therefore, it is important to test your implementation thoroughly and monitor its performance to ensure that it is working correctly.

News

Latest News

Get the latest updates on the Blockchain industry and BSV ecosystem, including new projects, developments, and events.

All News