Skip to content

Instantly share code, notes, and snippets.

@justinmoon
Last active July 5, 2022 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinmoon/24f861d713d2673152718f791b83c52c to your computer and use it in GitHub Desktop.
Save justinmoon/24f861d713d2673152718f791b83c52c to your computer and use it in GitHub Desktop.
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

(3) Wait for N confirmations

(4a) prove they deposited to the federation by supplying a merkle proof that their transaction was included a block.

(4b) give the tweak X to each federation member so they can spend the deposit.

(5) fetch their ecash tokens - blinded IOUs from the federation.

The primary reason we use tweaking instead of HD derivation is to not require a round of consensus for all federation servers to agree on the address. The primary downside is that backups are harder. Since Minimint is so modular, we will eventually add an HD on-chain wallet module as well. Then users could decide between both options.

Regarding the code:

BDK + Minimint

BDK can't do key tweaking!

Here is an EXTREMELY HACKY BDK BRANCH I made at a hackathon to add key tweaking to BDK.

The idea was to pass options to any calls that might derive scripts. These options could tell BDK that we want to do tweaking and include the tweak number itself.

This is our progress so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment