TESTNET TESTNET TESTNET TESTNET TESTNET TESTNET
Andytoshi's Centralized Coinjoin

Raw Transactions

What are raw transactions?

A raw transaction is a Bitcoin transaction in its network serialization format, in hexadecimal format rather than raw binary. It consists of a direct serialization of the transaction's version, inputs, outputs, and locktime.

Transaction inputs are the outputs of previous transactions. If you are unfamiliar with the way that transactions are chained together, it is recommended to read this FAQ before proceeding to create raw transactions.

The exact raw transaction format is described in the Bitcoin protocol specification.

How do I make a raw transactions?

If you are managing your own keys (which is a very dangerous idea!), there are online raw transaction generators such as that on brainwallet.org. (TODO fork this and remove all the dangerous garbage..)

If you are using bitcoind, you can create raw transactions using the RPC interface. (bitcoin-qt users can access the bitcoind RPC interface by using the Debug console, under the Help menu; command-line users can use the utility bitcoin-cli.) This is a three-step process:

  1. First, locate the outputs that you own and would like to spend:
    bitcoin-cli listunspent
    This will display a list of many entries such as
        {
            "txid" : "244323fe4ccf6380b47117f1fcbf41e05c6a016dbd0f69e58c3e0ca9e6cc4e9f",
            "vout" : 3,
            "address" : "1M1FX3UZRHgaNvKCUs6ZgNgruijWDP4GPV",
            "account" : "",
            "scriptPubKey" : "76a914db6ea279e6dda6e27adc80d6244a6f04711b4ec788ac",
            "amount" : 0.20000000,
            "confirmations" : 34373,
            "spendable" : true
        },
    
    These outputs are uniquely identified by the fields txid and vout. Once you have selected the outputs you want to mix, these are the only fields you need. Note that you cannot select partial outputs – if you are trying to get a specific amount, you will need to overshoot.
  2. Obtain some output addresses. This is done with the command
    bitcoin-cli getnewaddress
    You want to create as many outputs as possible with the target amount of the join, then one "change" output to compensate for the overshoot in the previous step. The difference between the total output value and the total input value is the transaction fee, and will be claimed by miners. If you miss a zero and your outputs are 1/10th the size you intended, then 90% of your funds will go to fees. So be very careful here.
  3. Create the transaction. Using the txid/vout pairs from step 1, and the addresses from step 2, run the command
    bitcoin-cli createrawtransaction \
      '[{"txid": "txid1", "vout": vout1},
        {"txid": "txid2", "vout": vout2},
        {"txid": "txid3", "vout": vout3}, ...]' \
      '{"address1": amount1,
        "address2": amount2,
        "address3": amount3, ...}'
  4. where txid1, vout1, address1, etc., are the values from the previous steps. Notice that you need to specify amounts for the outputs, but not for the inputs (these are implied). This is an easy opportunity to make mistakes.

The output of the final step will be a long sequence of hex digits. This is the raw transaction. To confirm that it is what you intended, run

bitcoin-cli decoderawtransaction <rawtx>

How do I sign a raw transactions?

Before signing anything, check that it is what you intended:

bitcoin-cli decoderawtransaction <rawtx>

Then to sign the raw transaction, use the command

bitcoin-cli signrawtransaction <rawtx>

Permanent Links

The joiner is also available as a Tor hidden service. You can access it at either of these URLs.
https://www.wpsoftware.net/coinjoin/
http://xnpjsvp7crbzlj3w.onion/


Thanks for helping Bitcoin's privacy.