Skip to content

Transacation  #50

@oaww

Description

@oaww

in public test net when TransactionBuilder finalize in Signature.js,when nonce = 1,it will occur Error
nonce = 0;
e = _bigi2.default.fromBuffer(buf_sha256);
while (true) {
ecsignature = (0, _ecdsa.sign)(secp256k1, buf_sha256, private_key.d, nonce++); //here
der = ecsignature.toDER();
lenR = der[3];
lenS = der[5 + lenR];
if (lenR === 32 && lenS === 32) {
i = (0, _ecdsa.calcPubKeyRecoveryParam)(secp256k1, e, ecsignature, private_key.toPublicKey().Q);
i += 4; // compressed
i += 27; // compact // 24 or 27 :( forcing odd-y 2nd key candidate)
break;
}
if (nonce % 10 === 0 && process.env.ENVIRONMENT === 'DEV') {
console.log("WARN: " + nonce + " attempts to find canonical signature");
}
}

in ecdsa.js will always occur error

function deterministicGenerateK(curve, hash, d, checkSig, nonce) {

(0, _enforce_types2.default)('Buffer', hash);
(0, _enforce_types2.default)(_bigi2.default, d);

if (nonce) {
    hash = (0, _hash.sha256)(Buffer.concat([hash, Buffer.from(nonce)])); **//here**
}

// sanity check
_assert2.default.equal(hash.length, 32, 'Hash must be 256 bit');

var x = d.toBuffer(32);
var k = Buffer.alloc(32);
var v = Buffer.alloc(32);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions