Skip to content

Instantly share code, notes, and snippets.

View darosior's full-sized avatar

Antoine Poinsot darosior

View GitHub Profile
@darosior
darosior / createvenv.sh
Created October 22, 2018 13:09
Create a Python virtual environment even without permission
#!/bin/bash
python3 -m venv --without pip "$1"
source "$1/bin/activate"
curl https://bootstrap.pypa.io/get-pip.py | python3
deactivate
source "$1/bin/activate"
rm -rf pip
@darosior
darosior / confidentiality rules
Created March 15, 2019 14:35
Règles de confidentialité / confidentiality rules
Confidentiality rules for c-simple / règles de confidentialités pour c-simple.
I/csimple/c-simple don't store any of your informations. They are your own.
Je/csimple/c-simple ne conserve aucune de vos informations. Elles vous appartiennent.
@darosior
darosior / gui.py
Created June 13, 2019 11:27
lightning-qt without plugin
#!/usr/bin/env python3
import os
from lightning import LightningRpc, Plugin, RpcError
from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow
from mainWindow import MainWindow
def gui():
"""Launches the Qt GUI"""
@darosior
darosior / lightning-connect.7.md
Created August 10, 2019 00:35
Sample markdown manpage

LIGHTNING-CONNECT(7) Manual Page

lightning-connect - Command for connecting to another lightning node.

SYNOPSIS

connect id [host port]

DESCRIPTION

.top-header {background-color: #fff;}
.top-header .timer-row__progress-bar {background:#ef8022;}
.top-header .timer-row {background: #ffc313;}
.close-icon {color:#000;}
.payment-tabs__slider {background: #ef8022; }
.separatorGem {background: #ef8022;}
.action-button {color: #fff; background-color: #ef8022;border-color: #ef8022;}
.action-button:hover {background-color: #ffc313;}
.action-button:focus, .action-button.focus {color: #fff;background-color: #ef8022;
border-color: #ef8022;}
@darosior
darosior / dual_funding.md
Last active January 21, 2020 14:25
Dual funding

A is funder B is fundee

A initiates the process but B doesn't want its outputs to be snooped easily. One solution could be to require A to provide signed and broadcastable transactions in order to know about B's utxos. This can be done with SIGHASH_SINGLE|SIGHASH_ANYONECANPAY which an input and the corresponding output, so A signs its funding to the channel and can be sure that the created output is the P2WSH multisig used to fund the channel.

One downside of this is that it doesn't allow for change on A's side. This can be solved by using a (segwit) transactions chain. A creates a first tx, let's call it txA1 containing an arbitrary number of its inputs and of change outputs:

This is a list of all the possible use cases for the `rpc_command` hook, which I keep so that I don't feel so bad to have
contributed something which had to be fixed 3 times by Rusty and once by Christian :
- "one use case for the rpc_command hook is to always provide a close_to address for a channel" -- niftiney
- "https://github.com/fiatjaf/lightningd-gjson-rpc/tree/72f8541eea17e209eb21f3d2d82286a3242f7ba5/cmd/routetracker" -- fiatjaf
- " replace `getroute`." -- zmn
- "Or make it more powerful by letting it hook-chain as well." -- zmn
@darosior
darosior / c-lightning-monitoring.md
Last active September 28, 2020 12:30
C-lightning admin utilities

Which one of your channels are you always failing to route through ?

for scid in $(lc listpeers |jq -r '.peers | map(.channels[].short_channel_id)[]');do echo "$scid failed $(lc listforwards |jq -r '.forwards | map(select(.status | contains("failed")).out_channel)' |grep $scid |wc -l) times";done

Which ones are often succeeding ?

@darosior
darosior / MiniTapscript.md
Last active February 14, 2023 08:39
Notes on adapting Miniscript for Tapscript

(Contains input from many people, not my own ideas)

Notes

  • Forbid multi, have a new multi_a itself forbidden in other contexts
  • We now need to care about the maximum stack size (1000). With Taproot it's now also checked before executing the Script.
  • We could have a new d: wrapper that is u because the MINIMALIF rule is consensus
  • It doesn't look like there is interesting combinations of the new CHECKSIGADD opcode with existing fragment. Maybe we could have used it for thresh to save an OP_ADD if the sub was a CHECKSIG, but the arguments aren't in the right order for this.
  • No need to check for the Script size anymore
  • I don't think we need to take the sigop budget into account, as we can't create a Script that would duplicate the signatures.
  • When calculating sizes, keep in mind the signature length is now 64