Guest User

Stealth Tx Keys 0.6

a guest
Jun 17th, 2015
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*Stealth Short Payment IDs - proposals 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. //ordered by cost (highest first)
  4. //idea 1a
  5. var rkeys = {};
  6. rkeys = create_address(rand_32()); //for testing obviously
  7. var payId = {};
  8. payId.id = "0e0eedd4"; //for example, 32 bit; an integrated address like this would be 101 base58 characters instead of 139 now
  9. payId.sec = sc_reduce32(cn_fast_hash(payId.id)); //not used
  10. payId.pub = sec_key_to_pub(payId.sec);
  11. var txkey = random_keypair(); //same keypair used for tx
  12. var der = generate_key_derivation(rkeys.view.pub, txkey.sec); //same derivation as the TX itself
  13. var realPayId = derive_public_key(der, -1, payId.pub);
  14.  
  15. //idea 1b
  16. var rkeys = {};
  17. rkeys = create_address(rand_32()); //for testing obviously
  18. var payId = {};
  19. payId.id = "0e0eedd4";
  20. payId.sec = sc_reduce32(cn_fast_hash(payId.id)); /*I do not know if sc_reduce32 needs to be used, as we don't need a "real"
  21. scalar for our realPayId. It appears to work without after numerous tests (in JS at least), but then again sc_reduce32 costs
  22. very little.*/
  23. var txkey = random_keypair(); //same keypair used for tx
  24. var der = generate_key_derivation(rkeys.view.pub, txkey.sec);
  25. var realPayId = derive_secret_key(der, -1, payId.sec);
  26.  
  27.  
  28. //idea 1c
  29. var rkeys = {};
  30. rkeys = create_address(rand_32()); //for testing obviously
  31. var shortPayId = "0e0eedd4";
  32. var txkey = random_keypair(); //same keypair used for tx
  33. var der = generate_key_derivation(rkeys.view.pub, txkey.sec);
  34. var payIdOutput = derive_public_key(der, -1, rkeys.spend.pub);
  35. var realPayId = cn_fast_hash(shortPayId + payIdOutput.slice(0,56)); //just to keep input length 32 bytes
  36.  
  37.  
  38. //idea 1d
  39. var rkeys = {};
  40. rkeys = create_address(rand_32()); //for testing obviously
  41. var payId = "0e0eedd4";
  42. var payIdHash = cn_fast_hash(payID.ID);
  43. var txkey = random_keypair(); //same keypair used for tx
  44. var der = generate_key_derivation(rkeys.view.pub, txkey.sec);
  45. var payIdOutput = derive_public_key(der, -1, rkeys.spend.pub);
  46. var realPayId = hexXor(payIdOutput, payIdHash); //JS can only xor numbers, made up function to xor hex strings
  47.  
  48. /*Note on output index in derive_public/secret_key operations: -1 actually works in JS, but it should be tested and reviewed before actually using it. For ideas 1a and 1b, an index of 0 can safely be used because the pub/sec keys being used are not the same as the rest of the outputs in the TX. For 1c and 1d, -1 or 1> than last real output index could be used.*/
  49.  
  50. //cost analysis
  51. /*1a: expensive, requires sec_key_to_pub (can be one time) and derive_public_key operations for *every* (or 50% on average to find the match) payment ID (that a firm is tracking) for *every* transaction that has outputs belonging to the firm; for a large firm with potentially millions of payment IDs it just costs too much
  52. 1b: here we get rid of the sec_key_to_pub and derive_public_key operations in favor of a single derive_secret_key operation; it costs less, but not significantly so since sec_key_to_pub can be stored in 1a
  53. 1c: here we replace the "many" operation (derive_public_key or derive_secret_key) with a hash of the short ID plus a portion of an output public key; estimate 2 orders of magnitude or more reduction in cost, making 1c (or a variant) probably feasible
  54. 1d: here we use the output public key as an encryption key of sorts, removing the "many" operation entirely; cost becomes  negligible, regardless of the size of known ID set, as it can just be decrypted and compared with known ID hashes*/
Advertisement
Add Comment
Please, Sign In to add comment