# Protocol Spec

#### MetaID Protocol Specification

The MetaID protocol is structured as follows:

```jsx
<metaid_flag> 
<operation> 
<path> 
<encryption> 
<version>  
<content-type> 
<payload> 
```

The MetaID protocol consists of seven parts:

#### **\<metaid\_flag>**

A fixed value "metaid" used as the protocol identifier.

This is a required field.

#### **\<operation>**

Operation commands, supporting four types of commands:

* **`create`**: Creates content, creating a PIN at the specified path.
* **`modify`**: Modifies content, modifying the PIN at the specified path.
* **`revoke`**: Revokes content, declaring the PIN at the specified path as void.
* **`hide`**: Creates and hides a PIN. After using this command, no PINNumber will be assigned.

This is a required field.

#### **\<path>**

The path where the PIN is located. There are three modes for indicating the path:

* Starting with “/”, the path locates the PIN to be created, such as /protocols/simplebuzz.
* Starting with “#”, the path locates the PIN by PINNumber.
* Starting with “@”, the path locates the PIN by PINID.

This is a required field.

#### **\<encryption>**

The encryption method for the PIN content. 0 means no encryption; 1 means ECIES encryption; 2 means ECDH encryption.

This is an optional field. If not provided, it must use `OP_0` as a placeholder, with a default value of `0`.

#### **\<version>**

The version number of the PIN. Different version numbers may imply different formats for the payload content.

This is an optional field. If not provided, it must use `OP_0` as a placeholder, with a default value of `0`.

#### **\<content-type>**

Specifies the file format of the `payload`, including the encoding method of the `payload`.

All media types can be referenced from: <https://www.iana.org/assignments/media-types/media-types.xhtml>

This is an optional field. If not provided, it must use `OP_0` as a placeholder, with a default value of `application/json`.

#### **\<payload>**

The `payload` is arbitrary data content, with its format specified by \<content-type>. The MetaID protocol does not limit the length of the `payload`. It is only constrained by the size of a single transaction data on the blockchain where the PIN is located.

This is an optional field. If not provided, it must use `OP_0` as a placeholder.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.metaid.io/metaid-specification/protocol-spec.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
