Can't find failed relayed GSN Transaction

Hi all,

Im trying to integrate the javascript part of GSN:

  • @openzeppelin/network”: “^0.2.10”
  • in vanilla Javascript
  • Kovan network.
  • Metamask v 7.7.1, connected to Kovan Network

I took the relay_client_config from your chat app repo, since previously I was getting rejected by the relayer for minimum gas prices.

const gasPrice = 22000000001
let relay_client_config = {
        txfee: 90,
        force_gasPrice: gasPrice, // override requested gas price
        gasPricegasPrice: gasPrice, // override requested gas price
        force_gasLimit: 500000, // override requested gas limit.
        gasLimit: 500000, // override requested gas limit.
        verbose: true
    }
    debugger
    const context = await fromInjected({
      gsn: {
        ...relay_client_config
      }
})

this.depositManager = new this.web3.eth.Contract(depositManagerContractInfo.abi, depositManagerContractAddress)

    this.depositManager.methods.contribute(lendingContractAddress, contributorAddress, amountToSend)
      .send(transactionParameters)
      .on('transactionHash', hash => {
        console.log('transactionHash', hash)
      }).on('receipt', receipt => {
        console.log('receipt', receipt)
      }).on('error', error => {
        console.log('error', error)
      })

So I run this, Metamask ask for a signature, I accept and wait for it, but it fails:

