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
  • Register
  • Create
  • Deposit
  • Sweep
  1. API Recipes

Bag

Register

Description:

This function register a bag transaction.

Steps:

  1. Call the bag/register endpoint with the following request body:

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

  • class_id: the new class identifier that the bag will manage.

  • metadata: additional information about the bag.

Example Input:

{
    "seed": "//Alice",
    "class_id": 100000,
    "metadata": {
        "userdata": "somedata"
    }
}

Expected Output:

{
    "who": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
    "class_id": 100000
}
  • who: the account address that paid for the transaction.

  • class_id: the class identifier managed by the bag.

Create

Description:

This function creates a bag transaction.

Previous Steps:

  1. Create an account

  2. Fund an account

Steps:

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

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

  • class_id: the class identifier that the bag manages.

  • owners: array of account addresses that will be associated with the bag.

  • shares: the amount of share held by the corresponding owners.

Example Input:

{
    "seed": "//Alice",
    "class_id": 100000,
    "owners": ["5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"],
    "shares": [1]
}

Expected Output:

{
    "bag": "5EYCAe5jLQkbmk7kHzj7VNqTGExAEDCjwnnzSh1UEC9N9PgP",
    "class_id": 100000,
    "asset_id": 0,
    "owners": [
        "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
    ]
}
  • owners: array of account addresses associated with the bag.

  • bag: the bag account.

  • class_id: the class identifier that the bag manages.

  • asset_id: the asset identifier that the bag manages.

Deposit

Description:

This function creates a new deposit to the bag account.

Previous Steps:

  1. Create an account

  2. Fund an account

  3. Create a class

  4. Create an asset

  5. Mint an asset

Steps:

  1. Call the bag/deposit endpoint with the following request body:

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

  • bag: the bag account where the deposit will be made.

  • class_ids: an array of the class identifiers that will be part of the transaction.

  • asset_ids: an array of asset_ids arrays that will be related to each class_id.

  • amounts: an array of amount arrays that will be related to each asset_id.

Example Input:

{
    "seed": "//Alice",
    "bag": "5EYCAe5jLQkbmk7kHzj7VNqTGExAEDCjwnnzSh1UEC9N9PgP",
    "class_ids": [1],
    "asset_ids": [[0,1]],
    "amounts": [[100,200]]
}

Expected Output:

{
    "bag": "5EYCAe5jLQkbmk7kHzj7VNqTGExAEDCjwnnzSh1UEC9N9PgP",
    "who": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
}
  • who: the account address that paid for the transaction.

  • bag: the bag account.

Sweep

Description:

This function sweep the deposits made on an bag account to a given account.

Previous Steps:

  1. Create an account

  2. Fund an account

  3. Create a class

  4. Create an asset

  5. Mint an asset

Steps:

  1. Call the bag/sweep endpoint with the following request body:

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

  • bag: the bag account where the deposit were made.

  • to: the receiver account address.

Example Input:

{
    "seed": "//Alice",
    "to": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
    "bag": "5EYCAe5jLQkbmk7kHzj7VNqTGExAEDCjwnnzSh1UEC9N9PgP"
}

Expected Output:

{
    "bag": "5EYCAe5jLQkbmk7kHzj7VNqTGExAEDCjwnnzSh1UEC9N9PgP",
    "who": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
    "to": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
}
  • who: the account address that paid for the transaction.

  • to: the receiver account address.

  • bag: the bag account.

PreviousAssetNextBundle

Last updated 2 years ago

πŸ“”
Register bag
Register bag
Create a bag
Register bag
Create an bag
Bag deposit