What Is A Stonewall Transaction?

BTC stonewall transaction

Share this article

Bitcoin is a permissionless digital currency that is designed to be secure and censorship-resistant while also retaining some elements of privacy. If you were to use Bitcoin without KYC, you could take advantage of its pseudonymous nature; unfortunately, this isn’t a reality for most people. 

Today, many new Bitcoin holders acquire their funds through centralised exchanges, which require proof of identity to transact, or they publicly expose addresses by tying them to social media profiles or websites. 

The Bitcoin blockchain doesn’t care about KYC or how you promote your addresses, it doesn’t store this data anywhere, but chain analysis firms do. They thrive on it; in fact, it’s the reason they exist. These third-party data brokers are constantly trying to connect outside metadata with Bitcoin transactions, and due to that, Bitcoin transactions are not actually as private as many people believe.

Since Bitcoin transactions are recorded on a public ledger called the blockchain, anyone with access to the blockchain can see all of the transactions that have ever been made. 

So chain analysis firms have one piece of the puzzle, and their next data mining operation involves securing and scraping as much third-party data as possible and matching it up with what can be found on-chain. 

The dangers of deanonymisation

Although Bitcoin addresses are pseudonymous, when they are linked to real-world identities through a process called “deanonymisation.” it can become extremely dangerous for individuals. 

For example, if a person uses the same Bitcoin address to buy drugs on the dark web and then to buy a coffee at Starbucks, it is possible to link those two transactions together and identify the person who made them, or worse, assume that it is you using the same wallet since this isn’t a set science but a series of educated guesses. 

It is important to be aware of the lack of privacy in Bitcoin transactions before using the currency. If you are concerned about your privacy, you may want to consider using a different method of transferring your funds.

There are a number of ways to make Bitcoin transactions more private, such as using CoinJoins, Whisper Addresses, Stealth Addresses, Private Payments, Paynyms, Silent Payments or a privacy-focused wallet. Each method has its own requirements, cost and level of involvement, which you need to research first and decide on before you pick your preferred privacy method. 

If you are using a privacy wallet like Samouri, you could use their Stonewall transaction as an example.

What is Stonewall?

A Stonewall is designed to improve your privacy on the blockchain by introducing a large element of doubt and uncertainty into the datasets of blockchain analysis platforms. However, Stonewall will not always be possible for every transaction, depending on the address types used and the amount of funds available to construct the transaction. 

Stonewall is a unique way of building transactions that increases the deniability of the link between the sender and recipient of a transaction and is sometimes referred to as a fake two-person CoinJoin. Stonewall transactions are under the hood, regular transactions between two addresses. However, Stonewall transactions do something odd for tracking by including an unnecessary number of sending addresses (inputs) and change addresses (outputs).

Stonewall works using the Boltzmann script that returns the entropy of a given transaction. This script measures the linkability of inputs to outputs of a given transaction, by determining the number of individual mappings of the inputs to outputs used in the transaction.

Stonewall is enabled by default in Samourai wherever possible, and there is no extra charge for using it. If you want to send a transaction without Stonewall, you can toggle Stonewall off via the toggle switch on the Send screen. 

How does Stonewall work?

UTXOs in your wallet are grouped by address type (P2PKH, P2SH-P2WPKH, or P2WPKH). Depending on the amount of UTXOs in each address type, certain conditions will apply.

  • The group with the same address type as the address being spent to is selected if it is >= twice the spend amount.
  • If the above condition is not met, then a group with a different address type and a total value >= twice the spend amount is selected.
  • If the above condition is not met, then 2 groups with total amounts >= the spend amount are chosen.

Transaction composition is arranged by “sets”.

For each set:

  • The UTXOs are processed in randomised order.
  • UTXO(s) are selected until the total amount selected is >= the spend amount.
  • Utxos resulting from the same transaction are never used together in the same transaction. UTXO(s) of higher value replace UTXOs of lower value belonging to the same transaction.
  • All UTXOs from a same address (scriptpubkey) must be consumed within the same set.
  • Output addresses (scriptpubkeys) must be used exclusively as outputs and only once.
  • One set contains the spend output.
  • The other set(s) contain(s) a “mix” output and use(s) the same amount and the same address type as the spend output.
  • The change outputs in each set use the same address type as the UTXO (s) for that set.

Costs of a Stonewall transaction

The miner’s fee must be an even amount; therefore, each set pays half the fee by deducting precisely 50% from each change output.


Do your own research.

If you want to learn more about Stonewall for Bitcoin, use this article as a jumping-off point and don’t trust what we say as the final say. Take the time to research, check out their official resources below or review other articles and videos tackling the topic.

Are you a Bitcoin and privacy fan?

Have you been using Bitcoin privately to mask your on-chain footprint? What is your preferred method of masking your transactions? Which app is your favourite? Have you tried all the forms of privacy payments? Which one do you prefer? Do you have any tips for keeping chain analysis in the dark?

Let us know in the comments down below.

Disclaimer: This article should not be taken as, and is not intended to provide any investment advice. It is for educational and entertainment purposes only. As of the time posting, the writers may or may not have holdings in some of the coins or tokens they cover. Please conduct your own thorough research before investing in any cryptocurrency, as all investments contain risk. All opinions expressed in these articles are my own and are in no way a reflection of the opinions of The Bitcoin Manual

Leave a Reply

Related articles

You may also be interested in

Listed miners buying Bitcoin

Why Bitcoin Miners Are Buying Bitcoin

MicroStrategy (MSTR), the software company founded by Michael Saylor, is the first to adopt a Bitcoin treasury policy, and it’s done wonders for his share

Cookie policy
We use our own and third party cookies to allow us to understand how the site is used and to support our marketing campaigns.