Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

io.provenance.model:metadata-asset-model

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

io.provenance.model:metadata-asset-model

Asset/NFT reference data model for Provenance Blockchain metadata module

  • 1.1.3
  • Source
  • Maven
  • Socket score

Version published
Maintainers
1
Source

Provenance Blockchain Reference Use Case Data Model

This repository contains a protobuf data model reference standard for the Provenance Blockchain Metadata module tailored for usage in the P8e Contract Execution Environment.

The model includes definitions for generic NFTs (Assets) as well as business domain objects — such as loans and loan servicing data — with language bindings for Java and Kotlin.

Status

Build stability-beta License LOC

Publications

Latest Release

JAR

Maven Artifact

Maven Usage
<dependency>
  <groupId>io.provenance.model</groupId>
  <artifactId>metadata-asset-model</artifactId>
  <version>${version}</version>
</dependency>
Gradle Usage

Groovy

implementation 'io.provenance.model:metadata-asset-model:${version}'

Kotlin

implementation("io.provenance.model:metadata-asset-model:$metadataAssetModelVersion")

Example Usage

This example shows how an NFT image file might be defined for usage in the P8e Contract Execution Environment, with the object hash stored on the blockchain through the metadata module. The full source code can be found in AssetTest.

val file = File("src/test/resources/logo.png")
val fileBytes = file.readBytes()

val asset1 = asset {
    id = UUID.randomUUID().toProtoUUID()
    type = FileNFT.ASSET_TYPE
    description = file.name
    kv.put(FileNFT.KEY_FILENAME, file.name.toProtoAny())
    kv.put(FileNFT.KEY_SIZE, fileBytes.size.toLong().toProtoAny())
    kv.put(FileNFT.KEY_BYTES, fileBytes.toProtoAny())
    kv.put(FileNFT.KEY_CONTENT_TYPE, "image/png".toProtoAny())
}

The JSON representation of this asset would look something like:

{
    "id": "4861c0c0-d46e-4ca2-b765-c66b45a41464",
    "type": "FILE",
    "description": "file",
    "kv": {
        "filename": {
            "type_url": "type.googleapis.com/google.protobuf.StringValue",
            "value": "Cg9pbWFnZSAoMTM4KS5wbmc="
        },
        "size": {
            "type_url": "type.googleapis.com/google.protobuf.Int64Value",
            "value": "CK3zEQ=="
        },
        "bytes": {
            "type_url": "type.googleapis.com/google.protobuf.BytesValue",
            "value": "Cq3zEYlQTkcNChoKAAAADUlIRF", // Value truncated
        },
        "content-type": {
            "type_url": "type.googleapis.com/google.protobuf.StringValue",
            "value": "CglpbWFnZS9wbmc="
        }
    }
}

FAQs

Package last updated on 02 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc