Owner: @David Rusu

Reviewers: 🟢@Thomas Lavaur 🟢@Giacomo Pasini 🟢@Gusto Bacvinka 🟢@Daniel Sanchez Quiros 🟢@Álvaro Castro-Castilla

Revisions History

Version Changes
v1 Initial revision.
v1.1 Added ‣
v1.2 Added [RFC] Add Deposit/Withdraw to Tx Encoding

Introduction

This document specifies the canonical encoding of Mantle transactions (see Mantle Transaction) and it’s sub-components. Transactions sent through the mempool and included in blocks use this encoding.

Overview

The transaction encoding is specified in ABNF form to remove any ambiguity and guarantee a canonical encoding. The high level encoding choices which were not immediately derivable from the Mantle specification are listed here:

  1. All multi-byte integers use little-endian encoding
  2. Any lists are length-prefixed with fixed width uints
  3. We derive number of proofs and type of proof from the Ops list parsed earlier

Specification

Signed Mantle Tx

SignedMantleTx = MantleTx OpsProofs

Mantle Tx

MantleTx = Ops ExecutionGasPrice StorageGasPrice

ExecutionGasPrice = UINT64
StorageGasPrice   = UINT64

<aside> 💡

In future iterations, we will use this encoding to derive the mantle_txhash

</aside>

Operations

Ops     = OpCount *Op
OpCount = Byte

Op     = Opcode OpPayload
Opcode = Byte

OpPayload = Transfer /
						ChannelInscribe /
            ChannelBlob /
            ChannelSetKeys /
            ChannelDeposit /
            ChannelWithdraw /
            SDPDeclare /
            SDPWithdraw /
            SDPActive /
            LeaderClaim 

Channel Operations