Guest User

Stealth Tx Keys 0.6.7

a guest
Jun 19th, 2015
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*Stealth Short Payment IDs - proposal for shortening displayed payment IDs (to 32 bit), keeping full 32 byte "actual" payment IDs, AND incorporating a stealth feature to improve anonymity*/
  2.  
  3. //---------------------------------------------------------
  4. //proposal 1.4.1
  5. receiverKeys = create_address(rand_32()); //for testing
  6. var payId = "0123456789ab"; /*48 bit, ~281 trillion transactions available per account (started with 32 bit, but trying not to fall into the "this ought to be enough for anybody" line of thinking; I would not necessarily be opposed to going up to 64 bit, but you gotta draw the line somewhere). A new integrated address would be just 104 characters long vs 139 for present version.*/
  7. var payIdHash = cn_fast_hash(payId);
  8. var txkey = random_keypair(); //same keypair used for tx
  9. var der = generate_key_derivation(receiverKeys.view.pub, txkey.sec);
  10. var payIdKey = cn_fast_hash(der); //I'm nearly certain this operation is not a security hole, but leaving 1.4 in for now
  11. var realPayId = hexXor(payIdKey, payIdHash); //JS can only xor numbers, made up function to xor hex strings
  12.  
  13. //receiver would:
  14. der = generate_key_derivation(txkey.pub, receiverKeys.view.sec); //txkey.pub from tx_extra
  15. payIdKey = cn_fast_hash(der);
  16. payIdHash = hexXor(payIdKey, realPayId); //realPayId from tx_extra
  17. //*compare payIdHash with known set*
  18. //---------------------------------------------------------
  19.  
  20. //---------------------------------------------------------
  21. //proposal 1.4 (older ideas discarded as non-scalable)
  22. receiverKeys = create_address(rand_32()); //for testing
  23. var payId = "0123456789ab";
  24. var payIdHash = cn_fast_hash(payId);
  25. var txkey = random_keypair(); //same keypair used for tx
  26. var der = generate_key_derivation(receiverKeys.view.pub, txkey.sec);
  27. var payIdOutput = derive_public_key(der, 0xFFFFFF, receiverKeys.spend.pub);
  28. var realPayId = hexXor(payIdOutput, payIdHash);
  29.  
  30. //receiver would:
  31. der = generate_key_derivation(txkey.pub, receiverKeys.view.sec); //txkey.pub from tx_extra
  32. payIdOutput = derive_public_key(der, 0xFFFFFF, receiverKeys.spend.pub);
  33. payIdHash = hexXor(payIdOutput, realPayId); //realPayId from tx_extra
  34. //*compare payIdHash with known set*
  35.  
  36. /*Note on output index in derive_public_key operations: 0xFFFFFF is ~16.7 million, so a tx could have that many outputs before having overlap. Overlap would decode the payment ID to its hash, effectively revealing it for that tx. Another possibility would be to use an output index 1 higher than the last real output, but the idea of having a constant instead appeals to me at the moment. 0xFFFFFF is also 1 less than the square root of the number of possible short payment IDs. :P (none of this is necessary anymore with proposal 1.4.1)*/
  37. //---------------------------------------------------------
  38.  
  39. /*If a multiple destination tx was created, only the destination for which the payment ID was intended would be able to decode it due to the way derivations are generated.*/
Advertisement
Add Comment
Please, Sign In to add comment