Skip to content

Instantly share code, notes, and snippets.

View reardencode's full-sized avatar

Brandon Black reardencode

View GitHub Profile
@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][].