SHOW:
|
|
- or go back to the newest paste.
| 1 | - | //idea 1.a |
| 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 | - | var payID = {};
|
| 4 | + | //idea 1a |
| 5 | - | payID.ID = "0e0eedd4"; //for example, 32 bit |
| 5 | + | |
| 6 | - | payID.sec = sc_reduce32(cn_fast_hash(payID.ID)); //not used |
| 6 | + | |
| 7 | - | payID.pub = sec_key_to_pub(payID.sec); |
| 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 | - | ver realPayID = derive_public_key(der, -1, payID.pub); //this actually works, though I've no idea of any concerns |
| 10 | + | payId.pub = sec_key_to_pub(payId.sec); |
| 11 | - | //could use index > last output instead of -1 |
| 11 | + | |
| 12 | - | //an integrated address like this would be 101 base58 characters instead of 139 now |
| 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 | - | //idea 1.b (costs less) |
| 14 | + | |
| 15 | //idea 1b | |
| 16 | var rkeys = {};
| |
| 17 | - | var payID = {};
|
| 17 | + | |
| 18 | - | payID.ID = "0e0eedd4"; //for example, 32 bit |
| 18 | + | var payId = {};
|
| 19 | - | 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" |
| 19 | + | payId.id = "0e0eedd4"; |
| 20 | - | scalar for our realPayID. It appears to work without after numerous tests (in JS at least), but then again sc_reduce32 costs |
| 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 | - | ver realPayID = derive_secret_key(der, -1, payID.sec); //this actually works, though I've no idea of any concerns |
| 24 | + | |
| 25 | - | //could use index > last output instead of -1 |
| 25 | + | var realPayId = derive_secret_key(der, -1, payId.sec); |
| 26 | - | //an integrated address like this would be 101 base58 characters instead of 139 now |
| 26 | + | |
| 27 | ||
| 28 | - | //idea 2 |
| 28 | + | //idea 1c |
| 29 | - | /*I've decided idea 2 is not good (just using a different derivation as the paymentID), because while it's simpler and costs less, 32 bits does not create a good secret for the derivation.*/ |
| 29 | + | |
| 30 | - | //actually idea 2 is really bad, it could be used to unmask txns heading to known addresses |
| 30 | + | |
| 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 |