Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
Cargo.lock
!justfile
*.db
*.hints
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[workspace]
members = ["accumulator", "hintfile", "network"]
default-members = ["accumulator", "hintfile", "network"]
resolver = "3"
resolver = "2"

[workspace.dependencies]
bitcoin = { git = "https://github.com/rust-bitcoin/rust-bitcoin", default-features = false, rev = "16cc257c3695dea0e7301a5fa9cab44b8ed60598" }
2 changes: 1 addition & 1 deletion accumulator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "accumulator"
version = "0.1.0"
edition = "2024"
edition = "2021"

[dependencies]
bitcoin = { workspace = true }
Expand Down
96 changes: 0 additions & 96 deletions flake.lock

This file was deleted.

27 changes: 0 additions & 27 deletions flake.nix

This file was deleted.

7 changes: 6 additions & 1 deletion hintfile/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
[package]
name = "hintfile"
version = "0.1.0"
edition = "2024"
edition = "2021"

[dependencies]
bitcoin = { workspace = true }
kernel = { package = "bitcoinkernel", git = "https://github.com/alexanderwiederin/rust-bitcoinkernel.git" }

[[bin]]
name = "construct"
40 changes: 40 additions & 0 deletions hintfile/src/bin/construct.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
use std::{fs::File, sync::Arc};

use bitcoin::consensus;
use kernel::{ChainType, ChainstateManager, ChainstateManagerOptions, ContextBuilder, KernelError};

fn main() {
let mut file = File::create("./signet.hints").unwrap();

let mut args = std::env::args();
let _ = args.next();
let data_dir = args.next().expect("Usage: <path_to_bitcoin_dir>");
let mut blocks_dir = data_dir.clone();
blocks_dir.push_str("/blocks");
println!("Initializing");
let ctx = ContextBuilder::new()
.chain_type(ChainType::SIGNET)
.build()
.unwrap();
let options = ChainstateManagerOptions::new(&ctx, &data_dir, &blocks_dir).unwrap();
let context = Arc::new(ctx);
let chainman = ChainstateManager::new(options, context).unwrap();
println!("Chain state initialized");
let genesis = chainman.get_block_index_genesis();
let mut current = chainman.get_next_block_index(genesis).unwrap();
loop {
let block = chainman.read_block_data(&current).unwrap();
let bytes: Vec<u8> = block.into();
let block = consensus::deserialize::<bitcoin::Block>(&bytes).unwrap();
let (_, transactions) = block.into_parts();
println!("On block {}", current.height());
let mut delta: u64 = 0;
let mut block_offsets: Vec<u64> = Vec::new();
for tx in transactions {}
match chainman.get_next_block_index(current) {
Ok(next) => current = next,
Err(KernelError::OutOfBounds) => break,
Err(e) => panic!("{e}"),
}
}
}
2 changes: 1 addition & 1 deletion network/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "peers"
version = "0.1.0"
edition = "2024"
edition = "2021"

[dependencies]
tokio = { version = "1", default-features = false, optional = true, features = [
Expand Down
Loading