Is there any sample code in ethers.js to send raw transaction and to sign transactions?



Link: https://docs.ethers.io/ethers.js/html/cookbook-signing.html

or: https://docs.ethers.io/ethers.js/html/api-wallet.html#signing

Sending Raw Transaction Data

I don't know this for a fact, but my understanding is that provider.sendTransaction() sends the raw data over. It takes a hex string, and is mentioned under the second signing link above in the snippets.

| improve this answer | |
  • Thanks How can I set the private key for provider.sendTransaction()? I see here there is not any account info, just provider, but provider do not contain private key, which account associate with provider? Can I change the private key? – Louis Mar 27 at 13:42

Your Answer

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

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