From fa98283df60362c77d4b7ffb716610dc5632e715 Mon Sep 17 00:00:00 2001 From: bitcoinafterlife Date: Mon, 19 Jan 2026 20:03:17 -0400 Subject: [PATCH] version --- Cargo.lock | 4 ++-- Cargo.toml | 56 +++++++++++++++++++++---------------------- README.md | 2 +- bal-pusher.env | 2 +- src/bin/bal-pusher.rs | 8 ++++++- src/bin/bal-server.rs | 11 +++------ 6 files changed, 42 insertions(+), 41 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3aee00b..2f24dd1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -124,8 +124,8 @@ dependencies = [ ] [[package]] -name = "bal-server" -version = "0.1.0" +name = "bal_server" +version = "0.2.3" dependencies = [ "base64 0.22.1", "bitcoin", diff --git a/Cargo.toml b/Cargo.toml index 0872798..482f209 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,33 +1,33 @@ [package] -name = "bal-server" -version = "0.1.0" -edition = "2021" +name = "bal_server" +version = "0.2.3" +edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -base64 = "0.22.1" -bs58 = "0.4.0" -bytes = "1.2" -bitcoin = { version = "0.32.5" } -bitcoincore-rpc = "0.19.0" -bitcoincore-rpc-json = "0.19.0" -byteorder = "1.5.0" -confy = "0.6.1" -chrono = "0.4.40" -env_logger = "0.11.5" -hex = "0.4.3" -hex-conservative = "0.1.1" -hyper = { version = "1.3.1", features = ["http1","server"] } -hyper-util = { version = "0.1.3", features = ["tokio"] } -http-body-util = "0.1" -log = "0.4.21" -openssl = { version = "0.10.74", features = ["vendored"] } -sha2 = "0.10.8" -serde = { version = "1.0.152", features = ["derive"] } -serde_json = "1.0.116" -sqlite = "0.34.0" -regex = "1.10.4" -reqwest = { version = "0.12.24", features = ["json","socks"] } -tokio = { version = "1", features = ["rt", "net","macros","rt-multi-thread"] } # Keep only necessary runtime components -zmq = "0.10.0" +base64 = { version = "0.22.1" } +bs58 = { version = "0.4.0" } +bytes = { version = "1.2" } +bitcoin = { version = "0.32.5" } +bitcoincore-rpc = { version = "0.19.0" } +bitcoincore-rpc-json = { version = "0.19.0" } +byteorder = { version = "1.5.0" } +confy = { version = "0.6.1" } +chrono = { version = "0.4.40" } +env_logger = { version = "0.11.5" } +hex = { version = "0.4.3" } +hex-conservative = { version = "0.1.1" } +hyper = { version = "1.3.1", features = ["http1","server"] } +hyper-util = { version = "0.1.3", features = ["tokio"] } +http-body-util = { version = "0.1" } +log = { version = "0.4.21" } +openssl = { version = "0.10.74", features = ["vendored"] } +sha2 = { version = "0.10.8" } +serde = { version = "1.0.152", features = ["derive"] } +serde_json = { version = "1.0.116" } +sqlite = { version = "0.34.0" } +regex = { version = "1.10.4" } +reqwest = { version = "0.12.24", features = ["json","socks"] } +tokio = { version = "1", features = ["rt", "net","macros","rt-multi-thread"] } # Keep only necessary runtime components +zmq = { version = "0.10.0" } diff --git a/README.md b/README.md index 9d9b791..1e3f7c5 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ To use `bal-pusher`, you need to compile and install Bitcoin with ZMQ (ZeroMQ) s Once the application is installed and configured, you can start `bal-pusher` by running the following command: ```bash -$ bal-pusher +$ bal-pusher [bitcoin|testnet|regtest|] ``` This will start the service, which will listen for Bitcoin blocks via ZMQ and push transactions from the database when their locktime exceeds the median time past. diff --git a/bal-pusher.env b/bal-pusher.env index e4c3eb3..6f77705 100644 --- a/bal-pusher.env +++ b/bal-pusher.env @@ -12,5 +12,5 @@ BAL_PUSHER_SEND_STATS=true WELIST_SERVER_URL=http://welist.bitcoin-after.life SSL_KEY_PATH=/home/bal/privkey.pem -#your server domain. do not add https or final / only domain. +#your server domain. do not final / only domain. BAL_SERVER_URL="https://we.bitcoin-after.life" diff --git a/src/bin/bal-pusher.rs b/src/bin/bal-pusher.rs index 4b20c19..f0b545b 100644 --- a/src/bin/bal-pusher.rs +++ b/src/bin/bal-pusher.rs @@ -316,8 +316,10 @@ async fn send_stats_report(cfg: &MyConfig, bcinfo: GetBlockchainInfoResult) -> R let client = rClient::new(); let url = format!("{}/ping",welist_url); + debug!("welist url: {}",url); let chain=bcinfo.chain.to_string().to_lowercase(); let message = format!("{0}{1}{2}{3}{4}",cfg.url,chain,bcinfo.blocks,bcinfo.median_time,bcinfo.best_block_hash); + trace!("message to be sent: {}",message); let sign = sign_message(cfg.ssl_key_path.as_str(),&message.as_str()); let response = client.post(url) .header("User-Agent", format!("bal-pusher/{}",VERSION)) @@ -330,7 +332,11 @@ async fn send_stats_report(cfg: &MyConfig, bcinfo: GetBlockchainInfoResult) -> R "last_block_hash": bcinfo.best_block_hash, "signature": sign, })) - .send().await?; + .send().await?; + if !response.status().is_success() { + warn!("Non-success response: {} {}", response.status(), response.status().canonical_reason().unwrap_or("")); + } + let body = &(response.text().await?); info!("Report to welist({})\tSent: {}", welist_url,body); }else { diff --git a/src/bin/bal-server.rs b/src/bin/bal-server.rs index 8b08dc3..bce152f 100644 --- a/src/bin/bal-server.rs +++ b/src/bin/bal-server.rs @@ -26,15 +26,10 @@ use log::{ info, error, trace, debug}; use serde_json; use chrono::Utc; -#[path = "../db.rs"] -mod db; -use crate::db::{ create_database, get_next_address_index, insert_xpub, save_new_address, get_last_used_address_by_ip, execute_insert }; +use bal_server::db::{ create_database, get_next_address_index, insert_xpub, save_new_address, get_last_used_address_by_ip, execute_insert }; +use bal_server::xpub::new_address_from_xpub; - -#[path = "../xpub.rs"] -mod xpub; -use crate::xpub::new_address_from_xpub; -const VERSION:&str="0.2.2"; +const VERSION:&str=env!("CARGO_PKG_VERSION"); const NETWORKS : [&str; 4]= ["bitcoin","testnet","signet","regtest"]; #[derive(Debug, Clone,Serialize, Deserialize)] struct NetConfig {