Skip to content

Instantly share code, notes, and snippets.

@supertestnet
supertestnet / the-bag-system.md
Last active June 5, 2025 04:10
The Bag System: Bitcoin Adoption Gamified

The Bag System

Bitcoin Adoption Gamified

Summary

The Bag System is an idea for a new type of bitcoin merchant software that uses a pooled reward system to gamify bitcoin adoption. The essential idea is that merchants save money when users pay with bitcoin, and if a bunch of merchants pool a portion of those savings -- 1% -- you can pretty quickly get a really large pot of money which you can use to reward consumers who spend their bitcoin at those merchants. For consumers, it's great: they're not spending any extra money than if they paid with fiat, but they do get more bitcoin than they started with. For merchant's, it's great too: only 1% of their money goes to the reward pool ("the bag"), which is like 1/3 of what "normal" payment processors charge, plus the money stays in their local community and just incentivizes more traffic to come to their store.

How it works

@supertestnet
supertestnet / zkp-coinpool-for-bitcoin.md
Last active May 22, 2025 00:08
ZKP Coinpool for Bitcoin

Today I was making a slideshow about coinpools and a thought occurred to me.

I think it’s possible to have four or more people contribute funds to a coinpool and then make withdrawals “from” the coinpool without revealing to one another which user they are. I think this protocol would require interaction from every other participant whenever anyone wants to transact, but in case of a liveness failure, I think each user would be able to withdraw their balance. I am tentatively calling this idea a “zkp coinpool.” I initially also thought the people funding the coinpool could contribute different amounts to it, but I’m less confident of this now – you’ll see why later, but the paragraph after this one starts by assuming they can contribute different amounts.

I think a zkp coinpool is possible because of zero knowledge proofs, in particular, the Zokrates software. This software lets you prove that a number X is (1) positive and greater than a number M but (2) less than a number Y (3) without disclosing the

@supertestnet
supertestnet / ptlcs_without_a_soft_fork.md
Last active May 16, 2025 01:10
How to do PTLCs without a soft fork

How to do PTLCs without a soft fork

Suppositions

Suppose Alice wants to route a lightning payment to Carol, who has 5 payment channels with Bob, Zeke, Yan, Xander, and Wilma. Alice may start by getting an invoice from Carol. Before giving it, Carol should make up a random 32 byte secret, derive its pubkey on bitcoin’s elliptic curve by treating it as a private key, and sign 5 messages, one for each of her channel counterparties, telling each counterparty she will give the secret to that counterparty using a scheme to be described shortly, if he holds up his end of the “bargain” encoded in that scheme (again, to be described shortly). Carol should encrypt each message so that only that counterparty can read it, then encode all of the encrypted messages in the invoice she shares with Alice, telling Alice, at the same time, which message is readable by which channel counterparty.

What Alice does

Now it is Alice’s turn. She should find a route to Carol by asking her own peers if they can forward a pay

@supertestnet
supertestnet / get-median-bitcoin-price.md
Last active March 27, 2025 20:08
Get Median Bitcoin Price

The following code block gets you bitcoin's price by sampling from 5 sources and taking the median.

Usage:

(async()=>{
    var btc_price = await getBitcoinPrice();
    console.log( 'btc price:', btc_price );
})();
@supertestnet
supertestnet / projects_and_winners.md
Last active May 4, 2025 19:35
Exceptional Projects and Winners of Bitcoin++ Hackathon at Floripa 2025

Name: Sloppy
Video: https://www.youtube.com/live/5Ty7eimij08?si=1yBNEe0tA7YFMSGM&t=5038
Desc: a nostr bot that runs an LLM that tries to earn money by being funny, and uses its earnings to pay for its own hosting – such that it dies if no one finds it funny enough
Other links: savesloppy.org

Name: SatsGuardian
Video: https://www.youtube.com/live/5Ty7eimij08?si=HA3325oxhU1DwWvA&t=5411
Desc: A base layer services that watches the mempool. If it detects an unauthorized transaction from your cold wallet, it tries to use RBF to recover your funds
Other links:

