BitBadges
  • Overview
    • ๐Ÿ‘‹BitBadges Overview
    • ๐Ÿ‘จโ€๐Ÿ’ปLearn the Basics
      • BitBadges Claims
      • Multi-Chain Accounts
      • Sign In with BitBadges
      • Badges
      • Address Lists
      • Attestations
      • Applications (Points)
      • Additional Badge Concepts
        • Manager
        • Total Supplys
        • Time-Dependent Ownership
        • Transferability
        • Balances Types
      • Wallets and Sign Ins
        • Supported Wallets
        • Alternate Sign Ins / Mobile
        • Approved Transactors
    • ๐Ÿ”จGetting Started
    • ๐Ÿ’ปHow Do I Check...?
    • ๐Ÿ”How Do I Gate...?
    • ๐ŸŽจUse Cases
    • ๐Ÿ”—Official Links and Resources
    • โš–๏ธBitBadges L1 vs Others
    • ๐Ÿช™Launch Phases
    • ๐ŸŒดEcosystem
      • WordPress Plugin
      • MetaMask Snap
      • Browser Extensions
      • LinkedIn Certifications
      • Blockin
    • ๐ŸคBrand Guidelines
    • โ“FAQ
  • โŒจ๏ธFor Developers
    • ๐Ÿšดโ€โ™‚๏ธGetting Started
    • ๐Ÿ‘คHandling Addresses
    • ๐ŸงชTestnet Mode
    • ๐Ÿ“šBitBadges API
      • Getting Started
      • Full Reference
      • Typed SDK Types
      • Upgrading an API Key Tier
      • Concepts
        • Native Chain Algorithm
        • Refresh / Claim Completion Queue
        • Designing for Compatibility
        • Limits / Restrictions
        • Managing Views
        • Use via Pipedream
    • ๐Ÿ–ฑ๏ธSign In with BitBadges
      • Overview
      • Already Have Web3 Auth?
      • Alternative - P2P Verification
      • Templates and Frameworks
        • WordPress
        • Auth0
        • ExpressJS
        • Discourse
        • Supabase
        • Others
      • Setting Up an App
      • Connecting a Claim
      • Authorization URL
        • Configuration
        • Generating the URL
      • Approaches
        • QR Codes
        • Redirect Callback
      • Verification
        • Verification Flow
        • Access Tokens
        • Offline Verification
        • Security Considerations
      • Blockin Docs
    • ๐Ÿ—๏ธBitBadges Claims
      • Overview
      • Concepts
        • Standard vs On-Demand
        • Completion Methods
        • Gating Badge Distribution
        • Claim Numbers
        • Success Logic
        • Claim Links (URLs)
        • Signed In vs Select Address
        • Universal Approach - Claim Codes
        • Identify By Socials / Emails?
        • Payment Checking
        • Receiving Attestations
      • Checking Custom Criteria
      • Implementing Custom Utility
      • Leveraging AI
      • BitBadges API & Claims
        • Verifying Claim Attempts w/ the API
        • Fetching Claims
        • Auto-Complete Claims w/ BitBadges API
      • Dynamic Stores
        • Overview
        • Adding Data
      • Custom Plugins / Webhooks
        • Overview
        • Pre-Built Webhook Plugins
        • Creating a Custom Plugin
          • Implement Your Plugin
            • Getting Started
            • Hook Types and Simulations
            • Design Considerations
            • Parameters
            • Custom Inputs
            • API Handler
          • Managing Your Plugin
          • Testing Your Plugin
        • Configuration Tools
      • Integrate with Zapier
        • Overview
        • Dynamic Store Zaps
        • Automatic Claim Tutorial
        • Post-Success Zaps
        • Leveraging Zapier AI Actions / MCP
        • Automate Any Part of the Process
          • Google Forms
      • Integrate with Pipedream
        • Overview
        • Leveraging Pipedream MCP
        • Build Custom Plugins
        • Workflow Actions
          • Complete Claim
          • Get Claim Attempt Status
          • Get Claim Code by Idx
          • Add User to Dynamic Store
        • Workflow Triggers
          • Poll Claim Attempts
        • End to End Example
      • In-Site Plugins
        • Plugins Directory
        • Plugin Documentation
        • Ownership Requirements
      • Tutorials
        • In-Site Guides
        • Get Integration User IDs
          • Get Discord User ID
          • Get Discord Server ID
          • X / Twitch / GitHub IDs
        • Add Telegram Bot to Channel
    • โš’๏ธBitBadges JS / SDK
      • Overview
      • SDK Types
      • Common Snippets
        • Address Conversions
        • NumberType Conversions
        • Uint Ranges
        • Balances
        • Transfers
        • Address Lists
        • Badge Metadata
        • Approvals / Transferability
        • Off-Chain Balances
        • Timelines
    • ๐ŸŒŸBadges - Advanced
      • Overview
      • Balances / Transfers
        • ๐Ÿ“ŠBalances
        • โž•Valid Badge IDs
        • ๐Ÿช™Balance Types
        • ๐ŸคTransferability / Approvals
        • โœ…Approval Criteria
          • Overview
          • $BADGE Transfers
          • Override User Level Approvals
          • Approval Trackers
          • Tallied Approval Amounts
          • Max Number of Transfers
          • Predetermined Balances
          • Requires
          • Merkle Challenges
          • Extending the Approval (Advanced)
      • Self-Hosted Balances
        • Overview
        • Examples / Tutorials
          • Indexed
          • Non-Indexed
      • Permissions
        • Overview
        • Action Permission
        • Timed Update Permission
        • Timed Update With Badge Ids Permission
        • Badge IDs Action Permission
        • Update Approval Permission
      • Standards
      • Archived Collections
      • Metadata
      • Timelines
      • Different Time Fields
      • List IDs
      • Uint Ranges
    • โ›“๏ธBitBadges Blockchain
      • Overview
      • Chain Details
      • REST API Docs - Node
      • Staking / Validators
      • Run a Node
        • Overview
        • Run a Mainnet Node
        • Run a Local Dev Node
        • Cosmovisor
      • Create a Smart Contract
      • ๐Ÿ”ƒCreate, Generate, and Sign Txs
        • Transaction Context
        • Generate Msg Contents
        • Signing - Cosmos
        • Signing - Ethereum
        • Signing - Solana
        • Signing - Bitcoin
        • Broadcast to a Node
        • Sign + Broadcast - bitbadges.io
      • ๐Ÿ“ฉCosmos SDK Msgs
        • x/anchor
          • MsgAddCustomData
        • x/badges
          • MsgCreateCollection
          • MsgUpdateCollection
          • MsgDeleteCollection
          • MsgCreateAddressLists
          • MsgTransferBadges
          • MsgUpdateUserApprovals
          • MsgUniversalUpdateCollection
        • x/wasmx
          • MsgStoreCodeCompat
          • MsgInstantiateContractCompat
          • MsgExecuteContractCompat
        • x/maps
          • MsgCreateMap
          • MsgUpdateMap
          • MsgDeleteMap
          • MsgSetValue
        • MsgSend
        • Cosmos Native Msgs
    • ๐Ÿง Other Concepts
      • Uint Ranges
      • Accounts (Low-Level)
      • Address Lists
      • Maps / Protocols
      • Attestations - Advanced
        • Overview
        • Creating an Attestation
        • Custom Creation Links
        • Proofs vs Attestations
        • Deriving a Proof
        • Design Considerations
        • Verification / Presentations
        • Custom Schemes
          • WITNESS Proofs
Powered by GitBook
On this page
  • Time Representation
  • Time Field Types
  • Important Note
  • Examples
  • Best Practices
  1. For Developers
  2. Badges - Advanced

Different Time Fields

BitBadges uses various time-related fields to manage permissions, timelines, transfers, and ownership. Understanding these fields is crucial for effectively managing collections and badges.

Time Representation

All times in BitBadges are represented as UNIX time, which is the number of milliseconds elapsed since the epoch (midnight at the beginning of January 1, 1970, UTC).

Time Field Types

1. permanentlyPermittedTimes

  • Purpose: Defines the times when a permission will always be executable.

  • Usage: Setting allowed periods for specific actions.

2. permanentlyForbiddenTimes

  • Purpose: Defines the times when a permission will always be forbidden.

  • Usage: Setting restricted periods for specific actions.

3. timelineTimes

  • Purpose: Specifies when a field is scheduled to have a specific value in a timeline-based field.

  • Usage: Scheduling changes to collection or badge properties over time.

4. transferTimes

  • Purpose: Defines when a transfer transaction can occur.

  • Usage: Setting periods when badges can be transferred between addresses.

5. ownershipTimes

  • Purpose: Specifies the times that a user owns a badge.

  • Usage: Defining the duration of badge ownership for users.

Important Note

