Skip to content

Instantly share code, notes, and snippets.

@DrSammyD
DrSammyD / 0-Confirmation-Double-Spend-Protocol.md
Last active January 30, 2022 00:06
A double-spend protocol to make 0-confirmation transactions secured by consensus rules.

0-Confirmation Double-Spend Protocol

The problem

Bitcoin-accepting merchants want to receive payment and provide services instantly. However, block construction times can be as much as 10 minutes after the moment a bitcoin transaction is broadcast. In the time after a transaction but before a block’s creation, that transaction can be superseded by another transaction with a larger fee paid to miners.

With the change in the mempool protocol from first-seen-first-included and the rejection of conflicting double spends, to the inclusion of double spends and prioritizing transactions with larger fees attached, 0-conf transactions can no longer be reasonably secure for any sized transaction.

The idea of replace-by-fee was that miners will follow their immediate self-interest, and if miners sporadically act that way, could potentially decrease trust in the system. Now that this approach has been assumed and is the default behavior of miner software, we might consider amending t

In November, I realized some Core BTC devs don't understand the LN. Other influencers agreed with me, some in private, some publicly. These questions arose from that confusion, in an attempt to clear things up once and for all.


  1. If Alice and Bob want to transact, they need to open a channel, and they need to agree on max amount to transfer through that channel. This requires a transaction. To finalize the transaction so they can spend the BTC outside of their channel, they need to close it so their on-chain balance updates and so they can send BTC onward into other channels. Closing also needs a tx. How, then, is it sensible for Alice and Bob to transact this way, instead of what they can do now - use one single transaction?

  2. A common argument against the above is "you'll have middlemen through which many channels will go and form a mesh". My question is twofold:

  • a) how is it that this does not scare you? If LN becomes super popular and
@Pulimet
Pulimet / AdbCommands
Last active April 19, 2025 09:48
Adb useful commands list
Hi All!
I've recently launched a tool that wraps many of the commands here with a user interface. This desktop application is currently available for macOS. There's a roadmap outlining planned features for the near future.
Feel free to request any features you'd like to see, and I'll prioritize them accordingly.
One of the most important aspects of this application is that every command executed behind the scenes is displayed in a special log section. This allows you to see exactly what’s happening and learn from it.
Here's the link to the repository: https://github.com/Pulimet/ADBugger
App Description:
ADBugger is a desktop tool designed for debugging and QA of Android devices and emulators. It simplifies testing, debugging, and performance analysis by offering device management, automated testing, log analysis, and remote control capabilities. This ensures smooth app performance across various setups.
@awemany
awemany / bet.py
Created July 28, 2017 11:37
Peter Rizun's memorylessness bet against CSW
#!/usr/bin/env python
# CSW vs. Peter Rizun bet demo by awemany
# Note this discretizes time into seconds for easier understanding. This will
# however-so-slightly bias the calculations in here, due to coincidences etc.
import numpy as np
MEAN_BLOCK_TIME = 600
minute = 60
@kenjij
kenjij / Slack.md
Last active June 13, 2019 07:33
Slack access token for bots (OAuth)

Slack OAuth for Bot App

1. Autorization

Open in a web browser: https://slack.com/oauth/authorize?scope=bot&client_id=12345.67890

  • Use Client ID from App Credentials.
  • Use bot for scope.

2. Authorization Code

@mpapec
mpapec / test.pl
Last active September 8, 2016 14:57 — forked from jberger/test.pl
use Mojolicious::Lite;
helper iodelay => sub {
my $cb = pop;
my ($c, @steps) = @_;
push @steps, sub {
# log err if $_[1]
shift;
$c->$cb(@_);
use Mojolicious::Lite;
get '/' => sub {
my ( $c ) = @_;
$c->delay(
sub {
my ( $delay ) = @_;
say "Fetching Google";
$delay->pass('google');
package Mojolicious::Plugin::Multiplex;
use Mojo::Base 'Mojolicious::Plugin';
use Mojo::EventEmitter;
use Mojo::JSON;
sub register {
my ($plugin, $app, $conf) = @_;
@brianmed
brianmed / minion_001.conf
Created May 23, 2016 23:50
Minion upstart and CentOS
# Start when system enters runlevel 2 (multi-user mode).
start on runlevel 3
# Start delayed_job via the daemon control script.
exec su -c "/opt/perl script/app minion worker" bpm
# Restart the process if it dies with a signal
# or exit code not given by the 'normal exit' stanza.
respawn