@supertestnet
supertestnet / moores_law.md
Last active February 7, 2025 23:18
Thoughts on Moore's law (edit: actually it's about House's observation)

The chart below is in logarithmic scale:

source of chart

It charts the growth of cpu speeds in comparison with the VAX 11/780. It suggests that Moore’s law stopped applying around 2003. I decided to continue the chart using gigaflops as a metric for cpu speed and allowing for multi-core cpus.

I don’t have data on how many floating point operations the VAX 11/780 could do but I suspect it is “none” because I think the first cpu advertised as being capable of floating point operations was the Intel 8087 in 1980.

@supertestnet
supertestnet / wallets.txt
Last active January 23, 2025 16:43
List of bitcoin wallets ranked by type (custody or non) and number of downloads on google play
name, custody, number, type
Alby Go, self custodial, 1_000, wallet
Aqua Wallet, custodial, 10_000, wallet
BTCPayServer, self custodial, N/A, wallet
Balance of Satoshis, self custodial, N/A, wallet
Bare Bitcoin, custodial, 1_000, exchange
Bipa, custodial, 100_000, exchange
BitBanana, self custodial, 1_000, wallet
Bitkit, self custodial, 1_000, wallet
Blixt, self custodial, 5_000, wallet
@supertestnet
supertestnet / btc-prediction-market.md
Last active January 13, 2025 19:57
Thoughts on building a polymarket clone or similar type of prediction market on bitcoin

Funding tx

Have an Oracle create a utxo like I do in tornado factory, where all the money in an n-of-n utxo goes, at first, to the Oracle, and where each key in the n-of-n is actually a 2-of-2 “sharded key,” where a statechain operator has one shard and the Oracle has the other. People can pay 10k sats to the Oracle to “buy” one of his or her shards. With it, the buyer contacts the statechain operator and obtains a cosignature on a tx that gives them the right to withdraw 2 10k-sat increments of the money from the n-of-n utxo (per my tornado factory protocol), except their withdrawal txs are not valid unless the Oracle says the result is a Yes (or No, if the user bought No). I will call these “right to withdraw” keyshards RTWs and those are what you’re buying and selling in these markets.

Connectors versus adaptor signatures

The above idea relies on the assumption that you can only withdraw using your signature if the Oracle announces a result in your

@supertestnet
supertestnet / historical_price_fetcher.html
Last active January 6, 2025 16:44
Some javascript for fetching the historical price of bitcoin on any date since Kraken existed
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ccxt.browser.min.js"></script>
<!-- the manual for using the ccxt library is here: https://github.com/ccxt/ccxt/wiki/ -->
</head>
<body>
<script>
(async()=>{
var date = "2016-07-26";
@supertestnet
supertestnet / Musings on a Non-Interactive Coinpool.txt
Last active January 3, 2025 04:37
In this document, I spend about 15 pages, written over the course of a few weeks, thinking up a way to do a non-interactive coinpool without any consensus-changes to bitcoin. It is a glimpse into my thought process.
Recently, while discussing covenant proposals on twitter, I had this conversation (slightly modified):
-------------------------------------------------------------------------------------------------------------------------------
Me: Several [covenant] proposals make privacy pools like TornadoCash easier to build on bitcoin so...get on board for the "more privacy" reason! (I think you can build a TornadoCash-like privacy pool with any of the following: op_ctv, op_txhash, op_vault, op_cat, or op_paircommit)
Other person: Just a dumb question, a proposal like coinpool or joinpool (tornado cash like privacy pools on CTV) AFAIK requires all the users to stay online so it is possible to interact with the pool. Is it possible to make it tornado cash like, meaning I can open the wallet, deposit into the pool, turn off my PC, and after months I can withdraw the funds?
Me: Tldr: yes I think its possible. Long answer: I think I could make that kind of pool with three primitives: blind signatures, transferable stat