Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
bokkypoobah committed Dec 25, 2023
1 parent bba7258 commit 12ab849
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -854,17 +854,26 @@ <h5>Transfer ETH From EOA To Stealth Meta-Address</h5>
console.log(moment().format("HH:mm:ss") + " transferEthToStealthMetaAddress BEGIN");
console.log(moment().format("HH:mm:ss") + " transferEthToStealthMetaAddress - this.settings.transfer.recipientStealthMetaAddress: " + this.settings.transfer.recipientStealthMetaAddress);

const R_pubkey_spend = nobleCurves.secp256k1.ProjectivePoint.fromHex(this.settings.transfer.recipientStealthMetaAddress.slice(9, 75));
// const R_pubkey_spend = nobleCurves.secp256k1.ProjectivePoint.fromHex(this.settings.transfer.recipientStealthMetaAddress.slice(9, 75));
const R_pubkey_spend = this.settings.transfer.recipientStealthMetaAddress.slice(9, 75);
console.log("R_pubkey_spend: " + R_pubkey_spend.toString());
const R_pubkey_view = nobleCurves.secp256k1.ProjectivePoint.fromHex(this.settings.transfer.recipientStealthMetaAddress.slice(75));
// const R_pubkey_view = nobleCurves.secp256k1.ProjectivePoint.fromHex(this.settings.transfer.recipientStealthMetaAddress.slice(75));
const R_pubkey_view = this.settings.transfer.recipientStealthMetaAddress.slice(75);
console.log("R_pubkey_view: " + R_pubkey_view.toString());

const ephemeralPrivateKey = nobleCurves.secp256k1.utils.randomPrivateKey();
// const ephemeralPrivateKey = nobleCurves.secp256k1.utils.randomPrivateKey();
const ephemeralPrivateKey = 26997109008263982877621605952415166666118239613620770339187915977330619367704n;
console.log("ephemeralPrivateKey: " + ephemeralPrivateKey.toString());

const ephemeralPublicKey = nobleCurves.secp256k1.getPublicKey(ephemeralPrivateKey, isCompressed=true);
console.log("ephemeralPublicKey: " + ephemeralPublicKey.toString());

const sharedSecret = nobleCurves.secp256k1.getSharedSecret(ephemeralPrivateKey, R_pubkey_view, false);
console.log('sharedSecret:', sharedSecret.toString());
console.log('sharedSecret.length:', sharedSecret.length);
const hashedSharedSecret = ethers.utils.keccak256(sharedSecret.slice(1));
console.log('hashedSharedSecret:', hashedSharedSecret.toString());

// const p = getPublicKey();
// console.log("etc: " + JSON.stringify(etc));
// console.log("nobleCurves: " + JSON.stringify(nobleCurves.utils));
Expand Down

0 comments on commit 12ab849

Please sign in to comment.