The timelineTimes in permissions correspond to the updatability of the timeline, while timelineTimes in the actual timeline represent the actual times for the values.

Examples

Example 1: Presidential Election Badges

Scenario: Users participate in a US presidential election by casting votes through badge transfers.

  • T1: Conclusion of voting

  • T2: Start of presidential term

  • T3: End of presidential term

Setup:

  • transferTimes: [{ start: T1, end: T2 }] (President badge can be transferred after voting concludes)

  • ownershipTimes: [{ start: T2, end: T3 }] (Defines the presidential term)

Example 2: Managing Collection Archival

Scenario: A collection can be optionally archived by the manager from T1 to T2, but is non-archivable at all other times.

Before archiving:

Permission:
permanentlyPermittedTimes: [{ start: T1, end: T2 }]
permanentlyForbiddenTimes: [everything but T1 to T2]
timelineTimes: [{ start: 1, end: MAX_TIME }]

Archived Timeline:
isArchived: false for [{ start: 1, end: MAX_TIME }]

After archiving for all times:

Permission: (unchanged)
permanentlyPermittedTimes: [{ start: T1, end: T2 }]
permanentlyForbiddenTimes: [everything but T1 to T2]
timelineTimes: [{ start: 1, end: MAX_TIME }]

Archived Timeline:
isArchived: true for [{ start: 1, end: MAX_TIME }]

Example 3: Permanently Locking Permissions

Scenario: Continuing from Example 2, the manager wants to permanently lock the permission.

Final state:

Permission:
permanentlyPermittedTimes: []
permanentlyForbiddenTimes: [{ start: 1, end: MAX_TIME }]
timelineTimes: [{ start: 1, end: MAX_TIME }]

Archived Timeline:
isArchived: true for [{ start: 1, end: MAX_TIME }]

Best Practices

  1. Clear Timelines: Always define clear and non-overlapping time ranges for each field to avoid confusion and conflicts.

  2. Permission Management: Carefully consider the implications of setting permanentlyPermittedTimes and permanentlyForbiddenTimes, as these can significantly impact the flexibility of your collection.

  3. Timeline Planning: When using timelineTimes, plan your collection's lifecycle in advance to minimize the need for frequent updates.

  4. Transfer Windows: Use transferTimes to create specific windows for badge transfers, which can be useful for time-limited events or phased distributions.

  5. Ownership Tracking: Leverage ownershipTimes to create badges with time-bound ownership, useful for temporary privileges or rotating responsibilities.

  6. Permission Locking: Be cautious when permanently locking permissions (as in Example 3), as this action is irreversible and may limit future flexibility.

  7. Time Synchronization: Ensure all systems interacting with your BitBadges collection are properly time-synchronized to avoid discrepancies in time-based operations.

By understanding and effectively using these time fields, you can create sophisticated and dynamic badge systems in BitBadges, enabling complex scenarios from voting systems to time-bound privileges and beyond.

PreviousTimelinesNextList IDs

Last updated 8 months ago

โŒจ๏ธ
๐ŸŒŸ