Skip to content

Instantly share code, notes, and snippets.

View reardencode's full-sized avatar

Brandon Black reardencode

View GitHub Profile
@reardencode
reardencode / dumb.md
Last active January 3, 2025 22:58
LNHANCE+CCV+AMOUNT AMM

What?

OP_CAT token and AMM construction

Before I begin this section, let me just say that an AMM (Automated Market Maker) is only an example of the type of protocol that we should be considering, it is not in itself the problem. Because it requires several capabilities currently missing from bitcoin, it is a useful example.

Given the existence of the CATNIP token design as discussed by Ademan and

@reardencode
reardencode / ctv-csfs-ccv.txt
Last active December 9, 2024 19:22
Symmetry Scripts
CTV+CSFS+CCV Symmetry
166
update-script: 33+33+5+23 = 94
stack: 33+65+33 = 131 (or 0)
| (<settlement-n-hash> <sig> <update-n-tree> | )
DEPTH | (<settlement-n-hash> <sig> <update-n-tree> | ) <3|0>
<key> | (<settlement-n-hash> <sig> <update-n-tree> | ) <3|0> <key>
SWAP | (<settlement-n-hash> <sig> <update-n-tree> | ) <key> <3|0>
NOTIF | <key>
<settlement-i-hash> | <key> <settlement-i-hash>
@reardencode
reardencode / restored-rsa.txt
Created May 9, 2024 19:13
restored script RSA
<n> <c> <e> // n, c = RSA key len, e = 3 bytes
| n e c |
TUCK | n e c e | 512 | 1024
1 | n e c e 1 |
AND | n e c 0/1 | 257 | 513
IF | n e c |
DUP | n e c c | 512 | 1024
ELSE | n e c |
1 | n e c 1 |
ENDIF | n e c c/1 |
@reardencode
reardencode / mkcsfs.js
Last active February 24, 2024 05:26
Test Scripts
const { ECPairFactory } = require('ecpair');
const btc = require('./src');
const ecc = require('tiny-secp256k1');
const { secp256k1, schnorr } = require('@noble/curves/secp256k1');
const psbtutils = require('./src/psbt/psbtutils');
const { reverseBuffer } = require('./src/bufferutils');
const { REVERSE_OPS: rOps } = require('./src/ops');
btc.initEccLib(ecc);
@reardencode
reardencode / main.txt
Created February 12, 2024 05:26
CTV-CSFS-IK-VAULT symmetry
quine-script = IF TOALTSTACK TOALTSTACK DROP CTV IK CSFS VERIFY FROMALTSTACK DUP 3 SWAP VAULT FROMALTSTACK CLTV ELSE 2DROP CTV ENDIF
state-n-hash { nLockTime(S+n), out(contract, amount(A)+amount(B)) }
settlement-n-hash { nSequence(2w), out(A, amount-n(A)), out(B, amount-n(B)) }
S = 500000000
IK = A+B
Script = CTV IK CSFS VERIFY <quine-script> DUP 3 SWAP VAULT <S+1> CLTV
Tree = Script
Stack = 0 -1 0 <settlement-1-hash> <S+2> <sig> <state-1-hash>
@reardencode
reardencode / vault_quine.md
Last active February 9, 2024 18:26
VAULT quine

VAULT quine:

op stack
START {1,0,<release_sig>}
<counter> <counter> {1,0,<release_sig>}
<leaf-update-script-body> <leaf-update-script-body> <counter> {1,-1,<release_sig>}
TOALTSTACK <counter> {1,0}
DUP <counter> <counter> {1,0,<release_sig>}
NOTIF <counter> <release_sig>
@reardencode
reardencode / proposal.md
Last active November 2, 2023 18:25
Combined CTV+APO to minimal TXHASH+CSFS

Abstract

This proposal is an alternative to [bip119][] and [bip118][], providing the functionality of both proposals with minimal additional overhead in many cases, while clearing certain objections to both, and opening clear upgrade paths.

This is, in essence, an initially constrained version of Russel O'Connor's [OP_TXHASH+OP_CSFS proposal][].