blockchainzkp

Understanding Midnight Outputs:


I'm new to using Midnight, and am trying to learn what a lot of my outputs mean and what I'm supposed to do with the examples. I'm trying to decode events from a transaction using the bulletin board message example. This is the output for midnight_jsonBlock:

{
  "header": {
    "parentHash": "0x510648386c58ef1708039ffa029c7190c3b9465ef353c71fa3c39238b3350aec",
    "number": "0x10058d",
    "stateRoot": "0xe5c8c262d30cdf5d1ccba5972215c2fc02fdd7a082786d22b30614474ad8bfa2",
    "extrinsicsRoot": "0x4b7734a2ed077627627b4b9e157ea67a10771953fb24ff9097691029cd984699",
    "digest": {
      "logs": [
        "0x066175726120437c531100000000",
        "0x066d637368800ecc42452b12e66f832bb3decbd0b037b4e64db200fc74a8c1e09332b5b9892d",
        "0x044d4e535610401f0000",
        "0x056175726101019abc9c89e5c1e4c7832d84eec88f86f4f17c93860b8147b65000786aad26a728f8795c7b1260e9d874244b142f7e44fd6514f65ab5a753b8c71bf2778194018e"
      ]
    }
  },
  "body": [
    {
      "Timestamp": 1744103826000
    },
    "UnknownTransaction",
    {
      "MidnightTransaction": {
        "tx": {
          "tx_hash": "a59dbdd6313e416cc565c434f31fdc2ab8a9a13262831fe94407e8bcf36a2e16",
          "operations": [
            {
              "Call": {
                "address": "020200f00c70fcf64e574b6b43a274c9bf3bcc9106ba7ac45268a8dccb8ddf1c4cd601",
                "entry_point": "706f7374"
              }
            },
            "GuaranteedCoins"
          ],
          "identifiers": [
            "0000000010168cb7a3d87b14e371a6dc1a8312827c90ae60ae07285cd0a1f95b93f13cb08c4f4f937d1c65a6aa18eb7232277e2dedffbfcc7165329c",
            "000000000b69187d4b2fff941dd85a8bd5b70820c3d6f90aa55d01de466f71dc21e9c39f6b6534a25cbe789f0c1f517da6f8de94c60872148c76860a",
            "0000000014c971d9e513c201c2405a4439cd3bbbdbfe73879d98a57751413422166154d0eadbb4436dd51da52f50a19467107a5989269418fb446384"
          ]
        }
      }
    }
  ],
  "transactions_index": [
    [
      "0xa59dbdd6313e416cc565c434f31fdc2ab8a9a13262831fe94407e8bcf36a2e16",
      "0x0203000000000003000100000064ccf66b098..."
    ]
  ]
}
  1. Am I supposed to call midnight_decodeEvents with the identifiers inside MidnightTransaction.tx?
  2. What do these identifiers represent?
  3. Should I expect an empty array if the contract doesn't emit any events (which is the case when I use identifiers from the above question)

Solution

    1. Identifiers in the MidnightTransaction.tx object are not directly related to events, so no, you do not need to call them with identifiers.

    2. Identifiers represent transaction-specific elements related to zero-knowledge proofs and transaction validity.

    3. The bulletin board example does not emit events, so an empty array should be expected behavior.

    Hope that helps!