Comment on page

Store schema

As a declarative list of data models, the size of data to be stored via a schema is unknown. We did not choose to store schema through EVM for it may involve high gas fees and reaching gas limit when the size of data exceeds certain thresholds.
Also, in the Relation Protocol, the schema and the data structure declared in the smart contract using that schema should be the same. Namely, a schema can not be modified after the contract is initialized.
To address this, Relation stores schemas in a distributed storage system. In this field, Arweave has the following advantages compared to IPFS:
  • Persistence: Arweave stores data permanently whereas IPFS only stores them when a node chooses to. In the latter, a file could be deleted if no nodes are willing to persist it. So storing data on Arweave is more secure and reliable.
  • Accessibility: Data on Arweave can be accessed via a permanent link without accessing specific nodes. However, to access a file on IPFS, you need to know the address of a node storing the file. That means Arweave has higher accessibility.
Considering the above factors, Relation stores schema data on Arweave, with the transaction hash as the schemaURI to be passed to the contract during its initialization stage. No modification after that point will be allowed.
If a contract implements the IsemanticRDFSchema interface in the Semantic SBT specification, we can use schemaURI to query the schema address:
interface ISemanticRDFSchema {
* @notice Get the URI of schema for this contract.
* @return The URI of the contract which points to a configuration profile.
function schemaURI() external view returns (string memory);
Last modified 8mo ago