Using a `SignerWithAddress` to sign a transaction from `populateTransaction` fails with "Signing transactions is unsupported"
See original GitHub issueDescribe the bug
I am creating an unsigned transaction with contractMethod.populateTransaction.method()
then signing with signer.SignTransaction(unsignedTransaction)
The second step fails with
reason: 'signing transactions is unsupported',
code: 'UNSUPPORTED_OPERATION',
operation: 'signTransaction'
Reproduction steps
const MyContract = await ethers.getContractFactory('MyContract')
const signers = await ethers.getSigners()
const admin = signers[0]
const myContract = (await MyContract.attach(myContractAddress)) as MyContract
const unlockTransaction = await myContract.populateTransaction.testMethod(true, {nonce: firstNonce})
const unlockTransactionSigned = await admin.signTransaction(unlockTransaction)
Environment: Node v14 Goerli
Search Terms Ethers Sign raw transaction
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:13 (7 by maintainers)
Top Results From Across the Web
Signers - ethers
This method populates the transactionRequest with missing fields, using populateTransaction and returns a Promise which resolves to the transaction. Sub-classes ...
Read more >Signing a request with a signature gives the wrong from address
You don't sign a request with a signature, you sign a transaction. You cannot generate generic signatures to be associated to transactions ......
Read more >Cannot switch signers with ethers.js for a contract interaction ...
The error you get is because you are not passing in the full address object. Specifically, I get your exact error when I...
Read more >ethers-io/Lobby - Gitter
Hello. I need to write in contract with walletconnect provider, but it says that there's no method eth_sendTransaction. I need to sign it...
Read more >Signing transactions with web3 or ethers? How does it even ...
Again ether.js returns the following error: Error: signing transactions is unsupported (operation="signTransaction", code=UNSUPPORTED_OPERATION, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Correct. It exists because it sub-classes Signer, but if the client doesn’t support it, it will throw an error when it is attempted to be used.
That is a
JsonRpcSigner
instance, not aWallet
instance. So it depends on what Provider you are using, but most providers you need aWeb3Provider
for will not support signing a transaction as it is a security and UX concern. That’s nothing to do with ethers, that is the client deciding to not allowing signing transactions (for good reasons).