mirror of
https://github.com/alexgo-io/bitcoin-indexer.git
synced 2026-01-12 22:43:06 +08:00
chore: renaming - followup
This commit is contained in:
16
README.md
16
README.md
@@ -1,5 +1,5 @@
|
||||
|
||||
/ / ▶ Hord
|
||||
/ / ▶ Ordhook
|
||||
/ --- / Ordinal indexing engine based on Chainhook.
|
||||
/ / Build indexes, standards and protocols on top of Ordinals and Inscriptions (BRC20, etc).
|
||||
|
||||
@@ -70,17 +70,17 @@ Assuming:
|
||||
|
||||
`2)` a local HTTP server running on port `3000` exposing a `POST /api/events` endpoint,
|
||||
|
||||
A configuration file `Hord.toml` can be generated using the command:
|
||||
A configuration file `Ordhook.toml` can be generated using the command:
|
||||
|
||||
```console
|
||||
$ ordhook config new --mainnet
|
||||
✔ Generated config file Hord.toml
|
||||
✔ Generated config file Ordhook.toml
|
||||
```
|
||||
|
||||
After adjusting the `Hord.toml` settings to make them match the `bitcoind` configuration, the following command can be ran:
|
||||
After adjusting the `Ordhook.toml` settings to make them match the `bitcoind` configuration, the following command can be ran:
|
||||
|
||||
```
|
||||
$ ordhook scan blocks 767430 767753 --post-to=http://localhost:3000/api/events --config-path=./Hord.toml
|
||||
$ ordhook scan blocks 767430 767753 --post-to=http://localhost:3000/api/events --config-path=./Ordhook.toml
|
||||
```
|
||||
|
||||
`ordhook` will retrieve the full Ordinals activities (including the inscriptions content) and send all these informations to the `http://localhost:3000/api/events` HTTP POST endpoint.
|
||||
@@ -91,10 +91,10 @@ $ ordhook scan blocks 767430 767753 --post-to=http://localhost:3000/api/events -
|
||||
`ordhook` can be ran as a service for streaming and processing new blocks appended to the Bitcoin blockchain.
|
||||
|
||||
```console
|
||||
$ ordhook service start --post-to=http://localhost:3000/api/events --config-path=./Hord.toml
|
||||
$ ordhook service start --post-to=http://localhost:3000/api/events --config-path=./Ordhook.toml
|
||||
```
|
||||
|
||||
New `http-post` endpoints can also be added dynamically by spinning up a redis server and adding the following section in the `Hord.toml` configuration file:
|
||||
New `http-post` endpoints can also be added dynamically by spinning up a redis server and adding the following section in the `Ordhook.toml` configuration file:
|
||||
|
||||
```toml
|
||||
[http_api]
|
||||
@@ -105,7 +105,7 @@ database_uri = "redis://localhost:6379/"
|
||||
Running `ordhook` with the command
|
||||
|
||||
```console
|
||||
$ ordhook service start --config-path=./Hord.toml
|
||||
$ ordhook service start --config-path=./Ordhook.toml
|
||||
```
|
||||
|
||||
will spin up a HTTP API for managing events destinations.
|
||||
|
||||
@@ -56,7 +56,7 @@ enum Command {
|
||||
Service(ServiceCommand),
|
||||
/// Perform maintenance operations on local databases
|
||||
#[clap(subcommand)]
|
||||
Db(HordDbCommand),
|
||||
Db(OrdhookDbCommand),
|
||||
}
|
||||
|
||||
#[derive(Subcommand, PartialEq, Clone, Debug)]
|
||||
@@ -261,16 +261,16 @@ struct StartCommand {
|
||||
}
|
||||
|
||||
#[derive(Subcommand, PartialEq, Clone, Debug)]
|
||||
enum HordDbCommand {
|
||||
enum OrdhookDbCommand {
|
||||
/// Initialize a new ordhook db
|
||||
#[clap(name = "new", bin_name = "new")]
|
||||
New(SyncHordDbCommand),
|
||||
New(SyncOrdhookDbCommand),
|
||||
/// Catch-up ordhook db
|
||||
#[clap(name = "sync", bin_name = "sync")]
|
||||
Sync(SyncHordDbCommand),
|
||||
Sync(SyncOrdhookDbCommand),
|
||||
/// Rebuild inscriptions entries for a given block
|
||||
#[clap(name = "drop", bin_name = "drop")]
|
||||
Drop(DropHordDbCommand),
|
||||
Drop(DropOrdhookDbCommand),
|
||||
/// Check integrity
|
||||
#[clap(name = "check", bin_name = "check")]
|
||||
Check(CheckDbCommand),
|
||||
@@ -361,7 +361,7 @@ struct ScanTransfersCommand {
|
||||
}
|
||||
|
||||
#[derive(Parser, PartialEq, Clone, Debug)]
|
||||
struct UpdateHordDbCommand {
|
||||
struct UpdateOrdhookDbCommand {
|
||||
/// Starting block
|
||||
pub start_block: u64,
|
||||
/// Ending block
|
||||
@@ -374,14 +374,14 @@ struct UpdateHordDbCommand {
|
||||
}
|
||||
|
||||
#[derive(Parser, PartialEq, Clone, Debug)]
|
||||
struct SyncHordDbCommand {
|
||||
struct SyncOrdhookDbCommand {
|
||||
/// Load config file path
|
||||
#[clap(long = "config-path")]
|
||||
pub config_path: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Parser, PartialEq, Clone, Debug)]
|
||||
struct DropHordDbCommand {
|
||||
struct DropOrdhookDbCommand {
|
||||
/// Starting block
|
||||
pub start_block: u64,
|
||||
/// Ending block
|
||||
@@ -392,14 +392,14 @@ struct DropHordDbCommand {
|
||||
}
|
||||
|
||||
#[derive(Parser, PartialEq, Clone, Debug)]
|
||||
struct PatchHordDbCommand {
|
||||
struct PatchOrdhookDbCommand {
|
||||
/// Load config file path
|
||||
#[clap(long = "config-path")]
|
||||
pub config_path: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Parser, PartialEq, Clone, Debug)]
|
||||
struct MigrateHordDbCommand {
|
||||
struct MigrateOrdhookDbCommand {
|
||||
/// Load config file path
|
||||
#[clap(long = "config-path")]
|
||||
pub config_path: Option<String>,
|
||||
@@ -626,25 +626,25 @@ async fn handle_command(opts: Opts, ctx: &Context) -> Result<(), String> {
|
||||
let config = Config::default(cmd.regtest, cmd.testnet, cmd.mainnet, &None)?;
|
||||
let config_content = generate_config(&config.network.bitcoin_network);
|
||||
let mut file_path = PathBuf::new();
|
||||
file_path.push("Hord.toml");
|
||||
file_path.push("Ordhook.toml");
|
||||
let mut file = File::create(&file_path)
|
||||
.map_err(|e| format!("unable to open file {}\n{}", file_path.display(), e))?;
|
||||
file.write_all(config_content.as_bytes())
|
||||
.map_err(|e| format!("unable to write file {}\n{}", file_path.display(), e))?;
|
||||
println!("Created file Hord.toml");
|
||||
println!("Created file Ordhook.toml");
|
||||
}
|
||||
},
|
||||
Command::Db(HordDbCommand::New(cmd)) => {
|
||||
Command::Db(OrdhookDbCommand::New(cmd)) => {
|
||||
let config = Config::default(false, false, false, &cmd.config_path)?;
|
||||
initialize_ordhook_db(&config.expected_cache_path(), &ctx);
|
||||
}
|
||||
Command::Db(HordDbCommand::Sync(cmd)) => {
|
||||
Command::Db(OrdhookDbCommand::Sync(cmd)) => {
|
||||
let config = Config::default(false, false, false, &cmd.config_path)?;
|
||||
initialize_ordhook_db(&config.expected_cache_path(), &ctx);
|
||||
let service = Service::new(config, ctx.clone());
|
||||
service.update_state(None).await?;
|
||||
}
|
||||
Command::Db(HordDbCommand::Repair(subcmd)) => match subcmd {
|
||||
Command::Db(OrdhookDbCommand::Repair(subcmd)) => match subcmd {
|
||||
RepairCommand::Blocks(cmd) => {
|
||||
let config = Config::default(false, false, false, &cmd.config_path)?;
|
||||
let mut ordhook_config = config.get_ordhook_config();
|
||||
@@ -691,7 +691,7 @@ async fn handle_command(opts: Opts, ctx: &Context) -> Result<(), String> {
|
||||
.await?;
|
||||
}
|
||||
},
|
||||
Command::Db(HordDbCommand::Check(cmd)) => {
|
||||
Command::Db(OrdhookDbCommand::Check(cmd)) => {
|
||||
let config = Config::default(false, false, false, &cmd.config_path)?;
|
||||
{
|
||||
let blocks_db =
|
||||
@@ -711,7 +711,7 @@ async fn handle_command(opts: Opts, ctx: &Context) -> Result<(), String> {
|
||||
println!("{:?}", missing_blocks);
|
||||
}
|
||||
}
|
||||
Command::Db(HordDbCommand::Drop(cmd)) => {
|
||||
Command::Db(OrdhookDbCommand::Drop(cmd)) => {
|
||||
let config = Config::default(false, false, false, &cmd.config_path)?;
|
||||
let blocks_db =
|
||||
open_readwrite_ordhook_db_conn_rocks_db(&config.expected_cache_path(), &ctx)?;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
pub mod file;
|
||||
pub mod generator;
|
||||
|
||||
use crate::core::HordConfig;
|
||||
use crate::core::OrdhookConfig;
|
||||
pub use chainhook_sdk::indexer::IndexerConfig;
|
||||
use chainhook_sdk::observer::EventObserverConfig;
|
||||
use chainhook_sdk::types::{
|
||||
@@ -110,8 +110,8 @@ impl Config {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_ordhook_config(&self) -> HordConfig {
|
||||
HordConfig {
|
||||
pub fn get_ordhook_config(&self) -> OrdhookConfig {
|
||||
OrdhookConfig {
|
||||
network_thread_max: self.limits.bitcoin_concurrent_http_requests_max,
|
||||
ingestion_thread_max: self.limits.max_number_of_processing_threads,
|
||||
ingestion_thread_queue_size: 4,
|
||||
|
||||
@@ -28,7 +28,7 @@ use crate::db::{
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct HordConfig {
|
||||
pub struct OrdhookConfig {
|
||||
pub network_thread_max: usize,
|
||||
pub ingestion_thread_max: usize,
|
||||
pub ingestion_thread_queue_size: usize,
|
||||
|
||||
@@ -28,7 +28,7 @@ use crate::{
|
||||
},
|
||||
inscription_tracking::augment_block_with_ordinals_transfer_data,
|
||||
},
|
||||
HordConfig,
|
||||
OrdhookConfig,
|
||||
},
|
||||
db::{get_any_entry_in_ordinal_activities, open_readonly_ordhook_db_conn},
|
||||
};
|
||||
@@ -158,7 +158,7 @@ pub fn process_blocks(
|
||||
sequence_cursor: &mut SequenceCursor,
|
||||
cache_l2: &Arc<DashMap<(u32, [u8; 8]), LazyBlockTransaction, BuildHasherDefault<FxHasher>>>,
|
||||
inscriptions_db_conn_rw: &mut Connection,
|
||||
ordhook_config: &HordConfig,
|
||||
ordhook_config: &OrdhookConfig,
|
||||
post_processor: &Option<Sender<BitcoinBlockData>>,
|
||||
ctx: &Context,
|
||||
) -> Vec<BitcoinBlockData> {
|
||||
@@ -253,7 +253,7 @@ pub fn process_block(
|
||||
cache_l1: &mut BTreeMap<(TransactionIdentifier, usize), TraversalResult>,
|
||||
cache_l2: &Arc<DashMap<(u32, [u8; 8]), LazyBlockTransaction, BuildHasherDefault<FxHasher>>>,
|
||||
inscriptions_db_tx: &Transaction,
|
||||
ordhook_config: &HordConfig,
|
||||
ordhook_config: &OrdhookConfig,
|
||||
ctx: &Context,
|
||||
) -> Result<(), String> {
|
||||
let any_processable_transactions = parallelize_inscription_data_computations(
|
||||
|
||||
@@ -17,7 +17,7 @@ use fxhash::FxHasher;
|
||||
use rusqlite::{Connection, Transaction};
|
||||
|
||||
use crate::{
|
||||
core::HordConfig,
|
||||
core::OrdhookConfig,
|
||||
db::{
|
||||
find_blessed_inscription_with_ordinal_number,
|
||||
find_latest_cursed_inscription_number_at_block_height,
|
||||
@@ -68,7 +68,7 @@ pub fn parallelize_inscription_data_computations(
|
||||
cache_l1: &mut BTreeMap<(TransactionIdentifier, usize), TraversalResult>,
|
||||
cache_l2: &Arc<DashMap<(u32, [u8; 8]), LazyBlockTransaction, BuildHasherDefault<FxHasher>>>,
|
||||
inscriptions_db_tx: &Transaction,
|
||||
ordhook_config: &HordConfig,
|
||||
ordhook_config: &OrdhookConfig,
|
||||
ctx: &Context,
|
||||
) -> Result<bool, String> {
|
||||
let (mut transactions_ids, l1_cache_hits) =
|
||||
|
||||
Reference in New Issue
Block a user