Closed gasparyanyur closed 5 years ago
@gasparyanyur It looks like you are using the extended private key instead of the private key. You can learn a little more about the difference here: https://bitcoin.stackexchange.com/questions/50028/difference-between-master-public-private-key-and-public-private-key
The ethereumjs-tx
sign method ultimately calls the secp256k1
sign method (https://github.com/cryptocoinjs/secp256k1-node/), which requires the private key to be 32 bytes in length.
@danjm Thanks for figuring this out. 👍 Will close this now.
I have a online shop where users can recieve
ETH
and do shopping. So to have a secure wallet, I have created an offline service which generatesxpub
andxpriv
which I use to generate addresses in my online service.I am using
xpub
in my online service to genreate addresses for users and usingxpriv
in my second offline service to send transactions.Here is a code which generates
xpub
Than using
xpub
in my online service I am generating addresses for usersSo all is ok, but I in my offline service I also have a service which should send all coins to my own account from generated addresses.
Here is my second service
But in this case I am getting an error look like this
I am using
xpriv
as a private key . Is this ok ? or where my mistake ? What I need to add/change to send transactions?Any suggestions would be much appreciate.