Closed ChandraNakka closed 6 years ago
@ChandraNakka can you paste example how I can generate signature with MEW? How you identified that signature generated by this lib is wrong and MEW is right and working?
const secp256k1 = require('secp256k1')
const privateKey = Buffer.from('74d1b4f06f610da2761953996c8f1a6df2540342bbef575bd91fb03004557cc5', 'hex')
const publicKey = secp256k1.publicKeyCreate(privateKey, false).slice(1)
// ethjs tx
const tx1 = new EthTx('f864028506fc23ac008252089458f9ce2c1af3b540580561259955d66d5853e77a808029a07453af3e32aa4a67575c9d321ed86c082b158d36e5ec7fca7b90ac8845b5948ca00acc0393bf8881127624d366afdcf33e3f276d98b13ea581a2362a63e5c8ddf5')
console.log(tx1.getSenderPublicKey().equals(publicKey))
// mew
const tx2 = new EthTx('f864028506fc23ac008252089458f9ce2c1af3b540580561259955d66d5853e77a80802aa0fcca5dc42e49f26bb5545291b33eacb932d8f2ee40a1a97be02f6916c7ae4f3aa0318507b28e5e94380a7af2efd057ab11d2dc8c863f7c9ad66477e19b259e066c')
console.log(tx2.getSenderPublicKey().equals(publicKey))
Result:
true false
@ChandraNakka issue related with https://github.com/ethjs/ethjs-util/issues/8
When ethjs-util
will be fixed, signatures will be right (I already tested with old libs and all fine).
I tested code with ethjs-util@0.1.6 (contain bad code).
Probably https://github.com/ethereumjs/ethereumjs-tx/issues/101 should help avoid such situations.
I'm using this below example code to prepare transaction signature
Above code is generating this below signature (wrong signature)
But, MyEtherWallet generates this signature (working signature)
This is my configuration: