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

Was this helpful?

  1. AIN Blockchain
  2. Architecture
  3. Transactions

Nonce

Transactions signed by the same private key (i.e., with the same address) are submitted and handled in an order using nonce. Usually, nonce is a non-negative integer value, starting from 0, that stands for the number of transactions accepted to blocks so far. Whenever a transaction is submitted its nonce is check in the following way:

  • If the nonce value is equal to (the number of transactions with the same address in blocks) + 1, it's accepted

  • Otherwise, it's kept in pending mode with a predefined timeout value until the condition met.

We call this type of nonce numbered nonce. This is enough for typical human-generated transactions. For more use cases like machine-generated transactions, we support two more types: ordered nonce and unordered nonce.

Transactions with loosely ordered nonce are ordered using timestamp:

  • If the timestamp is larger than the last timestamp, it's accepted

  • Otherwise, it' rejected

Transactions with unordered nonce is always accepted unless a transaction with the same transaction hash is already in blocks.

Three different types of nonce can be compared as follows:

Type

Nonce Field

When To Use

Good For

API Version

Numbered

Non-negative integer

Single client

Human-generated txs

1.0

Unordered

-1

Single or multiple clients, transactions are not aligned with each other.

Machine-generated txs with different generation time and submission time

1.0

Ordered

-2

Multiple clients, transactions are aligned with time

Machine-generated txs with multiple clients

1.0

PreviousStructureNextRead Concern

Last updated 1 year ago

Was this helpful?