github.com/MetalBlockchain/metalgo@v1.11.9/vms/platformvm/warp/payload/README.md (about)

     1  # Payload
     2  
     3  An Avalanche Unsigned Warp Message already includes a `networkID`, `sourceChainID`, and `payload` field. The `payload` field can be parsed into one of the types included in this package to be further handled by the VM.
     4  
     5  ## Hash
     6  
     7  Hash:
     8  ```
     9  +-----------------+----------+-----------+
    10  |         codecID :   uint16 |   2 bytes |
    11  +-----------------+----------+-----------+
    12  |          typeID :   uint32 |   4 bytes |
    13  +-----------------+----------+-----------+
    14  |            hash : [32]byte |  32 bytes |
    15  +-----------------+----------+-----------+
    16                               |  38 bytes |
    17                               +-----------+
    18  ```
    19  
    20  - `codecID` is the codec version used to serialize the payload and is hardcoded to `0x0000`
    21  - `typeID` is the payload type identifier and is `0x00000000` for `Hash`
    22  - `hash` is a hash from the `sourceChainID`. The format of the expected preimage is chain specific. Some examples for valid hash values are:
    23    - root of a merkle tree
    24    - accepted block hash on the source chain
    25    - accepted transaction hash on the source chain
    26  
    27  ## AddressedCall
    28  
    29  AddressedCall:
    30  ```
    31  +---------------------+--------+----------------------------------+
    32  |             codecID : uint16 |                          2 bytes |
    33  +---------------------+--------+----------------------------------+
    34  |              typeID : uint32 |                          4 bytes |
    35  +---------------------+--------+----------------------------------+
    36  |       sourceAddress : []byte |                 4 + len(address) |
    37  +---------------------+--------+----------------------------------+
    38  |             payload : []byte |                 4 + len(payload) |
    39  +---------------------+--------+----------------------------------+
    40                                 | 14 + len(payload) + len(address) |
    41                                 +----------------------------------+
    42  ```
    43  
    44  - `codecID` is the codec version used to serialize the payload and is hardcoded to `0x0000`
    45  - `typeID` is the payload type identifier and is `0x00000001` for `AddressedCall`
    46  - `sourceAddress` is the address that sent this message from the source chain
    47  - `payload` is an arbitrary byte array payload