Metanet Protocol
The Metanet Protocol is a layer-2 overlay protocol that defines a method for creating data structure over Bitcoin SV. The protocol utilises nodes and edges to specify directed acyclic graph (DAG) data structures on the Bitcoin SV ledger. The Metanet protocol can be used to construct diverse systems such as file systems, internet domains, ownership structures and code repositories.
There are tools available to write and read Metanet graphs, and a growing range of projects that use the Metanet protocol to structure their application data.
Node and Edge Structure
The Metanet Protocol (MNP) is a protocol for creating graph structures comprising nodes and edges on the ledger. In the Metanet protocol the following definitions of node and edge are used:
- Metanet Node - A transaction using the Metanet protocol format.
- Metanet Edge - An input signature linking two Metanet nodes.
A Metanet node is a transaction that conforms to the Metanet transaction format specified in Metanet technical summary document produced by nChain. The basic components of a Metanet transaction include a protocol flag, Metanet-specific data attributes, and any content data that is to be stored by a Metanet node transaction.
The protocol flag is a 4-byte hexadecimal prefix that signifies that a transaction is using the format of the Metanet protocol. The hexadecimal value of the prefix was chosen to be the hexademical encoding 0x4d455441 of the string 'meta' by public poll on June 5th 2019.
The Metanet-specific data attributes of a Metanet node transaction include the following:
- - the public key defining the node.
- - the unique transaction ID of the node.
- - the public key defining a parent of the node.
- - a signature created using the private key associated with the public key defining a parent of the node.
- - the unique transaction ID of the parent of the node.
The Metanet-specific data attributes listed above are used collectively to define a Metanet node and its position within a larger graph structure of multiple Metanet nodes, known as a Metanet graph.
It is possible that a node does not have any parents and such a node is termed a root node. A root node will have null values for any , , and attributes, and can therefore use a valid signature from any public key in its input(s).
A Metanet transaction is defined as a transaction that contains an OP_FALSE OP_RETURN payload containing:
- The Metanet flag
- A node public key
- A parent transaction ID (null if a root node).
In order to qualify as a Metanet-valid node, the transaction must also be signed by the public key corresponding to its parent .
Any content data and its encoding can be included following these core Metanet attributes in the OP_FALSE OP_RETURN payload. The Metanet protocol does not specify the use of any one scheme for content data and additional attributes, and any valued usage of the Metanet protocol attributes above constitute a Metanet node transaction.
A basic example of a Metanet node transaction that conforms to this format is shown in the diagram on the right.
The Metanet graph is formed by creating edges between parent Metanet nodes and child Metanet nodes. An edge is created between a parent and child by the creation and insertion of the signature in the child node, using the parent public key.
The fact that this signature is in a transaction input means that the signature itself may be validated by Miners. This means that attempts to spoof a Metanet node can be mitigated either by validating the signature explicitly or by confirming that the node is spending an appropriate previous output.
Rules of the Metanet Protocol
The Metanet protocol specifies a simple and extensible rule set for creating Metanet graphs and data structures. The base rule set is the following:
- Nodes are transactions.
- Edges are created by signatures.
- Each node is uniquely identified by the pair of attributes: , .
- Each node must specify the node ID of itself and its parent: , .
The unique node identifier for a node is defined mathematically as , where is a cryptographic hash function.
Metanet graph structures may be created using this base rule set alone. It is also possible to impose additional rules to Metanet graph structures to achieve different properties for data structures.
A simple extension of the rule set is to impose the following constraints:
- The in-degree of a node should be 0 (no parent) or 1 (one parent).
- The out-degree of a node should be a free parameter.
These additional rules allow domain-like structures to emerge as Metanet DAGs, which can be used to structure websites and file systems which inherit the permission structure of a Metanet graph.