statechannels/go-nitro

Creating an L1TxObjective

Closed this issue · 0 comments

NiloCK commented

An AA-Nitro SCW requires user Alice and her intermediary Irene to collaborate on submitting her L1 transactions. (more specifically: her UserOperations, which get bundled into L1 transactions by bundlers)

go-nitro can be the driver of these interactions with an L1TxObjective.

tx = someEthTx(); // given some vanilla ethereum transaction...
mySCW = "0xabc";  // the address of my SCW / Ledger Channel
nitroNode.ExecuteTx(mySCW, tx);

Alice's Nitro client creates an objective that:

  • converts the tx to a UserOperation
  • signs the UserOperation
  • forwards the UserOperation to the account intermediary
  • waits for the intermediary to signal acceptance / rejection
  • if intermediary accepts, you could follow up by watching the chain to see the UserOperation go through

Irene's intermediary Nitro:

  • receives the request for an L1tx, which carries a UserOperation signed by Alice
  • either:
    • decides that it's "safe" to execute (eg, it doesn't burn account funds that are owned by Irene)
      • Cosigns the UserOperation and submits it to a bundler / the bundling mempool
      • alerts Alice that this has been done
    • decides that it's unsafe, and returns a rejection / failure notice to Alice