Commit graph

63 commits

Author SHA1 Message Date
Dagur Valberg Johannsson
1614b84674 Upgrade bitcoincash to 0.32 and add TokenToken AMM pool indexing
Migrate off the deprecated bitcoincash 0.29 API (Amount/Version types,
FromHex -> FromStr/parse, non-exhaustive Network) across the indexer and
tests.

Add indexing of native token-A <-> token-B (TokenToken) AMM pools:

- tokentoken_pool / tokentoken_pool_history_entry tables in cauldron.db,
  created via an always-run idempotent migration (no DB_VERSION bump, so
  existing databases upgrade in place)
- block-path indexing sharing the cauldron write transaction and reorg
  undo, with creation/swap/withdrawal state tracking and reserve deltas
- mempool indexing: electrum mempool.get filters on the tokentoken
  contract code (spends) and the CONJURE op_return hint (creations);
  first_seen_timestamp reconciles with mtp on confirmation
- RPC endpoints /tokentoken/pool/active (pair lookup, order-insensitive)
  and /tokentoken/tokens

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 16:18:35 +02:00
jakobsn
dd4ffb5e3b Remove oracle_cash quickfix introduced Apr 24 2026 2026-06-09 13:18:53 +00:00
jakobsn
f56cc16d93 using oracles cash feed 2026-04-24 05:19:43 +00:00
Dagur Valberg Johannsson
c7eb5bcc36 Added support for indexing Moria contracts 2026-03-30 23:52:29 +02:00
jakobsn
bcab4db2fe Cachecandles 2026-03-25 11:38:10 +00:00
Dagur Valberg Johannsson
f421327a5d
Switch to tokio and sqlx
This makes the application fully async; freeing web server threads to
handle new connections when waiting on SQL queries.

Additionally sqlx will allow easier move to a different database if
needed in the future.

Includes some SQL optimizations as well (slow queries more easliy identifiable
with sqlx).
2026-02-18 10:16:51 +01:00
Dagur Valberg Johannsson
3ff73473df
Add /health endpoint 2026-02-10 15:36:21 +01:00
Dagur Valberg Johannsson
bac43bbb98
Make DB read pool size configurable 2026-02-10 14:49:28 +01:00
Dagur Valberg Johannsson
7ad0303209
Add WebSocket support 2026-02-03 09:39:12 +01:00
Dagur Valberg Johannsson
d8929dc913 Merge branch 'crc20-fix' into 'master'
Fix cross-database query bug in CRC20 BCMR filtering

See merge request riftenlabs/riftenlabs-indexer!61
2026-02-02 20:11:19 +00:00
Dagur Valberg Johannsson
b32a3e54cc Fix cross-database query bug in CRC20 BCMR filtering
The previous commit tried to query bcmr_data table from the crc20
database connection, but bcmr_data exists only in the bcmr database.

Fix by introducing STATE_SKIP_HAS_BCMR to mark tokens that have BCMR
data. The CRC20 fetcher now queries the bcmr database separately to
find candidates with BCMR data, marks them in the crc20 database, and
skips them in future iterations.
2026-02-02 21:03:11 +01:00
Dagur Valberg Johannsson
2b29590211
Do not serve requests during IBD
Do not serve old data; reject RPC requests during IBD.
2026-02-02 12:08:04 +01:00
Dagur Valberg Johannsson
d85bc2c9db
Update copyright headers 2026-01-21 12:37:13 +01:00
Dagur Valberg Johannsson
ec20a2ad75 Add graceful shutdown for background threads
Introduce a shutdown flag and Rocket fairing that signals background
threads to exit cleanly when Ctrl+C is pressed. Affects the indexing
thread, metrics updater, and block receiver loop.
2026-01-21 12:23:08 +01:00
Dagur Valberg Johannsson
50cd23dd34
Add RPC call to retrieve pool ID
Add a call that returns a pool ID given an utxo
2026-01-09 15:29:05 +01:00
Dagur Valberg Johannsson
a6c6159eba
Add Chipnet support 2026-01-09 13:46:58 +01:00
jakobsn
885dde9534 Resolve "Panic occurred: attempt to multiply with overflow" 2025-10-03 13:32:37 +00:00
Jakob Notland
7e7f5b9bc7 Expose first pool created timestamp 2025-09-17 11:11:21 +02:00
jakobsn
f83f472656
Goodsearchandsort 2025-09-05 13:53:10 +00:00
Dagur Valberg Johannsson
14a7486c1d
rpc: Add /volume endpoints
Add /volume endpoints that use the new token/sats delta entries for
faster volume queries.
2025-08-18 09:53:40 +02:00
Dagur Valberg Johannsson
6c13775475
Add simple db version check 2025-08-15 22:26:03 +02:00
Dagur Valberg Johannsson
e2cd74f68c
Delay CRC20 indexing
Delay indexing CRC20 details; as the electrum queries can be slow and
interfere with the indexing.
2025-08-15 21:06:35 +02:00
Dagur Valberg Johannsson
7d9352cf53
Fix clippy issues 2025-07-16 13:52:46 +02:00
jakobsn
b17b8a3947 Resolve "Oracle prices" 2025-06-17 14:04:26 +00:00
Dagur Valberg Johannsson
3d83bdee47 Merge branch 'candlesticks2' into 'master'
Candlesticks2

