3

After forking mainnet with Ganache-cli and impersonating account I don't own, I find a problem in web3.py.

I don't have the private key to sign the transaction.

tx_signed = w3.eth.account.signTransaction(tx_build, private_key)

However, when it comes to Etherjs and Hardhat, I don't have the issue. I have the impersonated public address and it's enough to get the transaction done, under the forking environment.

I can develop in JS and Python, but Python is preferred as it's of high efficiency.

Appreciate any help!

1 Answer 1

2

You do not need to have the private key to sign a spoofed transaction.

You can use eth_sendTransaction API to send an unsigned transaction Ganache over HTTP. Ganache node does not check the signature of these transactions.

You can find some examples and details here, though those might not directly to answer your question.

3
  • 1
    Thank you so much!!! you are a fu*king legend!!! w3.eth.sendTransaction(tx_build) , add from: impersonated address to the tx_build, done! Commented Nov 28, 2022 at 10:06
  • Is it possible to send unsigned raw transaction?
    – Novikov
    Commented Jan 28 at 16:41
  • No. You need to sign it with using Localccount. Commented Jan 28 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.