This file contains 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
--- | |
title: No HWW, no problem! | |
author: Riccardo Casatta | |
date: 2024 | |
theme: Madrid | |
colortheme: dolphin | |
links-as-notes: true | |
# Sono Riccardo Casatta, ingegnere informatico, ho lavorato nella Consulenza prima di ammalarmi di bitcoin, al che invece di continuare a fare un lavoro becero e accumulare coin ho deciso di fare una startup, Eternity Wall che ha lavorato con Peter Todd per produrre il protocollo OpenTimestamps di cui ancora oggi mantengo uno dei calendar server ufficiali. | |
# Adesso lavoro in Blockstream, ma come vedete dalla prima slide, non ho messo affiliation a giudicare dal titolo non so se i miei colleghi di Jade sono felici. Non lo so forse dopo questa presentazione potrebbero anche aumentare le vendite, vediamo | |
# see https://github.com/alexeygumirov/pandoc-beamer-how-to for other fields |
This file contains 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
[to_entries | .[].value.fees.base * 1000000 | floor] | | |
[ | |
{ | |
le: "1", | |
val: (map(select(.<=1)) | length) | |
}, | |
{ | |
le: "2", | |
val: (map(select(.<=2)) | length) | |
}, |
This file contains 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
``` | |
$ cat pay-using-channel.sh | |
#!/bin/sh | |
CHANNEL=$1 | |
BOLT11=$2 | |
[ -z "$CHANNEL" ] && echo "first program argument should be a short channel id and it is unset or set to the empty string" && exit 1 | |
[ -z "$BOLT11" ] && echo "second program argument should be a bolt11 invoice and it is unset or set to the empty string" && exit 1 |
This file contains 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 bitcoin::secp256k1::Secp256k1; | |
use electrum_client::ElectrumApi; | |
use electrum_client::Client; | |
use bitcoin::util::bip32; | |
use bitcoin::util::bip32::DerivationPath; | |
use bitcoin::Address; | |
use bitcoin::Network; | |
use std::str::FromStr; | |
fn main() { |
This file contains 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
#!/bin/bash | |
# verify your available scaling frequency with: | |
# `cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies` | |
# and adapt this script | |
unset FREQ | |
case $1 in |
This file contains 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
#[cfg(test)] | |
mod tests { | |
use bitcoin::hashes::hex::{FromHex, ToHex}; | |
use bitcoin::schnorr::{KeyPair, PublicKey}; | |
use bitcoin::{Script, Address, Network, Transaction, TxIn, OutPoint, TxOut}; | |
use bitcoin::blockdata::{script, opcodes}; | |
use bitcoin::util::taproot::{TaprootSpendInfo, LeafVersion}; | |
use bitcoin::util::address::WitnessVersion; | |
use bitcoin::util::sighash::{SigHashCache, ScriptPath, SigHashType}; | |
use bitcoin::util::sighash::Prevouts; |
This file contains 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
#[test] | |
fn taproot_tests() { | |
let secp = Secp256k1::new(); | |
let secret = Vec::from_hex("6c068c2094c3f0986741cddbaff96399e338b4120671c6640216d3e474487a19").unwrap(); | |
let pair = KeyPair::from_seckey_slice(&secp, &secret).unwrap(); | |
let public = schnorr::PublicKey::from_keypair(&secp, &pair); | |
assert_eq!(public.to_hex(),"72ad3fb702bf1a2111b09c2bf1e72f4f52d4ceb2acdcfcd0c63abf70a59c36d6"); | |
let second_secret = Vec::from_hex("1cbb4d11a771697c1d86d0bbbcf0344b1e8b70d0cc794c3d9d6eff613390ba5e").unwrap(); | |
let second_pair = KeyPair::from_seckey_slice(&secp, &second_secret).unwrap(); |
This file contains 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
cargo run --example repl --features cli-utils,esplora,electrum -- --wallet single_change_deep --descriptor "wpkh(tpubD6NzVbkrYhZ4YmSHJMXPEvd6dnPgH55EwGBs2AJHyiBgnT7zJzQ1ywHDxxZveoApLeBeSFcjysjQ5PebSg4gsdrVdRxCLAgHK8jKUiydMrg/*)" sync --max_addresses 200 | |
ADDRESS=$(cargo run --example repl --features cli-utils,esplora,electrum -- --wallet single_change_deep --descriptor "wpkh(tpubD6NzVbkrYhZ4YmSHJMXPEvd6dnPgH55EwGBs2AJHyiBgnT7zJzQ1ywHDxxZveoApLeBeSFcjysjQ5PebSg4gsdrVdRxCLAgHK8jKUiydMrg/*)" get_new_address | jq -r .address) | |
PSBT=$(cargo run --example repl --features cli-utils,esplora,electrum -- --wallet single_change_deep --descriptor "wpkh(tpubD6NzVbkrYhZ4YmSHJMXPEvd6dnPgH55EwGBs2AJHyiBgnT7zJzQ1ywHDxxZveoApLeBeSFcjysjQ5PebSg4gsdrVdRxCLAgHK8jKUiydMrg/*)" create_tx --to $ADDRESS:0 -a | jq -r .psbt) | |
bitcoin-cli decodepsbt $PSBT | |
OTHER_ADDRESS=$(cargo run --example repl --features cli-utils,esplora,electrum -- --wallet single_many_utxos --descriptor "wpkh(tpubD6NzVbkrYhZ4X2yy78HWrr1M9NT8dKeWfzNiQqDdMqqa9UmmGztG |
This file contains 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
The following is a proposal to expose SPV validation. | |
gdk-electrum has SPV validation for: | |
- bitcoin: headers chain is downloaded verified and saved in a flat file, tx proof is downloaded for every wallet tx, and checked against the headers. | |
- liquid: no need to download the chain, tx proof is downloaded, the header of the block containing the tx is downloaded, the proof is checked against the Merkle root in the header, script, and challenge of the header are verified | |
This functionality must be exposed (so we can SPV validate on ios and remove bitcoinj on android), for liquid is quite easy since it is not required to download the headers chain which is done in a thread in gdk-electrum (this may change with dynafed). Running a thread without a session is problematic (because you don't know if you need to close it), for this reason, I was thinking an interface like the following: | |
``` |
This file contains 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 electrum_client::{Client, GetHistoryRes}; | |
use bitcoin::util::bip32::{ChildNumber, ExtendedPubKey}; | |
use bitcoin::secp256k1::{Secp256k1, All}; | |
use bitcoin::{Address, Network, Script, Transaction, BlockHeader}; | |
use bitcoin::consensus::{serialize, deserialize}; | |
use std::str::FromStr; | |
use std::time::Instant; | |
use std::collections::{HashSet, HashMap}; | |
use sled; |
NewerOlder