This document proposes a new scheme to avoid address reuse while retaining some of the convenience of address reuse, keeping recoverability purely from Bitcoin time chain and avoiding visible fingerprint. The scheme has negligible average overhead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::any::Any; | |
use std::fmt::Debug; | |
fn print_type_name<T: Any + Debug>(value: &T) { | |
println!("Type of {:?} is: {}", value, std::any::type_name::<T>()); | |
} | |
fn main() { | |
let i: i32 = 42; | |
print_type_name(&i); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use sha2::{Digest, Sha256}; | |
/// Calculates the Hamming distance between two SHA-256 hashes. | |
/// | |
/// This function takes two byte slices representing SHA-256 hashes and returns | |
/// the number of bits that differ between them. | |
fn hamming_distance_sha256(hash1: &[u8], hash2: &[u8]) -> u32 { | |
assert_eq!(hash1.len(), 32, "Invalid hash1 length"); | |
assert_eq!(hash2.len(), 32, "Invalid hash2 length"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use sha2::{Digest, Sha256}; | |
/// Calculates the Hamming distance between two SHA-256 hashes. | |
/// | |
/// This function takes two byte slices representing SHA-256 hashes and returns | |
/// the number of bits that differ between them. | |
fn hamming_distance_sha256(hash1: &[u8], hash2: &[u8]) -> u32 { | |
assert_eq!(hash1.len(), 32, "Invalid hash1 length"); | |
assert_eq!(hash2.len(), 32, "Invalid hash2 length"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use actix_web::{get, web, App, HttpResponse, HttpServer, Responder}; | |
use bitcoincore_rpc::{Auth, Client, RpcApi}; | |
use serde_json::Value; | |
struct AppState { | |
btc_client: Client, | |
} | |
#[get("/blocktemplate")] | |
async fn get_block_template(data: web::Data<AppState>) -> impl Responder { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use sha2::{Digest, Sha256}; | |
/// Calculates the Hamming distance between two SHA-256 hashes. | |
/// | |
/// This function takes two byte slices representing SHA-256 hashes and returns | |
/// the number of bits that differ between them. | |
fn hamming_distance_sha256(hash1: &[u8], hash2: &[u8]) -> u32 { | |
assert_eq!(hash1.len(), 32, "Invalid hash1 length"); | |
assert_eq!(hash2.len(), 32, "Invalid hash2 length"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use sha2::{Digest, Sha256}; | |
/// Calculates the Hamming distance between two SHA-256 hashes. | |
/// | |
/// This function takes two byte slices representing SHA-256 hashes and returns | |
/// the number of bits that differ between them. | |
fn hamming_distance_sha256(hash1: &[u8], hash2: &[u8]) -> u32 { | |
assert_eq!(hash1.len(), 32, "Invalid hash1 length"); | |
assert_eq!(hash2.len(), 32, "Invalid hash2 length"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use sha2::{Digest, Sha256}; | |
/// Calculates the Hamming distance between two SHA-256 hashes. | |
/// | |
/// This function takes two byte slices representing SHA-256 hashes and returns | |
/// the number of bits that differ between them. | |
fn hamming_distance_sha256(hash1: &[u8], hash2: &[u8]) -> u32 { | |
assert_eq!(hash1.len(), 32, "Invalid hash1 length"); | |
assert_eq!(hash2.len(), 32, "Invalid hash2 length"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::sync::mpsc::{Sender, Receiver}; | |
use std::sync::mpsc; | |
use std::thread; | |
static NTHREADS: i32 = 3; | |
fn main() { | |
// Channels have two endpoints: the `Sender<T>` and the `Receiver<T>`, | |
// where `T` is the type of the message to be transferred | |
// (type annotation is superfluous) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::thread; | |
const NTHREADS: u32 = 10; | |
// This is the `main` thread | |
fn main() { | |
// Make a vector to hold the children which are spawned. | |
let mut children = vec![]; | |
for i in 0..NTHREADS { |