Revoke an Ethereum Outbound Transaction

The outbound revoke is basically identical to the inbound revoke, except that instead of calling it on Ethereum, the outbound revoke is called on Wanchain.

So with that said, let’s start by making a new script file for the revoke.

$ vi weth2eth-revoke.js

Copy over the top portion of previous scripts, though as before make sure to add in the redeemKey generated by the expired outbound transaction.

const opts = {
  ...
  redeemKey: {
    x: '<the x value>',
    xHash: '<the xHash value>',
  }
};

Then we can set up the revoke call.

Promise.resolve([])
  .then(sendRevoke)
  .catch(err => {
    console.log('Error:', err);
  });

function sendRevoke(txCount) {

  // Get the raw revoke tx
  const revokeTx = cctx.buildRevokeTx(opts);

  // Send the revoke transaction on Wanchain
  const receipt = await utils.sendRawWanTx(web3wan, revokeTx, opts.from, wanPrivateKey)

  console.log('Revoke sent:', receipt);
}

Finally, go ahead and run the script.

$ node eth2weth-revoke.js