674 Commits

Author SHA1 Message Date
Rafael Cárdenas
74dca812df chore: rename chainhook-postgres to postgres and fold chainhook-types-rs into bitcoind (#464)
* chainhook types

* rename postgres

* fmt
2025-03-14 07:28:28 -06:00
Rafael Cárdenas
9e9eac81ea refactor: standardize block download pipeline across indexers (#463)
* zmq after chain tip

* some progress

* block pool advance

* runloop finished

* renames

* runs first time

* log levels

* start connecting runes

* compress block opt

* remove dead code

* remove dead code chainhook sdk

* remove ordhook dead code

* rollback install

* auto fmt

* clippy fixes

* fmt

* rollback chain tip

* api test

* api metrics fix

* rename

* standard logs

* ordinals start chain tip

* chain tips

* ci

* clippy

* fix tests

* remove dead code
2025-03-13 08:26:46 -06:00
ASuciuX
5fb8b02a9e feat: clippy and fmt support (#452)
* feat(cli): add custom commands `bitcoin-indexer-fmt` and `bitcoin-indexer-clippy` 
* chore: format and clippy the codebase
* feat(ci): add doctest ci job
* feat(ci): support format on save for rust files
2025-03-07 15:42:50 +02:00
Rafael Cárdenas
b611ff3423 fix(ordinals): track multiple sat transfers in the same block correctly (#460) 2025-03-06 08:21:40 -06:00
Rafael Cárdenas
fd2a8496e3 feat(runes): add runes indexer (#453)
* rename ordhook-cli to cli

* rename ordhook-cli

* update configs

* update config to future support runehook integration

* new code

* add ci

* files

* standard

* add files

* rename binary to bitcoin-indexer and commands to ordinals from ordhook

* config component

* integration

* runes build

* fix runes

* indexer toml

* add runes tests to ci

* rename dockerfile

* fix: doctest

---------

Co-authored-by: ASuciuX <asuciu@hiro.so>
2025-02-28 13:22:27 -06:00
Rafael Cárdenas
68158786f0 fix: display unbound inscription satpoints as all zeros with unbound sequence as offset (#445)
* feat: start indexing brc20 balance history

* fix: api support

* style: revert

* remove extra

* track unbound seq

* test sequence

* remove old coinbase calculations
2025-02-21 09:31:39 -06:00
Rafael Cárdenas
41438aca96 fix(brc20): historical token balance (#444)
* feat: start indexing brc20 balance history

* fix: api support

* style: revert

* remove extra
2025-02-20 10:59:25 -06:00
ASuciuX
a51382d9c4 remove extra comments about migrating imports from bitcoin crate 2025-02-19 18:28:44 +02:00
ASuciuX
21709b3b57 move bitcoind file and auxiliary 2025-02-19 17:46:42 +02:00
Rafael Cárdenas
acfda83757 fix: calculate charms correctly when inscription is unbound (#440) 2025-02-18 14:14:37 -06:00
Rafael Cárdenas
4291eabba7 feat: index inscription charms (#433)
* calculate charms

* migration and insert

* drop unused code

* reinscription charm

* test progress

* test: charms
2025-02-18 08:48:26 -06:00
Rafael Cárdenas
84e189b9b4 fix: kill process when a streamed block fails to index (#431) 2025-02-15 18:21:07 -06:00
Rafael Cárdenas
19c8a79cd2 fix: remove double parsing of inscriptions (#421) 2025-02-13 09:01:45 -06:00
Rafael Cárdenas
216cd52c0e fix: clean up rocksdb connections during rollbacks (#420)
* fix: only one rocksdb conn

* unify context

* improve logs

* clean up connections

* revert sequencing

* improve logs

* revert logs
2025-02-13 09:01:24 -06:00
Rafael Cárdenas
48b3ccef48 chore: improve log messages for zeromq and fork processing (#422)
* fix: only one rocksdb conn

* unify context

* improve logs

* clean up connections

* revert sequencing

* improve logs

* revert

* chore: standard log
2025-02-12 17:23:31 -06:00
ASuciuX
b4e0157a56 chore: unify package versions to workspace.package.version 2.2.5 2025-02-12 17:43:55 +02:00
Rafael Cárdenas
fcffa7e5c1 fix: upgrade ord dependencies and integrate chainhook-sdk code (#397)
* chore: upgrade ord code

* chore: deps

* chore: add parents table

* chore: move pg deps to workspace

* fix: delegation works

* chore: import chainhook-sdk code

* chore: move ord to its own component

* ci: dockerfile

* docs: ord readme

* refactor: remove all unused code from chainhook-sdk (#412)

* chore: remove stacks types

* checkpoint before removing predicates

* chore: remove all predicates code

* bitcoin dep

* fix: tests

* fix: api tests
2025-02-11 12:21:30 -06:00
Rafael Cárdenas
205b4c80bd feat: migrate ordinals api to ordhook repo (#389)
* feat: add database migration cli commands

* update cargo lock

* chore: import first api files

* test: cache first

* test: cache

* test: sats

* test: inscription show

* test: inscription transfers

* test: inscriptions index

* test: inscriptions complete

* test: counts

* test: status

* test: block counts

* test: brc20 activity

* test: brc20 holders

* ci: api tests

* ci: update nvmrc path

* ci: remove migration refs

* ci: unused exports

* ci: unused

* ci: build publish

* ci: monorepo

* fix: timestamps

* Update api/ordinals/docs/feature-guides/rate-limiting.md

Co-authored-by: ASuciuX <151519329+ASuciuX@users.noreply.github.com>

* Update api/ordinals/docs/feature-guides/rate-limiting.md

Co-authored-by: ASuciuX <151519329+ASuciuX@users.noreply.github.com>

* Update api/ordinals/docs/overview.md

Co-authored-by: ASuciuX <151519329+ASuciuX@users.noreply.github.com>

* Update api/ordinals/src/api/schemas.ts

Co-authored-by: ASuciuX <151519329+ASuciuX@users.noreply.github.com>

* Update api/ordinals/src/api/schemas.ts

Co-authored-by: ASuciuX <151519329+ASuciuX@users.noreply.github.com>

* fix: warnings

---------

Co-authored-by: ASuciuX <151519329+ASuciuX@users.noreply.github.com>
2025-02-07 13:44:21 -06:00
Rafael Cárdenas
fe842e2e77 fix(brc20): verify ordinal transfers in chunks instead of individually (#394)
* chore: group transfers

* fix: finish integration

* fix: chunk query

* chunk size

* test: indexing

* fix: comments
2025-02-05 13:14:41 -06:00
Rafael Cárdenas
3f10607ba9 fix: store inscription content as is (#391) 2025-01-29 10:51:18 -06:00
Rafael Cárdenas
4afb201006 refactor!: store inscription data in postgres instead of sqlite (#375)
* chore: new pg lib

* chore: migrations and connection code

* brc20 migrations

* connection opts

* fixed columns

* vscode configs

* transaction utils

* chain tip integration

* more progress

* progress

* models

* brc20 progress

* progress

* more

* utils

* models and isnerts

* some more inserts

* ordering support

* remove extra code

* organize

* deadpool

* chain tip

* counts

* optimize transfers table

* optimize reinscriptions

* transfers in same block

* drop blocks structure

* brc20 counts

* token minted supplies

* brc20 insert chunks

* brc20 tweaks

* tweaks

* rollback progress

* restore tests

* fix brc20 tests

* cache tests

* brc20 db tests

* pg docker compose

* fix: pg path

* fix: dockerfile

* test: inscr write

* test: rollbacks

* fix: token minted supply rollback

* fix: ordinals rollback

* chore: upgrade rust

* fix: share rocksdb conn across threads

* chore: search path support

* chore: logs cleanup

* chore: re-enable seq cursor tests

* fix: wire up rollbacks

* fix: brc20 decimal conversion

* fix: recursion parsing

* fix: remove 0x from binary content

* fix: inscription content fixed for real this time

* fix: remove null bytes before inserting

* chore: delete http api

* fix: new pg methods

* fix: all tests

* chore: add pool size config, remove http config

* style: comments
2025-01-04 17:44:58 -06:00
dependabot[bot]
30e8f7a8c4 chore(deps): bump pprof from 0.13.0 to 0.14.0 (#377)
Bumps [pprof](https://github.com/tikv/pprof-rs) from 0.13.0 to 0.14.0.
- [Changelog](https://github.com/tikv/pprof-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tikv/pprof-rs/commits)

---
updated-dependencies:
- dependency-name: pprof
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-16 11:05:12 -06:00
Rafael Cárdenas
d4b67bb6f6 feat: wait for bitcoind to be at chain tip before starting service (#364)
* feat: wait for bitcoind to be at chain tip before starting service

* fix: reset confirmations

* chore: more logs
2024-09-20 11:34:04 -06:00
Rafael Cárdenas
21fcf46fac chore: clean up db sync command (#363)
* chore: clean up db sync command

* fix: test delete db

* chore: tweak log messages
2024-09-19 19:23:39 -06:00
dependabot[bot]
f100e618ca chore(deps): bump micromatch in /components/ordhook-sdk-js (#358)
Bumps [micromatch](https://github.com/micromatch/micromatch) from 4.0.5 to 4.0.8.
- [Release notes](https://github.com/micromatch/micromatch/releases)
- [Changelog](https://github.com/micromatch/micromatch/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/micromatch/compare/4.0.5...4.0.8)

---
updated-dependencies:
- dependency-name: micromatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-17 10:59:35 -06:00
Rafael Cárdenas
a0300cecc2 test: inscription indexing, parsing, sequencing and satoshi numbering (#359)
* feat: add prometheus monitoring

* chore: progress

* fix: create object

* chore: port config

* chore: set initial metrics on start

* fix: monitor predicates

* test: add

* test: inscription indexing

* test: tools and parsing start

* test: raw blocks

* test: cursor

* fix: test drop

* test: cursor more

* refactor: rocksdb separate file

* refactor: db into files

* refactor: delete ordhook config, unify use of config

* fix: consolidate db initialization

* test: full block sequencing

* test: sat numbering with cache

* test: sat coinbase fees

* test: uncached traversal

* test: non spend

* test: sat tracking post transfer

* test: burnt sat pos

* test: integration test transfeR

* fix: witness test

* test: consolidate block

* test: indexing channel

* test: archiver

* test: transfers channel

* test: brc20 augment
2024-09-17 10:54:20 -06:00
Rafael Cárdenas
f35e1d00e7 feat: add prometheus monitoring (#356)
* feat: add prometheus monitoring

* chore: progress

* fix: create object

* chore: port config

* chore: set initial metrics on start

* fix: monitor predicates

* test: add
2024-09-05 14:50:57 -06:00
Rafael Cárdenas
5692426e4b fix: only create brc-20 db connection and cache if required (#357)
* fix: unify db create

* fix: test

* fix: create on drop

* fix: build

* chore: remove warnings

* fix: add some logs

* fix: blocking thread
2024-09-04 08:59:21 -06:00
Rafael Cárdenas
7a65fdf107 feat: support a separate storage directory for observers.sqlite (#354)
* chore: observers db dir

* fix: control observers path only on db functions

* chore: test structure

* test: incorrect predicate

* fix: test predicate registration

* test: more

* fix: duplicate uuid test
2024-09-03 12:21:56 -06:00
Rafael Cárdenas
caacff7c4f feat!: support brc20 activity on scan blocks command (#350)
* fix: meta protocols for block scan

* chore: show brc20 operations on block scan

* docs: readme

* chore: generator
2024-07-31 11:37:43 -06:00
Rafael Cárdenas
39774a9f86 feat!: keep original deployed ticker for brc20 tokens (#349) 2024-07-30 10:02:18 -06:00
Rafael Cárdenas
d80388b505 fix: also check config when looking for brc20 db connection (#347) 2024-07-29 16:21:41 -06:00
Rafael Cárdenas
7ee763a263 fix: abort scan on predicate action error (#345) 2024-07-23 13:29:27 -06:00
Rafael Cárdenas
146bbcd584 chore: use try_ macros for all log messages (#342) 2024-07-22 13:00:36 -06:00
Rafael Cárdenas
b28b92ebab fix: validate and wait for bitcoind block height responses (#340)
* fix: validate and wait for bitcoind block height responses

* chore: comments
2024-07-22 10:19:51 -06:00
dependabot[bot]
54296f6c03 chore(deps): bump braces in /components/ordhook-sdk-js (#332)
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-01 17:06:18 -06:00
Ludo Galabru
a593995e60 fix: nested readwrite connection (#327) 2024-06-26 10:14:07 -06:00
Ludo Galabru
6c9ea060ef fix: retrieving block height from inscriptions db 2024-06-18 18:03:47 -04:00
Ludo Galabru
cbb4d6db06 Merge branch 'develop' into fix/double-write 2024-06-18 13:18:27 -04:00
Ludo Galabru
eb3020b89c chore: remove undesired comments 2024-06-18 13:17:00 -04:00
Rafael Cárdenas
122bfdfd80 fix: augment brc20 tx by tx_index (#315)
* fix: augment tx by tx_index

* chore: better log
2024-06-18 11:15:05 -06:00
Ludo Galabru
f6a2a79478 refactor: delete_data_in_ordhook_db 2024-06-18 12:45:21 -04:00
Ludo Galabru
2b235d2e4e Merge pull request #312 from hirosystems/fix/reboot
fix: sequence misalignment caused in certain conditions
2024-06-11 11:00:27 -04:00
Rafael Cárdenas
26d8ed9f5c fix: consider meta protocols when switching to stream (#311)
* fix: consider meta protocols when switching to stream

* fix: write augmented block to db
2024-06-11 08:57:16 -06:00
Ludo Galabru
a76a037cf8 fix: base catchup on inscriptions db, vs blocks db 2024-06-11 10:10:59 -04:00
Ludo Galabru
1df0f7c130 chore: cargo fmt 2024-06-11 10:10:03 -04:00
Rafael Cárdenas
b31f6bdea7 fix: set is_streaming_blocks to false when scanning (#309) 2024-06-04 13:16:47 -06:00
Ludo Galabru
7a8dca53c1 fix: issue #296 (#300)
* fix: synthetic predicate

* fix: set height 0 for regtest, etc.

* fix: issue #296

* chore: update chainhook-sdk

* fix: use latest chainhook

* fix: augment block with brc20 while indexing

* fix: force input 0

---------

Co-authored-by: Rafael Cardenas <rafael@rafaelcr.com>
2024-05-24 11:36:47 -06:00
Rafael Cárdenas
729affb699 feat: add BRC-20 indexing (#284)
* feat: first version of brc20 parser

* feat: verifier

* fix: parse with tests

* test: extra parser stuff

* feat: verifier with tests, basic wiring

* test: transfer sends

* fix: add deploy op to ledger

* chore: upgrade to latest chainhook

* feat: start adapting for scan

* feat: wire up scan

* feat: self minted tokens

* feat: self mint and drop data

* fix: transaction commit and rollback

* chore: update dependencies

* chore: update rust

* chore: cascade chainhook changes in ordhook

* fix: ordinal-sdk-js build

* chore: update deps

* fix: centralize db init

* fix: check brc20 activation height

* chore: downgrade brc-20 warns to debug

* feat: cache tokens and minted supplies per block

* feat: memory cache

* feat: cache module

* feat: use LRU cache for brc20

* feat: configurable lru size

* fix: blacklist invalid transfers

* chore: block cache struct

* chore: config meta protocols

* fix: use cache across all blocks

* chore: formatting

* test: cache and utils

* fix: address balance cache miss

* fix: flush db caches on miss

* fix: check db cache length before flushing

* chore: tweak log msgs

* test: transfer full balance

* fix: cache miss on avail balance deltas

* fix: save tx_index in ledger table

* test: null bytes

* fix: remove unique index ledger

---------

Co-authored-by: Ludo Galabru <ludo@hiro.so>
Co-authored-by: Ludo Galabru <ludovic@galabru.com>
2024-05-09 11:45:22 -06:00
Ludo Galabru
d1b995b460 fix: jubilee block transition 2024-02-12 10:52:24 -05:00