I have transferred money to an ethereum address that belongs to the smart contracts.

const priv = "0x" + crypto.randomBytes(32).toString("hex");
const pub = "0x" + util.generateAddress(util.toBuffer(priv), util.toBuffer(parseInt(req.params.nonce))).toString("hex");

This is how I generated the private key and public address. I have a track of the nonce but when I try to import this private key in trust wallet, I cannot see any funds there.

Crazy thing is that I found out now that the generateAddress expects the first parameter to be a smart contract address, whereas I provided a private key and it still accepted it. An error here would have saved me from losing 2000$.

Is there any way to recover this?

Thank you very much.

  • What's util? If you don't have the private keys for that address you will not be able to access its funds.
    – Ismael
    Feb 24 '21 at 14:36
  • What happens if you generate a tx using that private key? If you have not done this before BE VERY CAREFUL with how you do it, you can lose all of your funds if you use it wrong. Feb 24 '21 at 17:13
  • Provide the TXID of the transaction please. Dec 12 '21 at 19:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.