The Safex blockchain is private and operates differently to public blockchains such as Bitcoin and Ethereum. However, as a trade-off for extra privacy comes added complications when it comes to managing your addresses.
As you might know, a Bitcoin address uses two keys – a public and a private key. The public key can be used by anyone to SEND funds TO your address, and the private key is used to SEND funds FROM your address.
Safex is a little different – it uses four different keys, each with its own specific application.
When a Safex address is generated you are different 6 different sets of keys. Below is an example.
Seed Phrase: liar voice coffee spout annoyed ... apricot bagpipe
Private* Spend Key: abf29836613f0b9f9af90d6aceb1f00fafd6cc62bbcc73c74b9bb53b920f0809
Private* View Key: 8c6918aa5a2c577dff8ee7e77616e6621ccf16ca257be6f6136c23e171026705
Public Spend Key: 0605d40ea3b39ce17660d40a754ef018e64f5c79a0ceecfe0fc302db522e6f12
Public View Key: 5abbbceb1ed975ee2f3cb0b1d30f8ec9083bff7533bd4372ff4e5690f9ead05f
Public Address: Safex5ytfnK3T2DxoLcQ7M2kTZfoz7wcPMLwqcRRvZzHdggwaGUYKzbgKxsyaDpA47Wk7xbs7JWxnLc1RPCUaoMXRFTAavZePei1w
*Note that private is sometimes referred to as “secret” – E.G Secret Spend Key.
If you’ve ever generated an address via the Safex CLI Wallet, you will have been given a 25-word phrase, known as seed keys. This phrase has all the information needed view and spend funds from a Safex wallet.
These words correspond to a 256-bit integer, which is the address private spend key. The private view key is created by hashing the private spend key with Keccak-256 (which is a common cryptographic hashing function), producing a second 256-bit integer.
These seed keys are useful for backing up your private spend and view key. It’s recommended you save and store these keys somewhere secure and private.
Other than being used for recovering your private keys, the Seed Phrase has no other functionality in your day-to-day use of the Safex blockchain.
Private Spend Key
The private spend key is used to transfer Safex Cash and Safex Token out of your wallet. It’s also used to view any previous outgoing transactions from your wallet.
If you don’t have a copy of your Seed Phrase, you can use the private spend key as an alternative for address recovery.
Private View Key
The private view key is required to view incoming transactions. This key is generated by hashing your private spend key with Keccak-256 (this is all done automatically within the software).
This key on its own can only view INCOMING transactions and cannot view OUTGOING transactions.
The Safex Blockchain is private by default, but with the added function to share your balance details with trusted parties.
You can generate a “view only” wallet with the private view key. This is particularly helpful if you have an accountant who needs to keep track of your incoming transactions for tax purposes.
Another scenario would be for an address used for public crowd funding or a charity – for the sake of transparency, you could publish the public view key for everyone to keep track of the balance.
Note – it is not possible for anyone to see WHERE these incoming transactions have come from. It will only tell you when a transaction has arrived and how much was in it.
Public Spend Key
The public spend key forms part of your main public address. You don’t need to save this key as it’ll be automatically generated with your Seed Phrase or Private Key.
On its own it’s pretty useless.
Public View Key
Much like the public spend key, it’s used to form part of your main public address. Again, it’s not important to keep this key saved as it will be regenerated by your seed phrase or private view key.
This is the address you give out to receive Safex Cash or Safex Tokens from someone. The address itself is a combination of your public spend key, public view key, and a few other “bytes” of information which then go through a complex hashing process.
It’s important to stress that it is not possible to view your Safex Cash or Safex Token balance with a public address – this is where the Safex blockchain differs to public ones like Bitcoin.
Even if you publicly announced your Safex Cash address, nobody would be able to work out what is in it without the corresponding private view key.
For anyone interested in the technical method of how the address is generated, here is a relatively “simple” explanation.
- Combine one network byte with the 32-byte public spend key + 32-byte public view key
- Hash the combined string with Keccak-256
- Take the first 4 bytes of the hash from stage 2 and add to the end of the string from stage 1, creating a 69-byte Public Address
- Take this 69-byte public address and convert to Base58 – not all at once but in 8-byte blocks (there are some further stages too but not important for this)
- The resulting string is your full public address
When someone is sending you a transaction, their wallet will read your public address and gather the appropriate public spend key and public view key and use them to construct a special “one-time container” which will hold the funds intended for you.
On the receiving end, your wallet will check against each transaction your private spend key and private view key. When there is a match, the wallet takes note of this and adds it to your overall balance and saves the details in your wallet cache.