AI Network
  • What is AI Network
  • AIN Blockchain
    • Architecture
      • Design Principles
      • Event-driven Architectures
      • Blockchain Database
        • States
          • State Types
          • Operations
          • Predefined Structures
        • Rules and Owners
          • Rule Configs
          • Owner Configs
        • Functions
          • Built-in Functions
      • Instant Execution, and Eventual Consistency
      • Network ID and Chain ID
      • Transactions
        • Structure
        • Nonce
        • Read Concern
        • Propagation
      • Block Structure
      • Account and Keys
      • Consensus
      • Scalability
      • Apps
    • Developer Guide
      • Quick Start
      • AI Network Products
        • AI Network Worker
        • AI Network Insight
        • Testnet Server Node
        • Ainize Trigger
          • Project user
          • Project deployer
          • Why do we have to use Ainize Trigger?
      • Token Bridge
      • Trouble Shooting
    • Developer Reference
      • Blockchain API
        • JSON RPC API
        • Node Client API
      • Blockchain SDK
        • ain-js
        • ain-py
      • Validators
    • Staking
  • AIN DAO
    • What is AIN DAO
      • Runo (Run Your Node)
      • GPU Sponsorship Program
    • Onboarding & Participation
    • Governance
    • Tokenomics
      • AI Network Tokenomics
      • AINFT Tokenomics
  • AI Agents
    • AINFT
    • AINFT Factory
    • AINFT Projects
      • 🍳MiniEggs
      • 🦈Baby Shark
      • 🛸Soul Fiction
      • 🎻NFT Classics Society
    • Developer Reference
      • Ainft-Js
      • AINFT tutorial
        • Create AINFT object and Mint
        • Transfer AINFT
        • Set metadata of AINFT
        • Search and Retrieve AINFT
  • AIN Wallet
    • What is AIN Wallet?
    • AIN Wallet API
  • PROPOSAL DOCUMENTS
    • AIN Improvement Memos (AIMs)
    • AIN Improvement Proposals (AIPs)
Powered by GitBook
On this page
  • Registration
  • Configuration
  • Admin Config
  • Billing Config
  • Service Config

Was this helpful?

  1. AIN Blockchain
  2. Architecture

Apps

Since AIN Blockchain is essentially a large public decentralized database, we have designed a concept of "Apps", where each app could represent a service or an organization.

Registration

An App can be created and registered by setting app configs at /manage_app/${appName}/create/${key}. App configs include admin, billing, and service configs.

Options

  • [boolean] is_public: When is_public option is set to true, the created app will allow anyone to set value and give branch_owner, write_function, and write_rule owner permissions to anyone at the app's path (/apps/${appName}). Note that this option does not override the admin / billing / service configs, but sets additional permissions on top of the given configs.

Configuration

Admin Config

Admin config is a mapping of address and boolean (true), and if an address is added as an admin, upon the creation of the app, the address obtains all the owner permissions (branch_owner, write_function, write_owner, write_rule) as well as the write rule permission for the path /apps/${appName}.

ain.db.ref(`/manage_app/${appName}/create/${Date.now()}`).setValue({
  admin: {
    "0xADDR_1": true,
    "0xADDR_2": true
  }
});

Billing Config

The billing config specifies the names of the billing accounts associated with the app and the addresses that can use the billing accounts when sending transactions.

ain.db.ref(`/manage_app/${appName}/create/${Date.now()}`).setValue({
  admin: {
    "0xADDR_1": true,
    "0xADDR_2": true
  },
  billing: {
    billingAccountA: {
      users: {
        "0xADDR_1": true,
        "0xADDR_2": true
      }
    },
    billingAccountB: {
      users: {
        "0xADDR_1": true,
        "0xADDR_3": true
      }
    }
  }
});

Service Config

The service config contains service-specific configurations. For example, if the app uses a staking service, it could set the default lock-up duration by setting the config as follows:

ain.db.ref(`/manage_app/${appName}/create/${Date.now()}`).setValue({
  admin: {
    "0xADDR_1": true,
    "0xADDR_2": true
  },
  billing: {
    billingAccountA: {
      users: {
        "0xADDR_1": true,
        "0xADDR_2": true
      }
    },
    billingAccountB: {
      users: {
        "0xADDR_1": true,
        "0xADDR_3": true
      }
    }
  },
  service: {
    staking: {
      lockup_duration: 2592000000 // ms
    }
  }
});

PreviousScalabilityNextDeveloper Guide

Last updated 3 years ago

Was this helpful?