Block014 - Today I Learned How PayNyms & BIP47 Work
Today I Learned #3
Welcome to Block014 of The Bitcoin Journey, the third installment of the Today I Learned series. In this episode, CJ explains to Tim what BIP47 Payment Codes and PayNyms are.
They cover: - When and why to use PayNyms - How BIP47 / PayNyms work - Some caveats with using them
Now, this one doesn't go to plan...
If you (understandably) struggle to follow the maths in this one, lets go though it now. (I also tweeted about it here)
To send payments to a PayNym, you and the receiver need to be able to independantly create a wallet which only the receiver can send from, but the sender can send to. This is done by sharing a masked secret in a notification transaction. This is done using Diffie-Hellmen key esxchange, which allows a secret to be shared bewteen two parties despite most of the information being public.
Step 1: Choose starting numbers and secret numbers CJ priv key = 6 (secret) Tim priv key = 5 (secret)
Modulo num = 17 (public) Base num = 5 (public)
Step 2: Add our private numbers using the following formula (Base^priv) mod (mod num)
CJ 5^6 mod 17 = 2
Tim 5^5 mod 17 = 14
(Note: mod just means remainder)
Step 3: Share the result with each other.
Step 4: Do the saem again, but use the shared number as the base
CJ 14^6 mod 17 = 15
Tim 2^5 mod 17 = 15
15 is our shared secret number. We both independentantly arrived at the same number, which no one else can derive.