HackMD
  • Beta
    Beta  Get a sneak peek of HackMD’s new design
    Turn on the feature preview and give us feedback.
    Go → Got it
      • Create new note
      • Create a note from template
    • Beta  Get a sneak peek of HackMD’s new design
      Beta  Get a sneak peek of HackMD’s new design
      Turn on the feature preview and give us feedback.
      Go → Got it
      • Sharing Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • More (Comment, Invitee)
      • Publishing
        Please check the box to agree to the Community Guidelines.
        Everyone on the web can find and read all notes of this public team.
        After the note is published, everyone on the web can find and read this note.
        See all published notes on profile page.
      • Commenting Enable
        Disabled Forbidden Owners Signed-in users Everyone
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Invitee
      • No invitee
      • Options
      • Versions and GitHub Sync
      • Transfer ownership
      • Delete this note
      • Template
      • Save as template
      • Insert from template
      • Export
      • Dropbox
      • Google Drive Export to Google Drive
      • Gist
      • Import
      • Dropbox
      • Google Drive Import from Google Drive
      • Gist
      • Clipboard
      • Download
      • Markdown
      • HTML
      • Raw HTML
    Menu Sharing Create Help
    Create Create new note Create a note from template
    Menu
    Options
    Versions and GitHub Sync Transfer ownership Delete this note
    Export
    Dropbox Google Drive Export to Google Drive Gist
    Import
    Dropbox Google Drive Import from Google Drive Gist Clipboard
    Download
    Markdown HTML Raw HTML
    Back
    Sharing
    Sharing Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Note Permission
    Read
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Write
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    More (Comment, Invitee)
    Publishing
    Please check the box to agree to the Community Guidelines.
    Everyone on the web can find and read all notes of this public team.
    After the note is published, everyone on the web can find and read this note.
    See all published notes on profile page.
    More (Comment, Invitee)
    Commenting Enable
    Disabled Forbidden Owners Signed-in users Everyone
    Permission
    Owners
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Invitee
    No invitee
       owned this note    owned this note      
    Published Linked with GitHub
    Like BookmarkBookmarked
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- tag: Research --- # Contacts, Labelling, and Coin Control This is a research document to collate information on contacts, UTXO labelling and coin control strategies within the bitcoin framework. #### Goal The goal of this research is to provide a contextualised approach to understanding the above with regards to privacy and best practises when sending bitcoin payments. At the moment, only a small group of users (tech savy, privacy focused cypherpunks) are getting the full benefit of what bitcoin payments have to offer with regards to privacy. More often than not, bitcoin is described as a "pseudoanonymous" payment mechanism. This is because information can be unveiled over time to users on the network (e.g address reuse, large change outputs, etc). We'll get to more of this detail later, but for now just be aware that bitcoin is only as private as you make it. So the goal of our research is to highlight and understand these privacy leaks, and provide research on how to go about creating best practises to accentuate anonymity in payments -- making privacy in bitcoin something which any user can take advantage of, not just a select few. #### Glossary For any information on definitions and terms, please visit the [Bitcoin.Design Glossary](https://bitcoin.design/guide/glossary/). ## Bitcoin's UTXO Model In order to get a good understanding on contacts, labelling, and coin control within bitcoin payments, one must first understand the nature of Bitcoin's accounting model - Unspent Transaction Outputs (UTXOs). --- Every bitcoin transaction (From -> To) has inputs: coins that are being spent, and outputs: the corresponding change from those inputs (seen in the form of new "coins"). For reference, these newly created (unspent) coins do not have to equate to entire units of a bitcoin (i.e 1 BTC). Instead, they are often fractions of a coin, or change. The best way to think of it is, "as change is created from transactions, it creates new and unique coins to be spent". The input of a transaction has to be an unspent output of a previous transaction, and so on. Each UTXO is the most recent link of a chain that can be linked all the way back to its original form (a whole bitcoin), minted as a block reward. In leighmans terms, if I go shopping for groceries and the total comes to $0.75, but I only have a $1 note, I will pay with this and receive $0.25 change. This change ($0.25) is the unspent transaction output (UTXO) which returns to my wallet as change, and will be seen as a unique "coin" that can be used in future transactions. Each bitcoin wallet will display a balance or total amount of funds to the wallets owner. A lot of the time, what wallet owners don't see are the different coins (UTXOs) that amount to their total balance. More often that not, a wallet's balance is comprised of multiple UTXOs (coins) that add to a sum of all their values. For example... ``` WALLET BALANCE: 6.8 BTC Contains 8 UTXOs : 0.2 BTC | 0.8 BTC | 4.6 BTC | 0.004 BTC | 0.0182 BTC | 0.128 BTC | 0.0012 BTC | 1.0486 BTC ``` --- ## Problems with Privacy Despite having it's various benefits, bitcoins UTXO model (if not used effectivly) can lead to privacy loss for both payers and payees. Tactics such as Coinjoins, unique address generators, and more can be used to curb this loss over time. However, in a nutshell, here's why Bitcoin's UTXO model can lead to privacy loss and transaction tracking. ### Unique UTXOs & Contact Mixing > *"Each UTXO is a unique snowflake with a public transaction history. For example, when Alice sends a coin to Bob, then Bob does not just have any random UTXO, but he has specifically the coin that Alice has sent him. When Bob sends this coin to Charlie, then Charlie can check the history of the coin and see the transaction from Alice to Bob. But due to the pseudonymity of Bitcoin, he does not necessarily find out that Alice is involved."* > > *"There is a chain of digital signatures all the way from the coinbase reward to the current UTXO. This transaction history can reveal sensitive information about the spending patterns of individuals. The receiver of a coin can look back into the transaction history of the sender. And the sender can see the future spending of the receiver."* > > **[Wasabi Docs](https://docs.wasabiwallet.io/why-wasabi/Coins.html#problem)** Say that part of one of my coins ends up in the wallet of a friend (from a payment), they have the ability to retrace that coins footsteps all the way back to its original (whole) form. Say Alice had used one of her coins to buy Bob a birthday present, and then later used the change from that transaction to pay Bob back for the pizza he bought her last week. Bob, in theory, could trace the coin back until he discovered the transaction in which Alice bought him a present (perhaps he knows the exact price of what it is he asked for). This is obviously a fairly harmless example, but does show the potential of how our transactions can be traced. Furthermore, coin consolidation (or merging) can lead to an even further loss of privacy. This happens when two or more coins are selected for a transaction's inputs and merged as a single output (change). ### Address Reuse & Wallet Clustering If an address is used more than once to receive a bitcoin transaction (or change outputs from outgoing tx's), the address begins to collect multiple coins to spend under the management of one private key. It becomes very easy to find each UTXO held by the address, and therefore the address's total balance. What's more, if an outgoing transaction has a reused address, then it is more than likely that the output of this transaction is the payment destination. This is because most wallets automatically generate new change addresses for each transaction, whereas the payment destination is selected manually by the wallet owner. > The address reuse would happen because the human user reused an address out of ignorance or apathy - **[Bitcoin Wiki](https://en.bitcoin.it/Privacy#Address_reuse)** Chain analysis companies recognise that change outputs are sent to newly generated addresses, therefore any resused address is a payment destination and may be a point of reference for UTXO clusters. #### Dusting Attacks A dusting attack is when an actor (usually a security/chain analysis firm, or malicious actor) sends an almost unnoticeable amount of bitcoin (perhaps a few hundred/thousand satoshis) to an address. As mentioned before, since UTXO spending histories link addresses and transaction timelines, addresses become contaminated with dust, exposing address and balance data. Furthermore, if this dust is then moved (perhaps unknowingly used as a transaction input by the address owner), the attacker (or sender of the dust) can further their search of deanonymising wallet owners and their spending habits. This knowledge can then be used in subsequent phishing attacks or perhaps even blackmailing wallet owners into cyber-extortion. As mentioned, research labs, government agencies and other companies also use dusting attacks as an attempt to deanonymise blockchain networks such as Bitcoin. The solution to these dusting attacks are for wallet owners not to spend the dust in their wallets, or to move them between different addresses. As long as the dust stays where it is, the wallet owner can avoid contaminating the rest of their funds and hence their privacy too. --- ## Solutions ### Labelling & Coin Control Coin control is the ability for users to manually select which coins they wish to use as inputs when funding a bitcoin transaction. This is often seen as a more advanced feature in bitcoin wallets as it gives users greater control over optimising for privacy during transactions. Coin control is made a lot easier when paired with a process known as UTXO/coin labelling. This is similar to attaching a reference or name to your transactions, so you know exactly who you sent which coins to (and perhaps what for). When creating bitcoin transactions, some wallets ask you to label the recipient's address (e.g Bob), so when looking back at your UTXOs their transaction histories are fairly clear at a glance. Once labelled, bitcoin wallets can inform the owner of which coins have been where and used by whom. Users can then manually select or prioritise transaction inputs based on what information has already been revealed, and what could be revealed in the future. Payees can only see UTXO histories that they have been exposed to, as well as the addresses of these UTXOs are linked to by association. So, assuming users are not reusing addresses, reusing coins that are associated with a contact/label can minimise the risk of address and balance exposure to payees. #### The Importance of Labels When wallet owners receive coins (either in the form of an incoming payment, or a change output from an outgoing payment) they are able to label these coins, specifying "who" it is from. Labels not only provide context to a wallet's transaction history, but also are essential in identifying the origin of coins - making it easier to avoid a cross contamination of payment, balance, or address information during future transactions as inputs are selected. Groups of coins with the same label are often referred to as "clusters". For the purpose of privacy, it is generally best practise to avoid mixing coins from different clusters as transaction inputs. If this happens, the addresses (or labels) associated with those coins become linked and the anonymity of payments begins to degrade. More on this in the Privacy in Bitcoin Transactions chapter. ### Minimising Change Outputs As we have talked about already, each bitcoin transaction contains both inputs and outputs. Inputs are either an automatic (algorithmic) or manual selection of UTXOs from an address. Like many of our day-to-day transactions with cash, there is often change involved. These coins are known as "change outputs", and are simply UTXOs returned to the senders wallet (often to a newly generated address). If I receive a bitcoin payment from someone, I can analyse the transaction data and clearly see which outputs were change and which were a payment to me. Once I know the change output address, I can see the sensitive information (e.g balance) of that address, as well as any other UTXOs associated with it. For example, if I receive a payment of 0.5 BTC ($25,000) for my christmas bonus, and then use this UTXO to fund a transaction at my friend's coffee shop, they are able to analyse the transaction data and see that I funded the payment with a coin worth $25,000. They might then ask a bunch of questions which is frankly none of their business. So, in order to reveal less balance data, users can select smaller coins for these types of transactions, or perhaps use mixers/coinjoins to create private (anonset) coins for spending. Therefore, by minimising the change outputs of a transaction, we can reveal the least amount of balance information possible to our own payees. Some automatic coin selection algorithms (Branch & Bound, or Blackjack) aim to create the least amount of change outputs possible in order to make payments inherently more private. Some even attempt to create an "exact match", which means there are 0 change outputs (i.e the transaction is funded with the exact amount required to fulfill the payment request). ### Avoiding Address Reuse BIP 44 (Multi-Account Hierarchy for Deterministic Wallets) is now an industry standard improvement protocol that uses a master secret (private key) to generate a tree structure of "child" private keys and addresses. This is a deterministic solution because the same parent secret will always generate the same child private keys. This allows for wallets to generate new (child) addresses each time you wish to receive an incoming transaction, whilst still maintaining the umbrella security of one private (parent) key that can be used to calculate each child private key. Once an address has been calculated and used (coins are received by it), this address will now longer show in the wallet UI under the "Receive" tab, instead a new child address will have been created to avoid address reuse. Furthermore, BIP 44 wallets use an alternative key derivation function called "hardened derivation", increasing the security of parent/child private keys by removing the ability for parent private keys to be calculated from their child private keys. ### CoinJoins & Mixers As mentioned before, each UTXO has a public transaction history which can be analysed all the way back to its original coinbase reward. This inadvertently links senders and receivers, inputs and outputs. In order to obfuscate this link between the inputs and outputs of bitcoin transactions, some wallets and third party services use CoinJoins or Coin Mixers to reinstate a sense of anonymity. CoinJoins are used to build large transactions which have a number of inputs and equal value outputs. Inputs are usually non-private, and can therefore be linked to the coins previous transaction history. However, the outputs are intentionally made to be of equal value, obscuring the link between the inputs and change outputs of the CoinJoin anonset (anonsets are the number of transaction inputs for CoinJoins, the larger the amount of inputs e.g 100, the less chance an observer has of guessing the correct transaction history of a change output). When a user now sends one of these anonset coins (the output of a CoinJoin), the receiver cannot clearly see the transaction history of the UTXO before the CoinJoin occured. Furthermore, if the receiver decides to do a CoinJoin using the same UTXO, the previous sender cannot survey the future spending patterns/tx's of that UTXO. Observers (senders, receivers, or others) can only hazard a guess at the correct input/output link. The chances of them correctly guessing this link and therefore linking the UTXO histories is a rate of 1/Anonset, e.g 1/100 or 1%. CoinJoins are very useful tools in obscuring UTXO histories and re-anonymising coins, however they are not foolproof and can in theory be unveiled. However, as UTXOs go through more and more CoinJoins (perhaps for increased security), the chance of association diminishes rapidly.

    Import from clipboard

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lost their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template is not available.


    Upgrade

    All
    • All
    • Team
    No template found.

    Create custom template


    Upgrade

    Delete template

    Do you really want to delete this template?

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Tutorials

    Book Mode Tutorial

    Slide Mode Tutorial

    YAML Metadata

    Contacts

    Facebook

    Twitter

    Feedback

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions

    Versions and GitHub Sync

    Sign in to link this note to GitHub Learn more
    This note is not linked with GitHub Learn more
     
    Add badge Pull Push GitHub Link Settings
    Upgrade now

    Version named by    

    More Less
    • Edit
    • Delete

    Note content is identical to the latest version.
    Compare with
      Choose a version
      No search result
      Version not found

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub

        Please sign in to GitHub and install the HackMD app on your GitHub repo. Learn more

         Sign in to GitHub

        HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Available push count

        Upgrade

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Upgrade

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully