Publication

Content

  1. Publish content

  function post(string memory content) external;

The prepared tokenId and the transaction hash on Arweave for the content to be published will be used to generate a SBT, with the actual content stored on Arweave. The transaction hash on Arweave is stored on the bloclchain as the content.

Parameters:

  • content: The transaction hash on Arweave relating to the content. One can access the original content via this hash.

The content uploaded to Arweave is structured as follows:

{
  "content": {
    "body": "${The body of content}",
    "title": "${The title of content}"
  }
}
  1. Lookup published content

  function contentOf(uint256 tokenId) external view returns (string memory content);

Lookup published content using tokenId:

Parameters:

  • tokenId

Return value:

  • content: The transaction hash on Arweave relating to the content. One can access the original content via this hash.

PrivacyContent

  1. Prepare a tokenId

  function prepareToken() external returns (uint256);

The user is preparing a tokenId.

Return value:

  • tokenId: The prepared tokenId

  1. Lookup the tokenId prepared.

  function ownedPrepareToken(address owner) external view returns (uint256);

Parameters:

  • owner: The address to be looked up

Return value:

  • tokenId: The prepared tokenId

  1. Publish privacy content

  function post(uint256 tokenId, string memory content) external;

The prepared tokenId and the transaction hash on Arweave for the content to be published will be used to generate a SBT, with the actual privacy content and its permissions stored on Arweave. The transaction hash on Arweave is stored on the blockchain as the content.

Parameters:

  • tokenId: The tokenId prepared.

  • content: The transaction hash on Arweave relating to the privacy content and its permissions. The hash can be used to access the original content.

The content uploaded to Arweave is structured as follows:

{
  "encryptionBy": "lit-protocol",
  "accessCondition": [
    {
      "contractAddress": "${The contract address of Semantic SBT}",
      "standardContractType": "ERC721",
      "chain": "polygon",
      "method": "isViewerOf",
      "parameters": [
        ":userAddress",
        "${The tokenId}"
      ],
      "returnValueTest": {
        "comparator": "=",
        "value": true
      }
    }
  ],
  "encryptedSymmetricKey": "${A hex string that LIT will use to decrypt your content as long as you satisfy the conditions}",
  // encrypted content
  "encryptedObject": "${The encrypted content}"
}
  1. Viewer permission

  function isViewerOf(address viewer, uint256 tokenId) external view returns (bool);

To check if a given address has access to the privacy content related to a tokenId.

Parameters:

  • viewer: The view's address

  • tokenId

Return value:

  • isViewer: true--has viewer permission; false--do not have viewer permission

  1. Lookup published content

  function contentOf(uint256 tokenId) external view returns (string memory content);

Lookup published content according to tokenId.

parameters:

  • tokenId

Return value:

  • content: The Arweave transaction value related to the published content. One can access the original content using this hash.

Last updated