ethers.js: processing response error

This problem occurs when I try to send a transaction, but I don’t know why

 let tx={
        gasPrice:BigNumber.from('100000000000'),
        gasLimit: 60000,
        to:'0x98878a6c2e0f7eca7d858c2ad24d5d89f08dd047',
        nonce: 0,
        data: "0x",
        value:ethers.utils.parseEther('0.01'),
        chainId: 3
    };
    wallet.signTransaction(tx).then(res=>{
        console.log(res);
        provider.sendTransaction(res).then(result=>{
            console.log(result);
        }).catch(error=>{
            console.log(error)
        })
    })

The following problem occurred while I was executing

Error: processing response error (body={“0”:123,“1”:34,“2”:106,“3”:115,“4”:111,“5”:110,“6”:114,“7”:112,“8”:99,“9”:34,“10”:58,“11”:32,“12”:34,“13”:50,“14”:46,“15”:48,“16”:34,“17”:44,“18”:32,“19”:34,“20”:105,“21”:100,“22”:34,“23”:58,“24”:32,“25”:52,“26”:56,“27”:44,“28”:32,“29”:34,“30”:101,“31”:114,“32”:114,“33”:111,“34”:114,“35”:34,“36”:58,“37”:32,“38”:123,“39”:34,“40”:99,“41”:111,“42”:100,“43”:101,“44”:34,“45”:58,“46”:32,“47”:45,“48”:51,“49”:50,“50”:48,“51”:48,“52”:48,“53”:44,“54”:32,“55”:34,“56”:109,“57”:101,“58”:115,“59”:115,“60”:97,“61”:103,“62”:101,“63”:34,“64”:58,“65”:32,“66”:34,“67”:105,“68”:110,“69”:118,“70”:97,“71”:108,“72”:105,“73”:100,“74”:32,“75”:115,“76”:101,“77”:110,“78”:100,“79”:101,“80”:114,“81”:34,“82”:125,“83”:125}, error={“code”:-32000}, requestBody={“0”:123,“1”:34,“2”:109,“3”:101,“4”:116,“5”:104,“6”:111,“7”:100,“8”:34,“9”:58,“10”:34,“11”:101,“12”:116,“13”:104,“14”:95,“15”:115,“16”:101,“17”:110,“18”:100,“19”:82,“20”:97,“21”:119,“22”:84,“23”:114,“24”:97,“25”:110,“26”:115,“27”:97,“28”:99,“29”:116,“30”:105,“31”:111,“32”:110,“33”:34,“34”:44,“35”:34,“36”:112,“37”:97,“38”:114,“39”:97,“40”:109,“41”:115,“42”:34,“43”:58,“44”:91,“45”:34,“46”:48,“47”:120,“48”:102,“49”:56,“50”:54,“51”:98,“52”:56,“53”:48,“54”:56,“55”:53,“56”:49,“57”:55,“58”:52,“59”:56,“60”:55,“61”:54,“62”:101,“63”:56,“64”:48,“65”:48,“66”:56,“67”:50,“68”:101,“69”:97,“70”:54,“71”:48,“72”:57,“73”:52,“74”:57,“75”:56,“76”:56,“77”:55,“78”:56,“79”:97,“80”:54,“81”:99,“82”:50,“83”:101,“84”:48,“85”:102,“86”:55,“87”:101,“88”:99,“89”:97,“90”:55,“91”:100,“92”:56,“93”:53,“94”:56,“95”:99,“96”:50,“97”:97,“98”:100,“99”:50,“100”:52,“101”:100,“102”:53,“103”:100,“104”:56,“105”:57,“106”:102,“107”:48,“108”:56,“109”:100,“110”:100,“111”:48,“112”:52,“113”:55,“114”:56,“115”:55,“116”:49,“117”:49,“118”:99,“119”:51,“120”:55,“121”:57,“122”:51,“123”:55,“124”:101,“125”:48,“126”:56,“127”:48,“128”:48,“129”:48,“130”:56,“131”:48,“132”:50,“133”:57,“134”:97,“135”:48,“136”:50,“137”:55,“138”:98,“139”:51,“140”:57,“141”:53,“142”:99,“143”:99,“144”:100,“145”:102,“146”:102,“147”:102,“148”:50,“149”:53,“150”:57,“151”:50,“152”:99,“153”:57,“154”:102,“155”:100,“156”:55,“157”:48,“158”:49,“159”:100,“160”:48,“161”:55,“162”:53,“163”:100,“164”:48,“165”:51,“166”:51,“167”:51,“168”:55,“169”:57,“170”:53,“171”:51,“172”:102,“173”:102,“174”:54,“175”:98,“176”:102,“177”:50,“178”:51,“179”:97,“180”:57,“181”:101,“182”:100,“183”:97,“184”:99,“185”:51,“186”:49,“187”:53,“188”:97,“189”:49,“190”:56,“191”:56,“192”:100,“193”:48,“194”:98,“195”:48,“196”:51,“197”:50,“198”:48,“199”:57,“200”:97,“201”:48,“202”:53,“203”:102,“204”:56,“205”:51,“206”:101,“207”:55,“208”:54,“209”:98,“210”:55,“211”:102,“212”:55,“213”:50,“214”:56,“215”:48,“216”:49,“217”:48,“218”:55,“219”:56,“220”:51,“221”:56,“222”:57,“223”:53,“224”:53,“225”:97,“226”:55,“227”:98,“228”:97,“229”:55,“230”:101,“231”:54,“232”:54,“233”:54,“234”:54,“235”:53,“236”:52,“237”:55,“238”:100,“239”:56,“240”:49,“241”:102,“242”:101,“243”:52,“244”:49,“245”:52,“246”:101,“247”:51,“248”:51,“249”:57,“250”:100,“251”:101,“252”:97,“253”:54,“254”:54,“255”:50,“256”:50,“257”:52,“258”:54,“259”:50,“260”:50,“261”:57,“262”:51,“263”:53,“264”:100,“265”:100,“266”:34,“267”:93,“268”:44,“269”:34,“270”:105,“271”:100,“272”:34,“273”:58,“274”:52,“275”:56,“276”:44,“277”:34,“278”:106,“279”:115,“280”:111,“281”:110,“282”:114,“283”:112,“284”:99,“285”:34,“286”:58,“287”:34,“288”:50,“289”:46,“290”:48,“291”:34,“292”:125}, requestMethod=“POST”, url=“https://eth-mainnet.alchemyapi.io/v2/5h1xHvsnNA58znrs5AR-YzyYM77GCNxA”, code=SERVER_ERROR, version=web/5.0.4)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (4 by maintainers)

Most upvoted comments

I just parsed your response from the error: "{\"jsonrpc\": \"2.0\", \"id\": 48, \"error\": {\"code\": -32000, \"message\": \"invalid sender\"}}"

Looks like chainId is improper. Can you check what is the chainId of your provider?

ethers.js

I’m not sure if your question is to trade using ethers.js. But if it is in general, then you can checkout Uniswap or Binance. There are plenty of them, but I mentioned what I use. You can start by watching some youtube videos how to use them.

yes ,i use ether.js

var wallet = new ethers.Wallet(privateKey, provider);
   var contract = new ethers.Contract(erc20_token, erc20_abi, wallet);
   var options = {
       gasLimit: 60000,
       gasPrice: ethers.utils.parseUnits('100', 'gwei')
   };
   contract.transferFrom(
       '0x1261Ad4437E4e9bEbD90d640522b7bCC97F56694',
       '0x193253CA4f9DBc027E6778E62EcE4B667f10b0F2',
        ethers.BigNumber.from(100),
        options
   ).then(res=>{
       console.log(res);
   }).catch(error=>{
       console.log(ethers.utils.toUtf8String(Object.values(error.body)));
   })

image

this is hash 0x0e7c81aced0faceb9d820699a91316adc96278b1cf03dc723261a5fb420a0021 image Shown here is successful, but the 0x193253CA4f9DBc027E6778E62EcE4B667f10b0F2 did not increase the balance