NomicFoundation / hardhat

Hardhat is a development environment to compile, deploy, test, and debug your Ethereum software.
https://hardhat.org
Other
7.29k stars 1.41k forks source link

Hardhat Support for eth_signTransaction #3059

Open jiaochangyang opened 2 years ago

jiaochangyang commented 2 years ago

Hardhat node does not currently have support for eth_signTransaction, which is defined in the Ethereum JSON-RPC specifications. It would be good to have this particular feature for dApp development purposes as it would allow for simpler unit-testing through unlocked accounts, while still handling raw transaction submission the same way.

github-actions[bot] commented 2 years ago

This issue is also being tracked on Linear.

We use Linear to manage our development process, but we keep the conversations on Github.

LINEAR-ID: 9a131121-a6a9-4b7f-a2d6-dee349232fdc

sisco0 commented 2 years ago

Should the required functionality not be similar to the current implementation of eth_sendTransactionAction in packages/hardhat-core/src/internal/hardhat-network/provider/modules/eth.ts? Just replacing the this._sendTransactionAndReturnHash(tx) source code line of sendTransaction at the end of the function by tx as shown in the screenshot below. image

jiaochangyang commented 2 years ago

I believe you are right that this functionality does what is requested. Would it be possible to expose this as a public functionality?

jiaochangyang commented 10 months ago

Any chance of this getting picked up?

fvictorio commented 10 months ago

I'm not (in principle) against implementing this; we've just had other priorities. Also, no one else seems to be asking for this to be implemented (it's not a very commonly used method AFAIK; you normally send the transaction and your library, wallet or node handles it).

Maybe having specific use cases that are not possible right now would help us prioritize this.

jeanregisser commented 7 months ago

Ah I was just bitten by this trying to use signTransaction from a client provided by hardhat-viem and was getting unknown account. A bit surprising when sendTransaction and signMessage were working fine.

My use case was signing an approval + swap manually, with precise control of the nonce. But I guess I can just use sendTransaction for now.