Gocoin‎ > ‎User Manual‎ > ‎

Stealth address

Stealth addresses are another useful feature of the bitcoin protocol.
The idea is that you have only one stealth address - you do not need more.
Whatever payment is being made to your stealth address cannot be detected by looking into the block chain.
Only the person who made the payment (and of course you - the owner of the stealth address) will know that a payment was made to your stealth address.

A stealth address is much longer that a regular bitcoin address - it may look like this:
You can use the tool, called stealth (tools/stealth.go) to see what is inside such a string.
For the given example, the tool would print:
 Version: 0x2a = 42
 Options: 0x00 = 0
 scanKey: 0346fb8874b3ed3917b88bf9cfefb17f66a99942f4ce5f96c17c492c84f5c784cc
 spndKey: 0268ac2033722fa594d4f70ecc15e8a2a2585dd8d74f8ba399471608b5d3fbae3b
 sigNeed: 1
 Prefix : /0

The latest version of Gocoin supports payments to stealth addresses.
Just put a stealth address in place of a regular one and the wallet will take care of making a proper transaction.

Create your own stealth address

To create your own stealth address first you need a secret key that will be used in the online node to monitor the blockchain for coins coming to this address.
This secret key will need to be kept on your online machine, so by definition it will not be as secured as your cold storage wallet.
Although if a secret scan key gets stolen, it only compromises anonymity of your stealth address, but does not endanger coins kept at the stealth address.

Create a scan key

In reality you can use use any 32 bytes of a random data as a private scan-key. The public key gets calculated from it.
For convenience it is advised to create the scan key from a seed password, so you would be able to re-create it in a future in case if you'd loose it.

Creating a scan-key using the node's TextUI is simple. Just execute such a text command:
 arm -c
The node will ask you to enter the key's seed password and then re-enter it for verification.
This password should obviously be different from the actual password that you use in the wallet machine, but make sure to not forget it.
After you re-enter the same password, a secret scan-key is created out of it and automatically stored in the node's memory.
The secret key will stay in the node's memory until you shut down the node or remove it using TextUI's:
 unarm *

The node will also output the command that you should execute on your wallet machine (that's the same one as described in the next section).
The example procedure should look like this:
 > arm -c
 Enter seed password of the stealth key (empty line to abort) : ***
 Re-enter the seed password : ***
 You have created a new stealth scan-key. Make sure to not forget this password!
 Public hexdump: 031ffc0c7b5767561587482fca6fe794275b17874914d45aec3615ee650cbb6b16
  Go to your wallet machine and execute:
    wallet -scankey 031ffc0c7b5767561587482fca6fe794275b17874914d45aec3615ee650cbb6b16 -prefix 0
    (change the prefix to a different value if you want)
 Stealth key number 0 has been stored in memory
 Reloading the current wallet...
 Ready in 0.004s

Save you secret scan key if you want

You can save your generated scan key(s) on disk.
Remember that if the saved file gets compromised, it will exposes anonymity of your stealth address.
At the other hand, having the key saved is much more convenient, because you do not need to re-arm your node with the secret seed each time you start it.

To save all your scan keys to disk, execute TextUI command:
 armed save

If you decide to not save, each time after launching the node execute the arm command (this time with no parameter) and re-type the seed password.

Note: without the arming or having the key saved, you won't be able to monitor balance at your stealth address.

Create the stealth address at your wallet machine

Take the line printed previously by "arm -c" to your wallet machine and execute there:
 wallet -scankey 031ffc0c7b5767561587482fca6fe794275b17874914d45aec3615ee650cbb6b16 -prefix 0
Now you will need to enter your actual wallet's seed password - the one that you will use to spend the coins.
Assuming that your wallet's seed password is e.g. my_wallets_seed_password, you will get such a stealth address:
This is the address that you can give to other people in order to receive stealth payments.

Note: do not use stealth addresses that come from same keys, but use different prefixes - it would likely cause performance issues.

You can specify the prefix other than 0. The bigger prefix you choose, the less work your node will have trying to find transactions coming to your stealth address, but the more it will expose your anonymity.
Also note that some wallets do not yet support sending coins to stealth addresses with prefixes other than 0, nor this functionality was tested with any other wallets than Gocoin itself.

Add stealth address to wallet

To monitor a balance of the stealth address you need to add it to any of the text files in your node's wallet/ folder - just put there a new line:
 vJmwbjGCDDbUZh2shn9hZLPi3X7bSpwCuZtStNuc7XmR1A66zv5iTarBL3s51bp6QmG6qej82Zau2Fs9kHXhY8rLHZRpdrdbsi7Pt4 My stealth key
Note: you can add a label in the same line after space.

Obviously you will need to select the wallet that contains a stealth address to see its balance.
Also, as mentioned before, keep in mind that your node needs to be armed with the secret of the scan key.
To list the currently "known" stealth keys use TextUI command:

As soon as your node knows a secret scan-key of a specific stealth address it keeps monitoring its balance.
You will be able to select coins sent to this stealth addresses in WebUI's MakeTx tab and they will be returned when fetching the balance.