Skip to content

Instantly share code, notes, and snippets.

@justinmoon
justinmoon / snowball.md
Created September 25, 2019 00:15
snowball protocol (rough draft)

General Workflow

  • Mobile wallet prepares a transaction in PSBT format
  • Mobile wallet calls snowball.enroll(psbt)
    • Invites all connected peers to add equal-sized inputs and outputs to the PSBT
    • Asynchronous with timeout
    • This would take soem kind of settings object including:
      • Who pays the fees
      • TODO: what else
  • Mobile wallet updates outputs to according to fee settings and desired fee rate
In encounter the following error attempting to install HWI using Poetry on Windows 10:
```
$ poetry install
...
$ poetry shell
$ hwi enumerate
Traceback (most recent call last):
File "C:\Users\justin\AppData\Local\pypoetry\Cache\virtualenvs\HWI-py3.7\Scripts\hwi-script.py", line 6, in <module>
from pkg_resources import load_entry_point
from flaskwebgui import FlaskUI #get the FlaskUI class
from dev import app
ui = FlaskUI(app)
ui.run()
from hwilib import commands
print(commands.enumerate())
@justinmoon
justinmoon / app.py
Last active August 13, 2019 04:56
Issue unlocking a trezor
from flask import Flask, render_template_string, request, redirect
from hwilib import commands
from hwilib.devices import trezor
app = Flask(__name__)
template = """
<div>Locked? {{ locked }}</div>
<form action="/" method="post">
<label for="pin">Pin:</label>
from m5stack import LCD, fonts, color565
from m import secure_mnemonic
lcd = LCD()
lcd.set_font(fonts.tt24)
lcd.erase()
def title(s):
# calculations
@justinmoon
justinmoon / m.py
Last active July 22, 2019 01:41
m.py
from hashlib import sha256
# justin
def randbits(n):
import os
return int.from_bytes(os.urandom(int(n/8)), 'big')
def secure_mnemonic(entropy=0, num_bits=128):

Wallet Creation

# Create 3/3 wallet
$ python cli.py createwallet 3 3
Your new 3/3 wallet has been saved to "junction.wallet"

# Once your transaction has confirmed, create a PSBT:
$ python cli.py --wallet blt createpsbt <recipient> <amount-in-btc>
Your PSBT for wallet "blt" has been created
@justinmoon
justinmoon / error.md
Last active July 14, 2019 00:33
lnd error logs
$ lnd --lnddir=$HOME/lndbackup/
Attempting automatic RPC configuration to bitcoind
Automatically obtained bitcoind's RPC credentials
2019-07-13 19:24:56.933 [INF] LTND: Version: 0.7.0-beta commit=v0.7.0-beta-73-g616750184ef9316b849f1ec092176e6814cb2661, build=production, logging=default
2019-07-13 19:24:56.933 [INF] LTND: Active chain: Bitcoin (network=mainnet)
2019-07-13 19:24:56.934 [INF] CHDB: Checking for schema update: latest_version=9, db_version=7
2019-07-13 19:24:56.934 [INF] CHDB: Performing database schema migration
2019-07-13 19:24:56.934 [INF] CHDB: Applying migration #8
2019-07-13 19:24:56.934 [INF] CHDB: Migrating to the gossip message store new key format
2019-07-07 13:12:13.123 [INF] LNWL: Opened wallet
2019-07-07 13:12:13.433 [INF] LTND: Primary chain is set to: bitcoin
2019-07-07 13:12:13.479 [INF] LTND: Initializing bitcoind backed fee estimator
2019-07-07 13:12:13.479 [INF] LNWL: Started listening for bitcoind block notifications via ZMQ on tcp://0.0.0.0:28832
2019-07-07 13:12:13.479 [INF] LNWL: Started listening for bitcoind transaction notifications via ZMQ on tcp://0.0.0.0:28833
2019-07-07 13:12:13.482 [DBG] LNWL: Using minimum fee rate of 253 sat/kw
2019-07-07 13:12:16.034 [INF] LNWL: The wallet has been unlocked without a time limit
2019-07-07 13:12:16.189 [INF] LTND: LightningWallet opened
2019-07-07 13:12:16.191 [DBG] LNWL: Birthday block has already been verified: height=568159, hash=00000000000000000003e6aca881b8eae22684db2033b408f1b6d7881e329776
2019-07-07 13:12:16.275 [INF] HSWC: Restoring in-memory circuit state from disk