What Is an Swipechain Address?
Cryptography and Distributed Ledgers
How to determine the origin and legitimacy of a transaction is a fundamental problem of having a trustless, distributed monetary system without supervision. Blockchains use asymmetric cryptography to solve this problem. Even if you have never used cryptocurrencies, or programmed a single line of code in your life, you will have used asymmetric cryptography. It is the technology behind the HTTPS protocol, used in banking, downloading software, sending and receiving WhatsApp messages and much more.
In blockchain, a private key
is generated using a common secret, a passphrase
. This private key can then be used to create a public key
, together called a key pair
. Using the private key
, you can encrypt a piece of data, such that only the public key
can decrypt it. The other waPy around is possible as well; you can encrypt data using the public key
such that only the private key
can decrypt it.
Using this principle, you can create signatures. Since we know only the private key
can encrypt data so that the public key
can decrypt it, if I were to send you the text "hello", but encrypted, you could use my public key
to decrypt the data back to the text "hello", and thus proving the message originated from me. In the same manner, a blockchain network will validate transactions, using the public key
to authenticate the origin of the signed transaction.
TIP
You should now realize why it is so important to keep your private key
and passphrase
hidden, with them anyone can create valid transactions.
An address on the blockchain is derived from a public key
. We could use the public keys
directly, but they are quite long and thus take up more storage, and using addresses improves privacy, as someone does not need to expose their public key to receive currencies. Transmitting currencies always requires sharing your public key
with the network. Cold wallets are just normal wallets, but ones that haven't yet exposed their public key
.
It is possible to compute the private key from the public key, doing so would merely take a very long time, think one-hundred-trillion-times-the-lifespan-of- earth long. Because of this, public keys can be freely shared, allowing anyone to encrypt content and verify digital signatures, while private keys can be kept secret, ensuring only the owners of the private keys can decrypt the content and create digital signatures [1].
Swipechain uses the SECP256k1 curve from the elliptic curve digital signature algorithm (ECDSA). ECDSA generates the private key and the public key pair from a 32-bytes-size seed. As the seeds are not very human readable, we have the option to generate the seed from something more convenient: a passphrase
.
The passphrase generated by the Swipechain Desktop wallet is a 12-word sentence, according to BIP39. The usage of the protocol is not mandatory as a seed can be generated from any kind text, but is recommended. A passphrase needs enough complexity and has to be random enough to be considered secure.
From a passphrase to private and public keys
Swipechain Address
Here we generated a full wallet using simple secret
as our passphrase
. As long as we have access to simple secret
, we can always regenerate the seed, private and public key, and address.
Passphrase | simple secret |
---|---|
seed | b6af972cfcff450addadfecccc1d222de0f28c92c349a6bcbba4d4267dd3199c |
private key | 9b449f2ac4525b0116c7a78ce52387aab2ad6d928749cd26e60f2588efc5c01d |
public key | 036f9f2b56926a8c28c3bcef02811b6b3338c4d67b06eb7a9e90bda0fb3eacedee |
address | AJZkkwhCjDG5AS9gZcNfKzTa3s1qwvD44r |
An Swipechain address is like a bank account where only the owner of the private key can validate and broadcast transactions.
From a public key to an Swipechain address
A modifier is a byte used to customize the address. It is useful to differentiate networks:
- On Swipechain mainnet modifier =
0x17
so Swipechain address starts withA
. - On Swipechain devnet modifier =
0x1e
so DSXP address starts withD
. - On KAPU mainnet modifier =
0x2d
so KAPU address starts withK
.
Here is a table giving the address start character according to hexadecimal modifier value.
hex | start char | hex | start char | hex | start char | hex | start char |
---|---|---|---|---|---|---|---|
0x00 | 1 | 0x10 | 7 | 0x20 | D or E | 0x30 | L |
0x01 | Q or o | 0x11 | 7 or 8 | 0x21 | E | 0x31 | L or M |
0x02 | o or 2 | 0x12 | 8 | 0x22 | E or F | 0x32 | M |
0x03 | 2 | 0x13 | 8 or 9 | 0x23 | F | 0x33 | M |
0x04 | 2 or 3 | 0x14 | 9 | 0x24 | F | 0x34 | M or N |
0x05 | 3 | 0x15 | 9 | 0x25 | F or G | 0x35 | N |
0x06 | 3 | 0x16 | 9 or A | 0x26 | G | 0x36 | N or P |
0x07 | 3 or 4 | 0x17 | A | 0x27 | G or H | 0x37 | P |
0x08 | 4 | 0x18 | A or B | 0x28 | H | 0x38 | P |
0x09 | 4 or 5 | 0x19 | B | 0x29 | H | 0x39 | P or Q |
0x0a | 5 | 0x1a | B | 0x2a | H or J | 0x3a | Q |
0x0b | 5 | 0x1b | B or C | 0x2b | J | 0x3b | Q or R |
0x0c | 5 or 6 | 0x1c | C | 0x2c | J or K | 0x3c | R |
0x0d | 6 | 0x1d | C or D | 0x2d | K | 0x3d | R |
0x0e | 6 or 7 | 0x1e | D | 0x2e | K | 0x3e | R or S |
0x0f | 7 | 0x1f | D | 0x2f | K or L | 0x3f | S |
hex | start char | hex | start char | hex | start char | hex | start char |
---|---|---|---|---|---|---|---|
0x40 | S or T | 0x50 | Z | 0x60 | f or g | 0x70 | n |
0x41 | T | 0x51 | Z | 0x61 | g | 0x71 | n |
0x42 | T | 0x52 | Z or a | 0x62 | g | 0x72 | n or o |
0x43 | T or U | 0x53 | a | 0x63 | g or h | 0x73 | o |
0x44 | U | 0x54 | a or b | 0x64 | h | 0x74 | o or p |
0x45 | U or V | 0x55 | b | 0x65 | h or i | 0x75 | p |
0x46 | V | 0x56 | b or c | 0x66 | i | 0x76 | p |
0x47 | V | 0x57 | c | 0x67 | i | 0x77 | p or q |
0x48 | V or W | 0x58 | c | 0x68 | i or j | 0x78 | q |
0x49 | W | 0x59 | c or d | 0x69 | j | 0x79 | q or r |
0x4a | W or X | 0x5a | d | 0x6a | j or k | 0x7a | r |
0x4b | X | 0x5b | d or e | 0x6b | k | 0x7b | r |
0x4c | X | 0x5c | e | 0x6c | k | 0x7c | r or s |
0x4d | X or Y | 0x5d | e | 0x6d | k or m | 0x7d | s |
0x4e | Y | 0x5e | e or f | 0x6e | m | 0x7e | s or t |
0x4f | Y or Z | 0x5f | f | 0x6f | m or n | 0x7f | t |
hex | start char | hex | start char |
---|---|---|---|
0x80 | t | 0x90 | z or 2 |
0x81 | t or u | ≥ 0x91 | 2 |
0x82 | u | ||
0x83 | u or v | ||
0x84 | v | ||
0x85 | v | ||
0x86 | v or w | ||
0x87 | w | ||
0x88 | w or x | ||
0x89 | x | ||
0x8a | x | ||
0x8b | x or y | ||
0x8c | y | ||
0x8d | y or z | ||
0x8e | z | ||
0x8f | z |
Ledger Nano S
The best way to secure Swipechain address is to use a device that can sign transactions securely. The Swipechain team developed an application running on Ledger Nano S hardware wallet. Even if your computer has been infected with malware, you can still use it with your hardware wallet securely.
The Ledger Nano S device does not store passphrases. It is a device that generates public and private keys from a master seed. Keys are issued from the seed using the derivation path. For Swipechain blockchain (and cloned ones) the derivation path is structured like this:
44'\111'\<account index>'\0\<address number>
So the derivation path of the first address from the first account is:
44'\111'\0'\0\0
BIP39 Account Possibilities
Choosing 12 words randomly from the 2048 words available in BIP39 list:
yields 5.271.537.971.301.488.476.000.309.317.528.200.000.000 combinations, that is an enormous amount!