Skip to content

Instantly share code, notes, and snippets.

{"members":[[0,"ws://localhost:4001/"],[1,"ws://localhost:4011/"],[2,"ws://localhost:4021/"],[3,"ws://localhost:4031/"]]}
@justinmoon
justinmoon / htlc_intercepter.rs
Last active October 20, 2022 21:12
LND HTLC Interceptor in Rust
///
/// To use this demo:
/// - create a 3 node network in polar (https://lightningpolar.com/) -- Alice, Bob and Carol
/// - Create channels between Alice and Carol, and between Alice and Bob.
/// - Create an invoice from Carol. Use the `decodepayreq` and `lookupinvoice` lncli commands to get preimage associated with Carol's invoice
/// - Run this program with Alice's LND credentials, and the preimage from step above. For instance:
/// `cargo run --example subscribe_htlcs 127.0.0.1 10003 /Users/justin/.polar/networks/2/volumes/lnd/alice/tls.cert /Users/justin/.polar/networks/2/volumes/lnd/alice/data/chain/bitcoin/regtest/admin.macaroon <preimage>`
/// - Have Bob pay the invoice via Polar UI
/// - This program should output HTLC information. Polar should print success message.
///

setting up developer environment

Instructions.

Our developer environment is amazing, but it downloads a few gigabytes of data to get set up

fedimint-cli

# pull docker image
@justinmoon
justinmoon / gist:3ff2722f0d136c55f2c1166a03a174f7
Created September 26, 2022 02:37
9/27/2022 Fedimint Dev Call
- https://github.com/fedimint/fedimint/issues/613
@justinmoon
justinmoon / tweak.md
Last active July 5, 2022 13:47
BDK + Minimint

About Minimint

Minimint is similar to Liquid. But instead of 1 monolithic codebase, it is very modular. So it's more like a "framework for building federations". One module implements "Chaumian ecash", another integrates with Lightning, another is an on-chain wallet.

The on-chain wallet module currently has a public descriptor like this: wsh(sortedmulti(3,02b5b951e6426bc30ba6e7e1cb9cfae06c2658c043614c0fa37a7c4a649a4a3056,026ad269307053e5a11f7ab73209e89791ae31cabfa00b5fa2811bb25633eec6d6,034c71c3f3c2a8ecf07477158be4d9f37b44694b2987f6487c3884857002348fd1,033d94f61ac8bd8fc460a91f7b61e45a16b51d10097200f17fb0998a7483cc8f19))#cc9uhqy3. Each federation server controls one of these keys. When a user deposits into the federation, they

(1) Tweak each pubkey in this descriptor with some random number X.

(2) Deposit to this address associated with this tweaked

@justinmoon
justinmoon / start.md
Last active February 7, 2022 23:02
How To Start A Startup by Paul Graham

How To Start A Startup by Paul Graham

(original is here, hosting in gist so that I can link to specific section)

You need three things to create a successful startup: to start with good people, to make something customers actually want, and to spend as little money as possible. Most startups that fail do it because they fail at one of these. A startup that does all three will probably succeed.

And that's kind of exciting, when you think about it, because all three are doable. Hard, but doable. And since a startup that succeeds ordinarily makes its founders rich, that implies getting rich is doable too. Hard, but doable.

If there is one message I'd like to get across about startups, that's it. There is no magically difficult step that requires brilliance to solve.

The following builds are still in progress:
/gnu/store/zy0i43ccvlyhqjqr5p3nqzaqglj9xhvh-gcc-glibc-2.27-9.3.0.drv
/gnu/store/kzm3l7cxyljsaw92pkj9j57wyvaa6w8p-gcc-5.5.0.tar.xz.drv
/gnu/store/cbgd81mxj931fldfz7gmikh9ma9dfk68-gcc-9.3.0.tar.xz.drv
building /gnu/store/5w32y22c4mcb6rnbrg4s00abyhvj2yw7-ld-wrapper-x86_64-linux-gnu-0.drv...
The following builds are still in progress:
/gnu/store/zy0i43ccvlyhqjqr5p3nqzaqglj9xhvh-gcc-glibc-2.27-9.3.0.drv
/gnu/store/kzm3l7cxyljsaw92pkj9j57wyvaa6w8p-gcc-5.5.0.tar.xz.drv
/gnu/store/cbgd81mxj931fldfz7gmikh9ma9dfk68-gcc-9.3.0.tar.xz.drv
$ env PATH="/root/.config/guix/current/bin${PATH:+:}$PATH" ./contrib/guix/guix-build.sh
make: Entering directory '/bitcoin/depends'
make[1]: Entering directory '/bitcoin/depends'
make[1]: Leaving directory '/bitcoin/depends'
make[1]: Entering directory '/bitcoin/depends'
make[1]: Leaving directory '/bitcoin/depends'
make[1]: Entering directory '/bitcoin/depends'
make[1]: Leaving directory '/bitcoin/depends'
make: Leaving directory '/bitcoin/depends'
* guix-improve
substitute: updating substitutes from 'https://guix.carldong.io'... 0.4%Backtrace:
substitute: In ice-9/boot-9.scm:
substitute: 1736:10 4 (with-exception-handler _ _ #:unwind? _ # _)
substitute: In unknown file:
substitute: 3 (apply-smob/0 #<thunk 7fd993c84980>)
substitute: In ice-9/boot-9.scm:
substitute: 718:2 2 (call-with-prompt _ _ #<procedure default-prompt-handle?>)
substitute: In ice-9/eval.scm:
substitute: 619:8 1 (_ #(#(#<directory (guile-user) 7fd9938a4f00>)))
substitute: In guix/ui.scm:
17,19d16
< d0b11d1d27fe425bc91ea51fab74ad45e428753796f0392e446e8b2450293255 accountsservice_0.6.45-1ubuntu1_amd64.deb
< 7664041a35332febccd6c2c13d384c0bad6b0af63c7250f70d6c29477e5e5754 acl_2.2.52-3build1_amd64.deb
< f2afba152b0c82ec2be80a455f7757d2e778e7322ce53dae10c00a685bda4623 acpid_1%3a2.0.28-1ubuntu1_amd64.deb
22,25d18
< 724111c4e9831d9422631f5c7446b1af318aeea98ac3384c7cc02323a82c69fc apparmor_2.12-4ubuntu5.1_amd64.deb
< 014f0a1fbe238342efc4eacba64c431271de5c01ab1e9dbea5e831b958136c1c apport-symptoms_0.20_all.deb
< cdb1829179f75d9c57b508fceae3f244f3f9d1ff874d6c08011a4cf43f03c178 apport_2.20.9-0ubuntu7.15_all.deb
< 2630dd875d2279bd168fd2abd691cf6cebbf5f9f11af802f3314cf02261dd1c8 apt-utils_1.6.12ubuntu0.1_amd64.deb
27d19