Creating Assets

Creating assets

To create any asset, these values must always be filled:

POST /assets/

{
  "name": "string",
  "author": "string"
}
  • name: The visible name of the asset. This is visible for everyone and defines what asset it is. (e.g. “NDA Contract”)
  • author: The address that should own this asset. This address must be an Ethereum address that starts with “0x”

After sending a creation request, a new treansaction is generated which is then sent to the defined author address. The asset does not exist in the Blockchain until the user has manually signed and approved the transaction.

Optionally, any asset can also include extra data that can be manually added. Since this is only a normal string, it allows for any text or stringified object like JSON/XML string.

In addition to name and author, add the following variable:

{
  "data": "string"
}

Asset creation status

As the creation of assets is working in asychronous matter and has a short wait time after accepting the request, the status of the asset can be looked up to optimize automations or show the current state on the UI. The status can be easily looked up by sending GET /assets/{assetId}/status

Attaching file info to assets

Any asset can contain information about a specific file that is connectred with it. Only the metadata is uploaded to the Blockchain, the file itself is managed externally via any option you choose. The asset merely allows the user to compare and confirm that the downloaded file is in connection with the asset.

The comparison mainly happens via the hash string as the user can calculate the hash of the file they downloaded. If it fits with the saved hash from the asset, they can be certain that the file is correct. The hashing method itself is not defined by the Notardec API, any hashing method can be used. In general however, the recommended hashing method should always be used. As of this writing we recommend SHA2-256.

Following variables have to be added in addition to name and author:

{
  "fileName": "string",
  "fileType": "string",
  "fileSize": "string",
  "method": "string",
  "hash": "string",
  "uri": "string"
}
  • fileName: Name of the file that has been attached. This is to easily fetch and show a user-friendly name.
  • fileType: Type of the file e.g. pdf, txt, jpg, …
  • fileSize: The size of the file in bytes. This allows the user to compare if the byte size is the same.
  • method: Hashing method used. This is important for correct file hash comparison.
  • hash: The hash string of the generated hash.
  • uri: Optionally define where the file can be downloaded.