Gocoin‎ > ‎User Manual‎ > ‎

Spending BTC

Spending money is a secured process that requires several steps and moving files between your online client PC and your offline wallet machine. USB flash disk is probably the most convenient medium to use for this purpose.

Never move any files others than the ones that you actually need to move, which are:
  • The balance/ folder containing your unspent outputs - you move it from client to wallet
  • Text files with signed transactions - these you move from wallet to client
Assuming that you would not sign a wrong transaction, nothing in the files you move between the two points is security sensitive, so you do not need to worry about protecting the medium (USB disk).

1. Export your balance

In order to spend your coins you will need to copy the balance folder (containing unspent.txt and one or more <txid>.tx files) to the PC that runs your wallet.

1.1. Use balio tool

There is a tool balio that can fetch a balance of your wallet from a public block explorer (specifically from blockr.io)
Run the tool from a command line with a path to your wallet file or the list of (space separated) public addresses for which you want to fetch the balance.
It should create the balance/ folder in the current directory, ready to be provided to your wallet.

Note: balio can also fetch balance of Litecoin addresses. You can then spent your Litecoins using gocoin wallet, along with -ltc switch.

Note: fetching the balance this way exposes your privacy.
To use balio through Tor, set TOR environment variable in your system, pointing it to your tor's socks proxy (e.g. TOR=localhost:9050).
Additionally, despite of using Tor, to further protect your privacy try fetch balance of single addresses instead of entire wallets.

1.2. Use client node

From the moment when wallet.txt (or its renamed version) is properly loaded into your client, you can check and export your balance.
There are two ways to do so. A third way is a special kind that allows you to assemble the transaction using a convenient interactive way.

1.2.1. TextUI

Each time you execute TextUI bal command, a directory balance/ is (re)created, in the folder where you run your client from. 
That is the folder you need to move to your wallet environment.

1.2.2. WebUI

Use the home page of the WebUI to download balance.zip file.
Extract the zip file to get the balance folder.

1.2.3. WebUI / MakeTx (Coin Control)

WebUI has  MakeTx page that allows you to assemble a transaction using quite a convenient, interactive way.
After you fill in all the transaction details, it will give you payment.zip with the exact command that you shall execute at the wallet machine.

MakeTx tab is currently the only way to spend coins from multisig addresses (TextUI does not support it)

2. Sign your transaction

As mentioned before, to spend your money you need to move the most recent balance/ folder, from the client node to the PC with your wallet. Now, on the wallet PC, when you execute wallet without any parameters (in the same folder where the balnace/ is placed), it should show you how much BTC you are able to spend, from the current balance.

To spend your coins, order the wallet to make and sign a new transaction, using a command like:
    wallet -send 1JbdKe4eBwtexisGTbCKY5v5CfphtdZXJs=0.01
Please note no spaces between the address, the equal sign and the value. The value represents the amount in BTC, which you request to send to the given address.

There are also other switches which you may find useful at this stage (i.e. a fee control). To see all your options, just run wallet -h

3. Verify signed transaction

If everything goes well with the wallet -send ... command, it will create a text file with a signed transaction. The file is named like 01234567.txt - this is the file you need to move to your online node in order to notify the network about your payment. Before you broadcast your signed transaction to the network, verify carefully it does exactly what you intended. You can do it in a several ways. In any case, first move the signed transaction file to your online PC.

3.1. Wallet

To see a decoded content of a transaction, execute:
  wallet -d rawtxdata.txt

3.2. TextUI

Use the node's TextUI to execute tx 01234567.txt (where 01234567.txt is the path to your transaction file). The node will decode the transaction and display it's details (inputs, outputs, fee, TXID).

3.3. WebUI

Use WebUI and it's "Upload Transaction File" form. After you load the transaction, its details will be shown in your browser, for your verification.
Alternatively, you can click the Load TX link at the top of the page and paste a hex-dump of the signed transaction into the dialog that will pop up.

Note: always verify transaction before broadcasting it!
Verify that the decoded content of a transaction matches exactly what you intended to spend.
If what you see would not be what you wanted, do not broadcast the transaction, but destroy the transaction file immediately.
If you follow this simple rule, your money will be safe, even in case if there was a critical bug in the wallet application that would otherwise destroy your coins (which we hope there isn't).
Additionally this step allows you to double check that you did not make any mistake making the transaction, giving you the last chance to fix it.

4. Broadcast the transaction

After making sure that the transaction does indeed what you intended, you must broadcast it to the network, in order to actually move your coins.

4.1. WebUI

Load the transaction using the client's WebUI. Click on the envelope icon with a green arrow to broadcast a loaded transaction to the network. Coming back to Transactions tab later, press the button in the "Accepted transactions" row, to see all the transactions you've loaded (those with a red background are yours). You can also unload a previously loaded transaction by clicking on the red X icon.

4.2. TextUI

Use stx command with the transaction ID as its parameter (you had the ID printed, when loading it).

4.3. Web services

Use any web page that allows you to push a raw transaction to the bitcoin network.

Just copy the text from the transaction file, paste it into the form and push the button.

Note: you may want to access a web page via Tor, being concerned about exposing your IP.

Re-broadcasting transactions

The client never broadcasts transactions unrequested, so if your transaction does not appear in the chain soon enough, you may want to re-broadcast it, using the same method as for the initial broadcasting. There may of course be other reasons why your transaction does not get confirmed (usually because the fee was to low), in which case re-broadcasting it will not help you much.

There is also a TextUI command stxa that re-broadcasts all the transaction that have been loaded, but not yet confirmed by the network. Note that when a transaction gets mined into a block it gets removed from the list automatically.