Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*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*/
- //idea 1d
- var rkeys = {};
- rkeys = create_address(rand_32()); //for testing obviously
- var payId = "0e0eedd4";
- var payIdHash = cn_fast_hash(payID.ID);
- var txkey = random_keypair(); //same keypair used for tx
- var der = generate_key_derivation(rkeys.view.pub, txkey.sec);
- var payIdOutput = derive_public_key(der, -1, rkeys.spend.pub);
- var realPayId = hexXor(payIdOutput, payIdHash); //JS can only xor numbers, made up function to xor hex strings
- /*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> last real output index could be used instead of -1.*/
- //old ideas
- //ordered by cost (highest first)
- //idea 1a
- var rkeys = {};
- rkeys = create_address(rand_32()); //for testing obviously
- var payId = {};
- payId.id = "0e0eedd4"; //for example, 32 bit; an integrated address like this would be 101 base58 characters instead of 139 now
- payId.sec = sc_reduce32(cn_fast_hash(payId.id)); //not used
- payId.pub = sec_key_to_pub(payId.sec);
- var txkey = random_keypair(); //same keypair used for tx
- var der = generate_key_derivation(rkeys.view.pub, txkey.sec); //same derivation as the TX itself
- var realPayId = derive_public_key(der, -1, payId.pub);
- //idea 1b
- var rkeys = {};
- rkeys = create_address(rand_32()); //for testing obviously
- var payId = {};
- payId.id = "0e0eedd4";
- 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"
- scalar for our realPayId. It appears to work without after numerous tests (in JS at least), but then again sc_reduce32 costs
- very little.*/
- var txkey = random_keypair(); //same keypair used for tx
- var der = generate_key_derivation(rkeys.view.pub, txkey.sec);
- var realPayId = derive_secret_key(der, -1, payId.sec);
- //idea 1c
- var rkeys = {};
- rkeys = create_address(rand_32()); //for testing obviously
- var shortPayId = "0e0eedd4";
- var txkey = random_keypair(); //same keypair used for tx
- var der = generate_key_derivation(rkeys.view.pub, txkey.sec);
- var payIdOutput = derive_public_key(der, -1, rkeys.spend.pub);
- var realPayId = cn_fast_hash(shortPayId + payIdOutput.slice(0,56)); //just to keep input length 32 bytes
- //cost analysis
- /*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
- 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
- 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
- 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