You are on page 1of 18

Address

Ashok Kumar Turuk

1
Address
 Cookie token addresses are
exactly the same as Bitcoin
addresses. They’re used mainly
by wallet software

2
Cookie-eating habits disclosed
 One can spy on another eating
habit
 Every coworker can easily look
up other coworkers’ balances, as
well as their cookie-eating
habits.

3
Replacing names with public keys
• Replace all names in the
spreadsheet with their
respective public keys
• Hard to see how many cookies
someone has eaten without
knowing her public key.
• Users should no longer use
names when making payments.
• They must instead use the
sender’s public key and the
recipient’s public key

4
Replacing names with public keys
 The email to Lisa contains
a few vital parts:
 A message containing the
 Amount
 Sender public key
 Recipient public key
 A signature made with the
sender’s private key
 The essential difference is
that the payment is now
pseudonymous:
 names are replaced with
the corresponding public
keys.

5
New payment process
• How to initiate a payment
for a new employee

6
Shortening the public key
 Hashing the public key to 20
bytes
 Public key is first hashed with
SHA256
 Output of this cryptographic hash
function is then hashed with
RIPEMD160, a cryptographic hash
function that outputs a 160-bit
(20-byte) number called public
key hash (PKH).
 All public keys in the spreadsheet
are replaced with their respective
PKHs.

7
Shortening the public key
 John wants to buy a cookie
 PKH of recipient and public key
of sender in the message (public
key is needed to verify the
signature)
 Calculate the PKH from the
sender’s public key to check the
sender’s balance and be able to
enter the payment into the
spreadsheet
 Most payments in Bitcoin are
made with a PKH as the
recipient.
 This type is often called pay-to-
public-key-hash (p2pkh)

8
Avoiding expensive typing errors
• John makes a typing error in
the recipient PKH.
• The last character is d when it
should have been c.
• What happens now?
• There is no “wrong” recipient
PKH. Lisa adds any recipient
as long as the signature is
valid.

9
Avoiding expensive typing errors
 A Bitcoin address is a converted PKH
 PKH written in a way more suitable for
human users and safe against spelling errors.
 The PKH is sent to Lisa (or Bitcoin
nodes), but the address is what users
see and give to each other
 A cookie token address is a PKH encoded
to detect typing errors.
 The PKH can be converted back and forth
between this encoding and plain byte
format.

10
Avoiding expensive typing errors
 Faiza will base58check decode John’s
address into a PKH.
 This decoding ensures that no typing errors
were made in the address.
 PKH can be converted to an address and
back to a PKH.
 It is not a one-way function.
 It’s just different ways to represent the PKH,
either as a series of bytes or as an address

11
Base58check encoding
 First, a version is added before the
PKH.
 Only one version of cookie token
addresses is available.
 This version is a single 0 byte.
 A checksum is appended to the
versioned PKH.
 To create a checksum, base58check hashes
the versioned PKH with double SHA256.
 First 4 bytes of the second hash, and let
those 4 bytes be the checksum. This
checksum is then appended to the
versioned PKH.

12
Base58check encoding
 Base64 uses the following alphabet:
ABCDEFGHIJKLMNOPQRSTUV
WXYZabcdefghijklmnopqrstuv
wxyz0123456789+/
• New way to encode data is called
base58
123456789ABCDEFGHJKL
MNPQRSTUVWXYZabcdef
ghijkmnopqrstuvwxyz

13
Base58check encoding
 Encode the 25 bytes into
cookie token address

14
Base58check decoding
 PKH can be retrieved from
the cookie token address
while simultaneously
checking for typing errors

15
Privacy
 Identity can be revealed
 Users can create as many addresses they like.
 For example, the cafe could create a unique address for every incoming payment.
 John could create a brand-new cookie token address the next time he accepts cookie tokens
from Faiza.
 Using unique addresses for each payment will make it harder to extract
information from the cookie token spreadsheet, because it will be to tell which
payments belong to the same person.

16
Recap

17
Recap

18

You might also like