EnviDa Protocol
  • 🌍About Envida Blockchain
    • Introduction
    • Overview
    • Why EnviDa?
    • How it works?
    • Understanding the EnviDa Blockchain
    • DeFi Essentials
    • The Joint Potential of Blockchain, IOT and AI
  • πŸš™What is DriveMiner?
    • Environmental Tracking Devices
    • The Cost of Mining
    • The Solution of Mining
    • POW Consensus
    • Technical Specs
    • Device Sales and ROI
  • πŸ’°$EDAT Tokenomics
    • Detailed EDAT Tokenomics
    • ICO and Token Listings
    • Token Unlock and Allocation
    • Game Theory
  • πŸ“ˆStaking and Rewards
    • Reward Distribution
    • DriveMining Rewards
    • Validator Rewards
      • Unstaking Penalty
    • Staking Pool Rewards
      • Discounts
    • Data Collection Rewards
      • Stream Payment - Sensors
        • Competition and Arrival
      • Stream Payment - Lidiar
        • Teamwork
      • Pool Bonus
      • Formulas
  • ROI
  • πŸ¦Έβ€β™‚οΈFor Users
    • EnviDa Wallet
    • Driver Experience
    • Data Marketplace
    • DeFi Essentials
    • External Wallets
  • ⛓️Blockchain Architecture
    • Trustless EVM
    • Bridges
    • Runtime Development
    • Cross-Chain Compatibility
    • EnviDa Dex Engine
    • Technical Architecture
    • Scalability
    • Indexer & Explorer
    • Application Security
    • Storage
    • IPLD
    • Governance
    • Liquidity
    • Concensus
    • Runtime Environment
  • πŸ“”API Recipes
    • Account
    • Asset
    • Bag
    • Bundle
    • Market
  • 🌐EnviDa Network Infrastructure
  • ☸️Nodes and Validators
  • 🧠AI & Simulations
  • 🀝Network Referral System
  • πŸ›£οΈRoadmap
  • πŸ“šResources
    • Website
    • Business Whitepaper
    • Github
    • Technical Whitepaper
Powered by GitBook
On this page
  • Create Class
  • Class Info
  • Create
  • Info
  • Update Metadata
  • Mint
  • Burn
  • Balance
  • Transfer
  1. API Recipes

Asset

Create Class

Description:

This function creates a new class of assets. Classes being a set that includes related assets or assets that have common characteristics.

Previous Steps:

  1. Create an account

  2. Fund an account

Steps:

  1. Call the assets/create_class endpoint with the following request body:

  • seed: the seed of the account that will pay for the transaction.

  • class_id: the class identifier (must be unique).

  • owner: the account address that will have ownership of the class.

  • metadata: additional information about the class.

Example Input:

{
    "seed": "//Alice",
    "metadata": {
        "userdata": "Type 1"
    },
    "class_id": 1,
    "owner": "5EcFZ4EkYFMYcpJWyjgDde4zG8tVvmdanXeSyNTyD42r552b"
}

Expected Output:

{
    "class_id": 1,
    "who": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
}
  • class_id: the class identifier.

  • who: the account address of the class owner.

Class Info

Description:

This function returns information about a class.

Previous Steps:

  1. Create an account

  2. Fund an account

Steps:

  1. Call the assets/class_info endpoint with the following request body:

  • class_id: the class identifier.

Example Input:

{
    "class_id": 1
}

Expected Output:

{
    "info": {
        "class_id": 1,
        "owner": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
        "metadata": {
            "userdata": "data"
        }
    }
}
  • class_id: the class identifier.

  • owner: the account address of the class owner.

  • metadata: additional information about the asset.

Create

Description:

This function creates an asset.

Previous Steps:

  1. Create an account

  2. Fund an account

Steps:

  1. Call the assets/create endpoint with the following request body:

  • seed: the seed of the account that will pay for the transaction.

  • class_id: the class identifier

  • asset_id: the asset identifier (must be unique).

  • account: the account address that will have ownership of the asset.

  • metadata: additional information about the asset.

Example Input:

{
    "seed": "//Alice",
    "account": "5EcFZ4EkYFMYcpJWyjgDde4zG8tVvmdanXeSyNTyD42r552b",
    "class_id": 1,
    "asset_id": 1,
    "metadata": {
        "userdata": "Type 1"
    }
}

Expected Output:

{
    "class_id": 1,
    "asset_id": 1,
    "who": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
}
  • class_id: the class identifier.

  • asset_id: the asset identifier.

  • who: the account address of the asset owner.

Info

Description:

This function returns information about an asset.

Previous Steps:

  1. Create an account

  2. Fund an account

Steps:

  1. Call the assets/info endpoint with the following request body:

  • class_id: the class identifier.

  • asset_id: the asset identifier.

Example Input:

{
    "class_id": 1,
    "asset_id": 1
}

Expected Output:

{
    "info": {
        "class_id": 1,
        "asset_id": 1,
        "owner": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
        "metadata": {
            "userdata": "data"
        }
    }
}
  • class_id: the class identifier.

  • asset_id: the asset identifier.

  • owner: the account address of the asset owner.

  • metadata: additional information about the asset.

