XION
DiscordGithub
  • Welcome to XION
  • XION'S Core
    • Concepts
      • Generalized Chain Abstraction
      • Intro to Account Abstraction
      • XION's Meta Accounts
      • Meta Accounts Design
      • Architecture & Tech Glossary
      • Use Cases
  • developers
    • Xion Quick Start
      • Zero to Dapp in 5 Minutes
        • Launch a User Map Dapp on XION in 5 Minutes
        • React Native Mobile Dapp on XION in 5 Minutes
      • Set Up Local Environment
        • Setting up your Local Smart Contract Development Environment for XION
          • Setting up your XION Smart Contract Development Environment on Windows (WSL2 + Ubuntu)
        • Set Up an Integrated Development Environment (IDE)
        • Interacting with Xion Chain using Xion Daemon
      • Your First Contract
        • Deploying Your First Smart Contract on XION
      • Gasless UX & Permission Grants
        • Enabling Gasless Transactions with Treasury Contracts
      • Your First DApp
        • Account Abstraction with Gasless Transactions
        • Interact with XION via your Backend Service
    • Web3 for Web2 Developers
      • Web2 vs Web3 App Architecture: A Comparison
      • Misconceptions and Misapplied Web2 Patterns
      • Recommended Architecture for Dapps on XION
    • Building for Mainnet
      • Xion Testnet: Your Development Playground
      • Building with Audited & Battle-Tested Contracts
      • Community Engagement: Building Support for Your dApp
      • Deploying to Xion Mainnet
        • Smart Contract Audits: Process, Costs & Support
        • Governance Process to Deploying Smart Contracts to Mainnet
    • Learn & Build
      • Token Factory
        • Creating, Minting, and Interacting with a Token Factory Token
        • Building a React dApp to Interact with Token Factory Tokens
        • Integrating a Token Factory Token in a Smart Contract
      • Websockets
        • WebSockets with Xion: Real-Time Communication
      • Mobile Development
        • Building a React Native Mobile App with Abstraxion (Xion.js)
      • Oracles
        • Creating a Smart Contract with Pyth Oracle Integration
      • Indexers: Optimized Data Retrieval
        • SubQuery
      • Use Cases
        • Building a Per-User Data Storage Dapp
    • Reference and Resources
      • Requesting XION Testnet Tokens
      • Public Endpoints & Resources
      • Block Explorers
      • Governance
        • Deploying Smart Contracts to Mainnet
      • Developer Tools: Abstract
      • IBC Denoms on XION Networks
      • Frequently Asked Questions
      • XION Token Contract Addresses on EVM Chains
  • Nodes & Validators
    • Run a Node
      • System Specifications
      • Build the Xion Daemon
      • Download the Xion Daemon
      • Configure the Xion Daemon
        • app.toml
        • client.toml
        • config.toml
      • Join the XION Network
        • xion-testnet-1
      • Confirm node is running
    • Become a Validator
      • Initial Setup
      • Obtain a XION Wallet Address
      • Obtain Funds
        • Testnet
      • Create Validator
    • IBC Relayers and Tokens
  • Others
    • Resources
Powered by GitBook
On this page
  • Names and addresses
  • Addresses
  • Naming

Was this helpful?

Edit on GitHub
  1. developers
  2. Reference and Resources
  3. CosmWasm Resources
  4. Architecture of Multi-Chain Contracts

Names and Addresses

Names and addresses

Blockchains use addresses to identify external actors through a hash of a public key. On-chain addresses are represented using a concise, immutable binary format, typically 20 or 32 bytes long, often derived from a hashing function.

Binary addresses are typically represented in a human-readable format using two common notations: IPv4 and IPv6 addresses. These addresses are used to identify devices on a network. Here are two examples of each:

IPv4 Addresses:

  1. IPv4 Decimal-Dotted Notation: This is the most common way to represent IPv4 addresses. It consists of four decimal numbers separated by periods (dots), where each number can range from 0 to 255. For example: 192.168.1.1

  2. IPv4 CIDR Notation: Classless Inter-Domain Routing (CIDR) notation is used to represent a range of IPv4 addresses using a network address followed by a prefix length. For example, 192.168.1.0/24 represents a range of IP addresses from 192.168.1.0 to 192.168.1.255, with a subnet mask of 255.255.255.0.

IPv6 Addresses:

  1. IPv6 Colon-Hexadecimal Notation: IPv6 addresses are much longer than IPv4 addresses and are represented as eight groups of four hexadecimal digits separated by colons. For example: 2001:0db8:85a3:0000:0000:8a2e:0370:7334

  2. IPv6 Compressed Notation: To make IPv6 addresses more manageable, leading zeros within each group of hexadecimal digits can be omitted, and consecutive groups of zeros can be represented with a double colon (::). For example, 2001:db8::1 represents the same address as 2001:0db8:0000:0000:0000:0000:0000:0001.

These representations allow humans to easily work with and understand IP addresses in various contexts, such as configuring network devices or specifying access control rules.

Addresses

Addresses in the Cosmos SDK are 20-character long strings and include security checks, such as chain-prefix in Bech32, checksums in Bech32, and checksummed hex (EIP55). Since CosmWasm is an extension of the Cosmos SDK, it adheres to the same address rules; wallets, smart contracts, and modules each have an identifier address with a specific prefix.

When providing an address to smart contracts, you can submit it as a string and subsequently validate the input as an Addr. The Addr serves as a wrapper for a plain string, offering valuable utility functions such as address validation through string validation.

There is also a more uncommon representation of an address, called a Canonical Address, which is the binary representation used internally in the blockchain. This representation can be used for all storage lookups, and its format can be converted into multiple types of string addresses.

To better understand Canonical Addresses, we can think about Bitcoin transitioning from Base58 to Bech32 encoding, along with SegWit: once the encoding changes, message.signer would lose access to their own account. Canonical Addresses provide us with a stable identifier to work with.

Naming

We can consider names as a form of address, albeit one that requires a contract query (with storage access) to resolve. It cannot be resolved merely by calling a pure function.

Last updated 1 year ago

Was this helpful?