How to use the tiny-secp256k1.pointAddScalar function in tiny-secp256k1

To help you get started, we’ve selected a few tiny-secp256k1 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bitcoinjs / bitcoinjs-lib / test / integration / stealth.js View on Github external
function stealthDualSend (e, R, Q) {
  const eQ = ecc.pointMultiply(Q, e) // shared secret
  const c = bitcoin.crypto.sha256(eQ)
  const Rc = ecc.pointAddScalar(R, c)
  const vG = bitcoin.ECPair.fromPublicKey(Rc)

  return vG
}
github bitcoinjs / bitcoinjs-lib / test / integration / stealth.js View on Github external
function stealthSend (e, Q) {
  const eQ = ecc.pointMultiply(Q, e, true) // shared secret
  const c = bitcoin.crypto.sha256(eQ)
  const Qc = ecc.pointAddScalar(Q, c)
  const vG = bitcoin.ECPair.fromPublicKey(Qc)

  return vG
}
github bitcoinjs / bitcoinjs-lib / test / integration / stealth.js View on Github external
function stealthDualScan (d, R, eG) {
  const eQ = ecc.pointMultiply(eG, d) // shared secret
  const c = bitcoin.crypto.sha256(eQ)
  const Rc = ecc.pointAddScalar(R, c)
  const vG = bitcoin.ECPair.fromPublicKey(Rc)

  return vG
}
github bitcoinjs / bip32 / src / bip32.js View on Github external
return this.derive(index + 1);
        // Private parent key -> private child key
        let hd;
        if (!this.isNeutered()) {
            // ki = parse256(IL) + kpar (mod n)
            const ki = ecc.privateAdd(this.privateKey, IL);
            // In case ki == 0, proceed with the next value for i
            if (ki == null)
                return this.derive(index + 1);
            hd = fromPrivateKeyLocal(ki, IR, this.network, this.depth + 1, index, this.fingerprint.readUInt32BE(0));
            // Public parent key -> public child key
        }
        else {
            // Ki = point(parse256(IL)) + Kpar
            //    = G*IL + Kpar
            const Ki = ecc.pointAddScalar(this.publicKey, IL, true);
            // In case Ki is the point at infinity, proceed with the next value for i
            if (Ki === null)
                return this.derive(index + 1);
            hd = fromPublicKeyLocal(Ki, IR, this.network, this.depth + 1, index, this.fingerprint.readUInt32BE(0));
        }
        return hd;
    }
    deriveHardened(index) {
github bitcoinjs / bip32 / ts-src / bip32.ts View on Github external
if (ki == null) return this.derive(index + 1);

      hd = fromPrivateKeyLocal(
        ki,
        IR,
        this.network,
        this.depth + 1,
        index,
        this.fingerprint.readUInt32BE(0),
      );

      // Public parent key -> public child key
    } else {
      // Ki = point(parse256(IL)) + Kpar
      //    = G*IL + Kpar
      const Ki = ecc.pointAddScalar(this.publicKey, IL, true);

      // In case Ki is the point at infinity, proceed with the next value for i
      if (Ki === null) return this.derive(index + 1);

      hd = fromPublicKeyLocal(
        Ki,
        IR,
        this.network,
        this.depth + 1,
        index,
        this.fingerprint.readUInt32BE(0),
      );
    }

    return hd;
  }