Skip to content

QR Codes content format

songchenwen edited this page Sep 4, 2014 · 1 revision

Since some kinds of contents in the field of bitcoin can be long, Bither support QR Code pagination. And in order to use less pages of QR Codes, Bither does the following optimizations. These optimizations' main goal is to contain all the content that Bither needs with only digits, uppercased letters and a few punctuations.

#General Encoding Method

  • All byte arrays are converted to uppercased hex strings. (source code)
  • Uppercased letters in addresses are transformed to * followed by the letter. e.g. A -> *A . And then all the letters are transform to uppercased. In this way, our donation address: 1BsTwoMaX3aYx9Nc8GdgHZzzAGmG669bC3 is transformed to 1*BS*TWO*MA*X3A*YX9*NC8*GDG*H*ZZZ*A*GM*G669B*C3. (source code)
  • Amounts of bitcoins are represented by hex strings for the count of satoshis.
  • We use a colon (:) to seperate parts of the contents.

#Pagination Method

When we need multiple pages of QR Codes. We add (Total page count minus 1):(current page index starts from 0): in front of every page. e.g. QR Code Page 1 in 3 pages will be prefixed with 2:0:.

source code

#Watch Only QR Code Format

Public key byte arrays of all the addresses in cold wallet seperated by colons maybe with a pagination prefix.

source code

#Encrypted Private Key QR Code Format

Following parts seperated by colons.

  • The encrypted private key byte array
  • The private key initialisation vector byte array
  • The scrypt crypter salt byte array

source code

#Decrypted Private Key QR Code Format

Private key in the form used by the Bitcoin dumpprivkey command.

source code

#Clone QR Code Format

Encrypted private key QR Codes of all the addresses in cold wallet seperated by colons maybe with a pagination prefix.

source code

#Unsigned Transaction QR Code Format

Following parts seperated by colons.

  • The address used to send bitcoin from
  • The transaction fee
  • The address to receive bitcoin
  • The amount of bitcoin being sent (not including transaction fee)
  • Sha256 hash byte arrays of all the transaction inputs seperated by colons

When all the above makes the content too long, pagination is added in front of every page of QR Codes.

source code

#Signed Transaction QR Code Format

Cold wallet signed transacion QR Codes are made with the following steps.

  • Get all the input Sha256 hashes from the unsigned transaction QR Code
  • Decrypt the private key using user provided password
  • Sign the input hashes using the decrypted private key to make ECDSA signatures
  • Build transaction input scripts from the ECDSA signatures and the public key
  • Convert all the input script programs to hex strings and join them with colon as separator
  • Pagination may be needed

source code

Clone this wiki locally