RR:  7 Objectfrom: "0xcd5840c07bc9598defc1993ff2845740c77ce635"to: "0x9a261a14d0f50f3dd58e7f232fea3b702cdd7ef1"txfee: 90gas_limit: 144601gas_price: 5000000000approveFunction: undefined__proto__: Object
ServerHelper.js:230 fetchRelaysAdded: found 1 events
ServerHelper.js:269 fetchRelaysAdded: after filtering have 1 active relays
ServerHelper.js:35 nextRelay: find fastest relay from: [{"address":"0xDa070A7F40Fe13923D8144Ae32C4a0a459becDee","relayUrl":"https://kovan-01.gsn.openzeppelin.org","transactionFee":"70","stake":"1000000000000000000","unstakeDelay":"604800","score":930}]
ServerHelper.js:97 getRelayAddressPing URL: https://kovan-01.gsn.openzeppelin.org
ServerHelper.js:41 race finished with a champion: https://kovan-01.gsn.openzeppelin.org
RelayClient.js:471 relayTransaction hash:  0x6149d1bf2d00a3c68a289232ed693f6696172bd8d3d0089f7699bf9b7f46ad61 from:  0xcd5840c07bc9598defc1993ff2845740c77ce635 sig:  0x7bbffa5f15ebd860ffff435b15fd16b872072e66631ac757b419a5dd7da0b53c10d202e7f2ef520dc8c598d3c77342a706cc4536499f62984ee6cfdbb18903161b
RelayClient.js:474 relayTransaction recovered: 0xcd5840c07bc9598defc1993ff2845740c77ce635 signature is correct
RelayClient.js:294 sendViaRelay to URL: https://kovan-01.gsn.openzeppelin.org {"encodedFunction":"0x8d47270900000000000000000000000067d22629caa6b9e79fbdc6c9f3328d7370045426000000000000000000000000cd5840c07bc9598defc1993ff2845740c77ce6350000000000000000000000000000000000000000000000008ac7230489e80000","signature":"0x7bbffa5f15ebd860ffff435b15fd16b872072e66631ac757b419a5dd7da0b53c10d202e7f2ef520dc8c598d3c77342a706cc4536499f62984ee6cfdbb18903161b","approvalData":[],"from":"0xcd5840c07bc9598defc1993ff2845740c77ce635","to":"0x9a261a14d0f50f3dd58e7f232fea3b702cdd7ef1","gasPrice":22000000001,"gasLimit":500000,"relayFee":90,"RecipientNonce":1,"RelayMaxNonce":501,"RelayHubAddress":"0xD216153c06E857cD7f72665E0aF1d7D82172F494"}
RelayClient.js:238 sendViaRelay resp= {nonce: "0x1f2", gasPrice: "0x51f4d5c01", gas: "0xdc2ac", to: "0xd216153c06e857cd7f72665e0af1d7d82172f494", value: "0x0", …}nonce: "0x1f2"gasPrice: "0x51f4d5c01"gas: "0xdc2ac"to: "0xd216153c06e857cd7f72665e0af1d7d82172f494"value: "0x0"input: "0x405cec67000000000000000000000000cd5840c07bc9598defc1993ff2845740c77ce6350000000000000000000000009a261a14d0f50f3dd58e7f232fea3b702cdd7ef10000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000005a000000000000000000000000000000000000000000000000000000051f4d5c01000000000000000000000000000000000000000000000000000000000007a120000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000648d47270900000000000000000000000067d22629caa6b9e79fbdc6c9f3328d7370045426000000000000000000000000cd5840c07bc9598defc1993ff2845740c77ce6350000000000000000000000000000000000000000000000008ac7230489e800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000417bbffa5f15ebd860ffff435b15fd16b872072e66631ac757b419a5dd7da0b53c10d202e7f2ef520dc8c598d3c77342a706cc4536499f62984ee6cfdbb18903161b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"v: "0x1b"r: "0xdab50837bf49ccbc1289059b110e0a9bbed84ecd669a1bb2ff9de9756fa89d5e"s: "0x3e5c3ca31f59a3622ac11dd253191a65498d05464ff750ed9d1317a8757476d5"hash: "0x909d19020265239d45b4d23af31e7b51af23a51da56d21f6a4f7db8852f0cd32"__proto__: Object
RelayClient.js:164 validateRelayResponse - valid transaction response
RelayClient.js:284 txHash= 0x909d19020265239d45b4d23af31e7b51af23a51da56d21f6a4f7db8852f0cd32
contractManager.js:80 transactionHash 0x909d19020265239d45b4d23af31e7b51af23a51da56d21f6a4f7db8852f0cd32
RelayClient.js:323 broadcastTx:  0x909d19020265239d45b4d23af31e7b51af23a51da56d21f6a4f7db8852f0cd32
3utils.js:57 Setting tx receipt status to zero while fetching tx receipt (reverted relayed transaction with status code 1)
contractManager.js:86 error Error: Transaction has been reverted by the EVM:
{
  "blockHash": "0xeaa84af451ca98753e6433c7f2e7674846de2adfb759ea5e0bab9186a687f331",
  "blockNumber": 15581586,
  "contractAddress": null,
  "cumulativeGasUsed": 109216,
  "from": "0xda070a7f40fe13923d8144ae32c4a0a459becdee",
  "gasUsed": 109216,
  "logsBloom": "0x04000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000002000000000000040000000000000000000000000000000000000000000000000002000400010000000000000002000000000001000000000000000000000000000000010000000000000000000000000000000000000000000101000020000000000000010000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "root": null,
  "status": false,
  "to": "0xd216153c06e857cd7f72665e0af1d7d82172f494",
  "transactionHash": "0x909d19020265239d45b4d23af31e7b51af23a51da56d21f6a4f7db8852f0cd32",
  "transactionIndex": 0,
  "events": {
    "0": {
      "address": "0xD216153c06E857cD7f72665E0aF1d7D82172F494",
      "blockHash": "0xeaa84af451ca98753e6433c7f2e7674846de2adfb759ea5e0bab9186a687f331",
      "blockNumber": 15581586,
      "logIndex": 0,
      "removed": false,
      "transactionHash": "0x909d19020265239d45b4d23af31e7b51af23a51da56d21f6a4f7db8852f0cd32",
      "transactionIndex": 0,
      "transactionLogIndex": "0x0",
      "type": "mined",
      "id": "log_304291c8",
      "returnValues": {},
      "signature": null,
      "raw": {
        "data": "0x8d4727090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000010df66d62baf42",
        "topics": [
          "0xab74390d395916d9e0006298d47938a5def5d367054dcca78fa6ec84381f3f22",
          "0x000000000000000000000000da070a7f40fe13923d8144ae32c4a0a459becdee",
          "0x000000000000000000000000cd5840c07bc9598defc1993ff2845740c77ce635",
          "0x0000000000000000000000009a261a14d0f50f3dd58e7f232fea3b702cdd7ef1"
        ]
      }
    }
  }
}
    at index.js:412
utils.js:57 Setting tx receipt status to zero while fetching tx receipt (reverted relayed transaction with status code 1)

so I’m trying to find the TX and hopefully get a revert message to debug, but I can´t find the Tx hash in Etherscan or web3.eth.getTransactionReceipt()

So I input the block number in Etherscan and:
Captura de pantalla 2019-12-20 a las 18.43.26

So:

  1. Could you tell me please what am I doing wrong or what is happening here?
  2. I wich unit is tx_fee denominated? GWei? I assume this is the amount discounted from my contract balance in RelayHub (topped it up previously with 0.5 KETH on DappTool of your GSN website)

Thanks in advance!

1 Like

Hi @ethicraul,

Were you able to get this working on ganache-cli?

I can see the transaction on Kovan: https://kovan.etherscan.io/tx/0x909d19020265239d45b4d23af31e7b51af23a51da56d21f6a4f7db8852f0cd32

I would try getting the contract working locally and then on Kovan with a simple React app (or the inverse get vanilla JavaScript to work with a simple Counter contract). https://docs.openzeppelin.com/sdk/2.6/gsn-dapp

Are you able to share your contract?

Hi @ethicraul,

Have you had any success tracking this down?

It appears as though the relayed call reverted in your contract.

Another thing to try is calling the contract directly (not via the GSN) with the same parameters.