Update Metadata

Description:

This function updates the asset class metadata.

Previous Steps:

  1. Create an account

  2. Fund an account

Steps:

  1. Call the assets/update_metadata endpoint with the following request body:

  • seed: the seed of the account that will pay for the transaction.

  • metadata: the new metadata to be set by this function.

  • class_id: the class identifier.

  • asset_id: the asset identifier.

Example Input:

{
    "seed": "//Alice",
    "metadata": {
        "userdata": "some new data"
    },
    "class_id": 1,
    "asset_id": 1
}

Expected Output:

{
    "class_id": 1,
    "asset_id": 1,
    "who": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
    "metadata": {
        "userdata": "some new data"
    }
}
  • class_id: the class identifier.

  • asset_id: the asset identifier.

  • who: the account address that paid for the transaction.

  • metadata: the information updated by the function.

Mint

Description:

This function mints an asset by a given amount.

Previous Steps:

  1. Create an account

  2. Fund an account

Steps:

  1. Call the assets/mint endpoint with the following request body:

  • seed: the seed of the account that will pay for the transaction.

  • class_id: the class identifier

  • asset_id: the asset identifier

  • to: the account address that will have ownership of the assets.

  • amount: the specific amount of assets to be minted.

Example Input:

{
    "seed": "//Alice",
    "to": "5EcFZ4EkYFMYcpJWyjgDde4zG8tVvmdanXeSyNTyD42r552b",
    "class_id": 1,
    "asset_id": 1,
    "amount": 500000
}

Expected Output:

{
    "to": "5EcFZ4EkYFMYcpJWyjgDde4zG8tVvmdanXeSyNTyD42r552b",
    "class_id": 1,
    "asset_id": 1,
    "amount": 500000,
    "who": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
}
  • who: the account address that paid for the transaction.

  • class_id: the class identifier

  • asset_id: the asset identifier

  • to: the account address that has the ownership of the assets.

  • amount: the specific amount of assets minted.

Burn

Description:

This function burns an asset by a given amount.

Previous Steps:

  1. Create an account

  2. Fund an account

Steps:

  1. Call the assets/burn endpoint with the following request body:

  • seed: the seed of the account that will pay for the transaction.

  • class_id: the class identifier

  • asset_id: the asset identifier

  • from: the account address that will burn the assets.

  • amount: the specific amount of assets to be burned.

Example Input:

{
    "seed": "//Alice",
    "from": "5EcFZ4EkYFMYcpJWyjgDde4zG8tVvmdanXeSyNTyD42r552b",
    "class_id": 1,
    "asset_id": 1,
    "amount": 4000
}

Expected Output:

{
    "from": "5EcFZ4EkYFMYcpJWyjgDde4zG8tVvmdanXeSyNTyD42r552b",
    "class_id": 1,
    "asset_id": 1,
    "amount": 4000,
    "who": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
}
  • who: the account address that paid for the transaction.

  • class_id: the class identifier

  • asset_id: the asset identifier

  • from: the account address that burned the assets.

  • amount: the specific amount of assets burned.

Balance

Description:

This function checks the balance of an asset in an account.

Previous Steps:

  1. Create an account

  2. Fund an account

Steps:

  1. Call the assets/balance endpoint with the following request body:

  • class_id: the class identifier

  • asset_id: the asset identifier

  • account: the account address that will be checked.

Example Input:

{
    "account": "5EcFZ4EkYFMYcpJWyjgDde4zG8tVvmdanXeSyNTyD42r552b",
    "class_id": 1,
    "asset_id": 1
}

Expected Output:

{
    "amount": 500000
}
  • amount: the specific amount of assets in the given account.

Transfer

Description:

This function transfers an given amounts of an asset from one account to another.

Previous Steps:

  1. Create an account

  2. Fund an account

Steps:

  1. Call the assets/transfer_from endpoint with the following request body:

  • seed: the seed of the account that will pay for the transaction.

  • class_id: the class identifier

  • asset_id: the asset identifier

  • from: the account address that will send the assets.

  • to: the account address that will receive the assets

  • amount: the specific amount of assets to be sent.

Example Input:

{
    "seed": "//Alice",
    "from": "5EcFZ4EkYFMYcpJWyjgDde4zG8tVvmdanXeSyNTyD42r552b",
    "to": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
    "class_id": 1,
    "asset_id": 1,
    "amount": 50000
}

Expected Output:

{
    "from": "5EcFZ4EkYFMYcpJWyjgDde4zG8tVvmdanXeSyNTyD42r552b",
    "to": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
    "class_id": 1,
    "asset_id": 1,
    "amount": 50000,
    "who": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
}
  • who: the account address that paid for the transaction.

  • class_id: the class identifier

  • asset_id: the asset identifier

  • from: the account address that sent the assets.

  • to: the account address that received the assets

  • amount: the specific amount of assets sent.

PreviousAccountNextBag

Last updated 2 years ago

πŸ“”
Create a class
Create a class
Create a class
Create an asset
Create a class
Create an asset
Create a class
Create an asset
Create a class
Create an asset
Create a class
Create an asset
Create a class
Create an asset
Mint an asset