v10.2.0
Release Notes - Counterparty Core v10.2.0 (2024-06-11)
This is a large release that includes significant refactoring and redesigns of critical node components, including the CLI and logging subsystems, mempool processing, and API database connection management. It also includes numerous updates and extensions to the v2 API, plus new ZeroMQ support. Of course, a large number of bugs have been resolved as well.
Upgrading
The counterparty-server
process now uses ZeroMQ to communicate with Bitcoin Core, in addition to the traditional RPC API. You must configure Bitcoin Core with:
[main]
zmqpubrawtx=tcp://0.0.0.0:9332
zmqpubhashtx=tcp://0.0.0.0:9332
zmqpubsequence=tcp://0.0.0.0:9332
zmqpubrawblock=tcp://0.0.0.0:9333
[test]
zmqpubrawtx=tcp://0.0.0.0:19332
zmqpubhashtx=tcp://0.0.0.0:19332
zmqpubsequence=tcp://0.0.0.0:19332
zmqpubrawblock=tcp://0.0.0.0:19333
Note: This update requires a reparse from Block 819250, which will proceed automatically upon initialization.
ChangeLog
Bugfixes
- Fix circular imports
- Return
404
errors for undefined API routes - Fix nested
result
value in the v1 API - Fix
burned
,earned
, andbtc_amount_normalized
fields in API results - Do not cache non-cacheable v2 API routes (which could lead to a broken health check, in particular)
- Fix the execution interval of the
APIStatusPoller
thread - Add
Access-Control-Allow-Headers = *
header to API v2 for CORS
Codebase
- Refactor mempool management and block tracking—catching up is now done via RPC, and tracking via ZeroMQ
- Introduce a new Rust module to fetch blocks from Bitcoin Core over RPC. Calls are now massively parallelized and buffered; block fetching no longer slows down block parsing
- Refactor the
backend
module; separate calls to Bitcoin Core and AddrIndexRs into two different modules - Add the indexed
tx_hash
field to themessages
table - Update
rowtracer
so thatapsw
returns a boolean instead of an integer forBOOL
type fields - Delete the defunct implementation of rock-paper-scissors; introduce a
replay_events()
function to reconstruct the database from a hard-coded list of historical events - Enable parsing blocks while Bitcoin Core is still catching up
- Optimize
get_pending_dispensers()
by adding thelast_status_tx_source
andclose_block_index
fields to thedispensers
table; optimizeis_dispensable()
by caching a list of all dispenser addresses - Add the
transaction_count
field to theblocks
table - Add the following new database indexes:
credits.calling_function
debits.action
transactions.source
credit.quantity
debit.quantity
balance.quantity
dispenser.give_quantity
order.get_quantity
order.give_quantity
dispense.dispense_quantity
- Add the new
EVENT
log level - Disable the automatic SQLite ‘quick check’ for when the database has not been closed correctly. Display an error message when exiting and at the next restart.
- Add retries to
get_oldest_tx()
on a Addrindexrs timeout
API
- Introduce the following new routes:
/v2/assets/<asset>/dispenses
/v2/addresses/<address>/issuances
/v2/addresses/<address>/assets
/v2/addresses/<address>/transactions
/v2/addresses/<address>/dividends
/v2/addresses/<address>/orders
/v2/addresses/<address>/dispenses/sends
/v2/addresses/<address>/dispenses/receives
/v2/addresses/<address>/dispenses/sends/<asset>
/v2/addresses/<address>/dispenses/receives/<asset>
/v2/blocks/<block_hash>
/v2/blocks/last
/v2/transactions
/v2/transactions/<int:tx_index>/events
/v2/transactions/<tx_hash>/events
/v2/transactions/<int:tx_index>/events/<event>
/v2/transactions/<tx_hash>/events/<event>
/v2/transactions/<int:tx_index>
/v2/dividends
/v2/dividends/<dividend_hash>
/v2/dividends/<dividend_hash>/credits
/v2/mempool/transactions/<tx_hash>/events
/v2/events/<event>/count
/v2/bets
/v2/orders
/v2/dispensers
- Introduce the
cursor
API parameter - Include
next_cursor
andresult_count
fields in all responses - Accept
cursor
/offset
andlimit
arguments in all queries that return lists from the database (see the Pagination paragraph of the API Documentation) - Make the
asset
,assets
,give_asset
, andget_asset
parameters case-insensitive - Add the
named=true|false
parameter to/v2/assets
to returning only named / numeric assets - Publish events on the ZeroMQ Pub/Sub channel
- Implement database connection pooling for both API v1 and v2
- Enrich results containing
block_index
withblock_time
whenverbose=true
- Add an
action
filter for the*/credits
and*/debits
routes - Add an
event_name
filter for the*/events
routes - Specify
issuer=None
within XCP and BTC asset information - Exclude zero balances in the results of
/v2/addresses/<address>/balances
and zero quantities in the results of*/credits
and*/debits
- Add BTC sent to the
DISPENSE
event - Accept trailing slashes in routes
- Include
first_issuance_block_index
andlast_issuance_block_index
in asset information - Add normalized quantities for the following fields:
fee_paid
fee_provided
fee_required
fee_required_remaining
fee_provided_remaining
fee_fraction_int
quantity_per_unit
btc_amount_normalized
burned
earned
dispense_quantity
- Return asset info for dispenses
- Add
confirmation_target
argument forcompose
endpoints
CLI
- Use
-v
for theDEBUG
level,-vv
for theEVENT
level, and-vvv
for theTRACE
level (it is also possible to repeat the--verbose
flag) - Clean up and refactor CLI outputs for all commands
- Clean up log messages and add numerous additional logging statements
Credits
- Ouziel Slama
- Adam Krellenstein
- Warren Puffett
- Matt Marcello