See merge request riftenlabs/riftenlabs-indexer!20
2025-06-17 13:22:46 +00:00
jakobsn
d1e265cf2f Candlesticks2 2025-06-17 13:22:46 +00:00
Dagur Valberg Johannsson
8b16e3d1f3
bump minor deps 2025-06-12 10:08:22 +02:00
Dagur Valberg Johannsson
78e391560f
Added support for delphi oracle
This allows fetching historical asset prices from the blockchain.
2025-05-21 13:33:26 +02:00
Dagur Valberg Johannsson
ebe63ce932
Improve db initialization 2025-02-14 18:35:12 +01:00
Dagur Valberg Johannsson
33aebb0318
bug: Foreign keys not enforced
sqlite was not properly enforcing foreign keys, keeping conflicted
transactions in the database
2024-12-19 13:21:57 +01:00
Dagur Valberg Johannsson
b1e88ff261
rpc: Add pool history call 2024-11-13 11:28:27 +01:00
jakobsn
1248929fb4 Search tokens 2024-10-31 10:55:29 +00:00
Dagur Valberg Johannsson
b4b9bf1eb5
Make rostrum server configurable
New default set to localhost
2024-10-25 15:22:44 +02:00
Dagur Valberg Johannsson
e4e7ec3b71
Add aggregated APY endpoint
Add an endpoint that gives a APY value across multiple micro-pools
2024-10-23 16:54:06 +02:00
Dagur Valberg Johannsson
751c1df6a7
Add CRC20 index 2024-10-21 13:35:24 +02:00
jakobsn
07c75b1a7e Tokens page 2024-10-14 11:18:50 +00:00
Dagur Valberg Johannsson
5aebe7bdaf
Use package electrum-client-netagnostic
Replace package that pointed at a git repo with
electrum-client-netagnostic.
2024-10-08 22:15:46 +02:00
Dagur Valberg Johannsson
528cc79725
API call for latest transactions 2024-09-25 13:39:06 +02:00
Dagur Valberg Johannsson
cd6ce4d4ef
Add well-known BCMR sources
This adds additional BCMR data sources, mainly OTR.
2024-09-10 22:39:30 +02:00
Dagur Valberg Johannsson
675b3f08f9
rpc: Unique addresses
RPC method to show number of unique addresses interracting with cauldron
2024-09-04 13:25:36 +02:00
Dagur Valberg Johannsson
3ba04dfd58
Cache list_by_volume call
This is an expensive call used by all users of Cauldron DEX; cache for
60 seconds.
2024-05-29 08:46:35 +02:00
Dagur Valberg Johannsson
e38eaaa26c
Add BCMR indexer
This adds BCMR indexer, including downloading and parsing the actual
BCMR files.
2024-05-27 11:56:35 +02:00
Dagur Valberg Johannsson
49730f27ca
chore: Fix clippy issue 2024-05-06 11:18:05 +02:00
Dagur Valberg Johannsson
76f0dcdb31
rpc: List pools by token and pkh 2024-04-03 21:45:18 +02:00
Dagur Valberg Johannsson
17f0d6017f
Add contract count for specific token 2024-04-03 21:44:42 +02:00
Dagur Valberg Johannsson
1b38f65224
Add 'valuelocked' endpoints 2024-04-03 21:44:42 +02:00
Dagur Valberg Johannsson
b80b1144da
api: current price 2024-04-02 13:17:25 +02:00
Dagur Valberg Johannsson
c8ca5cc698
Add volume endpoint 2024-03-21 11:15:44 +01:00
Dagur Valberg Johannsson
e52314c138
rpc: Add contract count
Fixes #2
2024-03-18 12:34:46 +01:00
Dagur Valberg Johannsson
a4c194ff3e
Enable foreign key pragma with every connection 2024-03-14 15:00:38 +01:00