Pete Myers Profile picture
16 Sep, 25 tweets, 7 min read
[crypto]

THREAD

*****
BTC/BSV: 2 Blockchain Bloat Mitigation Methods
*****

This week, BTC and BSV devs both merged new features designed to keep their blockchains small. Here I compare both upgrades & reflect a bit on the different development practices in both projects.
For BSV, @Shadders333 recently announced the development of something called “free consolidation transactions” (which I will call Fctxs for brevity); this feature is production ready with BitcoinSV Node 1.0.5

For BTC, @pwuille recently announced the development of something called “Schnorr signatures” (which I will call Ssigs for brevity); this feature has been merged into the main repository and I am guessing will be released with Bitcoin Core 0.21

Bitcoin Core, the reference implementation for BTC, is Open Source, and has an open development model. This means that possible improvements to Bitcoin Core are discussed openlyin the form of BIPs (Bitcoin Improvement Proposals). Available here:

github.com/bitcoin/bips
BitcoinSV Node, the reference implementation for BSV, is also Open Source, but has a closed development model. So they don’t have a BIP for Fctxs. You can’t follow and discuss upcoming developments on BSV in Github.

github.com/bitcoin-sv-spe…
Steve Shadders gave a definition and purpose for Fctxs in a blogpost.

bitcoinsv.io/2020/09/16/bey…
Pieter Wuille, Jonas Nick and Tim Ruffing gave a definition and purpose for Ssigs in BIP340.

github.com/bitcoin/bips/b…
What are Fctxs?

Nodes keep a copy of the UTXO set. The more unspent UTXOs, the larger it is, and storage costs money. If a user has lots of tiny UTXOs, then consolidating them together can save nodes money. It is therefore in nodes’ interest to let users do this for free.
What are Ssigs?

Bitcoin txs work by combining a private key with a message transferring a UTXO to a different public key, using the ECDSA algorithm. A Schnorr signature is a different algorithm that allows you to put more information into a tx while using less data.
How do Fctxs mitigate blockchain bloat?

By allowing users to consolidate their UTXOs at no cost, they encourage a smaller blockchain with less overall UTXOs.
How do Ssigs mitigate blockchain bloat?

By allowing complex txs with multiple signatories to be written with more efficient mathematics, then as complex activity increases, it will lead to less data on the blockchain.
The maths behind Fctxs is very simple. This image is Shadders’ equation: the number of outputs (nOutputs) minus number of inputs (nInputs) of a consolidating tx gives you the number of txs difference (uxto_delta). (NB he has misspelled UTXO in this equation.)
As long as uxto_delta is high enough, then it is in miners’ economic interest to allow the consolidation transaction to occur for free, because it saves them money in storage.
The maths behind Ssigs is complicated. This image is Wuille, Nick & Ruffing’s equation describing their implementation of the algorithm. Where m = message P = public key G = the base of the curve
Ssigs use the same secp256k1 curve that ECDSA does. If you’re interesting, coords for point G are (0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798, 0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8)

en.bitcoin.it/wiki/Secp256k1
Fctxs are basically implemented by one function, IsConsolidationTxn, defined in /src/policy/policy.h the code comments just say “Consolidation transactions are free”

github.com/bitcoin-sv/bit…
Ssigs took a whole library to implement, but since this is Twitter let’s focus on the function secp256k1_schnorrsig_sign, defined in /src/secp256k1/include/secp256k1_schnorrsig.h

github.com/bitcoin/bitcoi…
The body of IsConsolidationTxn can be found in /src/policy/policy.cpp. Aside from spam detection and making sure all the txs are valid, etc. the magic comes down to two lines:

if (tx.vin.size() < factor * tx.vout.size())
return false;

github.com/bitcoin-sv/bit…
But just to be safe, the function sort of checks for the same thing again before its final return:

if(sumScriptPubKeySizeOfTxInputs < factor * sumScriptPubKeySizeOfTxOutputs)
return false;
The body of secp256k1_schnorrsig_sign can be found in /src/secp256k1/src/schnorrsig/main_impl.h It calls a series of functions within the library to run the Schnorr algorithm.

github.com/bitcoin/bitcoi…
I do not understand the mathematics of the Schnorr algorithm, but I can show you the code. Here’s most of the code that does the work with the mathematical curves
Fctxs is basically a very simple algorithm, an “if… then…” statement that compares whether one number is smaller than another. Ssigs practically apply an algorithm designed by cryptographer Klaus Schnorr to the innards of Bitcoin & are a work of genius.
Furthermore, Schnorr signatures help advance BTC’s security & privacy features.
In contrast, fctxs on BSV just create an opportunity to game the system. Even Shadders sot of hinted at this in his blog post.

There is economic incentive to spend all your BSV to thousands of addresses you create for yourself, then use fctxs to make free payments.
One of these blockchains is undergoing incredible development with advanced cryptography. The other one… isn’t.

If you’ve got this far, thanks for reading, I hope it was as fun to read as it was to write.

I recognise this is a complicated & massively geeky hobby.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Pete Myers

Pete Myers Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!