0

Alright, having a basic kernel working (counter example) I want to start consuming more complex (external) messages. Can I produce example message doing something like this?

echo '{ "n": 2, "bar": "baz", "true": false }' | xxd -p

And how should I think about adding a prefix? I’m thinking of the MAGIC_BYTE from constants in the tzwitter_app kernel example?

Question from Slack.

1 Answer 1

0

That should work! Any valid hex is a valid external message (from the protocol view, less so for specific kernels).

We've started to experiment with a 'framing protocol' over the the tx-kernel for external messages.

Basically the first byte is 0, and the next 20 bytes are the rollup address. This then lets you check if a given external message is meant for your rollup.

The remaining bytes are then whatever your external message that you actually want to process live.

Eventually you may want a more compact binary format for your messages, rather than just raw json, but that doesn't matter too much.

2
  • Oh having the rollup address as part of the message prefix / frame makes alot of sense. Is there a way to get the rollup address from inside the kernel? Or do I need to hardcode it? I could do something like: [0x01, ROLLUP_ADDR_HEX, ..] => {} To get my messages?
    – user9011
    Apr 28, 2023 at 14:36
  • The rollup kernel can ask about it’s address by using the reveal_metadata host function. tezos.gitlab.io/alpha/smart_rollups.html#host-functions (Its available on the Runtime trait in the SDK)
    – user9011
    Apr 28, 2023 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.