Skip to main content


Metadata is a kind of interface map that helps to transform a set of bytes into an understandable structure and indicates the function this structure is intended for. Metadata determines how all incoming and outgoing data will be encoded/decoded.

Metadata allows dApp’s parts - the program and the client side (JavaScript), to understand each other and exchange data.

To describe metadata interface use gmeta crate:

use gmeta::{InOut, Metadata, Out};

pub struct ProgramMetadata;

// Be sure to describe all the types.
// But if any of the endpoints is missing in your program, you can use ();
// as indicated in the case of `type Signal`.

impl Metadata for ProgramMetadata {
type Init = InOut<MessageInitIn, MessageInitOut>;
type Handle = InOut<MessageIn, MessageOut>;
type Others = InOut<MessageAsyncIn, Option<u8>>;
type Reply = String;
type Signal = ();
type State = Out<Vec<Wallet>>;

Metadata enables you to determine the expected data at the input/output for the program at each endpoint. Where:

  • Init - describes incoming/outgoing types for init() function.
  • Handle - describes incoming/outgoing types for handle() function.
  • Others - describes incoming/outgoing types for main() function in case of asynchronous interaction.
  • Reply - describes an incoming type of message performed using the handle_reply function.
  • Signal - describes only the outgoing type from the program while processing the system signal.
  • State - describes the types for the queried State

Generate metadata

To generate metadata, the following file in the root of your project folder is required:

// Where ProgramMetadata is your metadata structure

use meta_io::ProgramMetadata;

fn main() {

As a result of the program compilation, a *.meta.txt file will be generated. This metadata file can be used in the UI applications that will interact with this program. The file’s content looks like a hex string: