Factom Protocol Docs
  • Welcome Developers
  • Protocol Overview
  • Getting Started
    • Installing Factom
    • Developer Sandbox
    • Hello-World Examples
      • Golang
      • JavaScript
      • Python
    • API Reference
      • Factomd
      • Factom-walletd
      • Debug
    • CLI Reference
      • Run Factom Federation
      • Common Tasks
      • Factom CLI Commands
    • Data Structures
      • Building blocks
      • User elements
      • Block types
    • SDKs
      • Open Source SDKs
      • Commercial SDKs
    • Testnet
      • Installation
      • Node monitoring
      • Maintenance
      • Interacting with Factom blockchain
      • Faucet
      • Frequently Asked Questions (FAQ)
      • Useful links
  • Infrastructure
    • Control Panel
    • Explorer
      • Overview
      • Block types
      • Usage
    • Open Node
  • Technologies
    • FAT Tokenization
    • Voting Protocols
  • Protocol development
    • Factom Improvement Proposals
    • Hacking Factom
  • Wallets
    • Ledger Nano S Wallet
    • Enterprise Wallet
      • Install
      • Create FCT Address
      • Send and Receive FCT
      • Backup Wallet
      • Restore From a Backup Seed
      • Importing/Exporting your private key(s)
      • Select Your Factomd Node
      • Upgrade to a Secure Wallet
    • FAT Wallet
    • MyFactomWallet
    • Paper Wallet
  • Authority Node Operators
    • ANO Guides & Tutorials
      • Getting started
      • Generating your server identity
      • Setting the coinbase address and node efficiency
      • Joining the docker swarm
      • Securing your node with SSH and iptables
      • Updating and brainswapping your node
    • ANO Tools and Resources
Powered by GitBook
On this page
  • Chain Name
  • ChainID

Was this helpful?

  1. Getting Started
  2. Data Structures

Building blocks

This describes the low level minutia for common data structures.

Chain Name

A Chain Name is a value to uniquely identify a Chain. It can be a random number, a string of text, a public key, or hash of some private directory path. The choice of Chain Name is left up to the user. The Chain Name can be specified with multiple sequential byte strings. They are treated as different segments of data instead of concatenated, to differentiate trailing bytes of one segment from leading bytes of the next segment.

The individual segment length are limited by how many bytes can fit in an Entry (approx 10 KiB). Each Chain Name element must be at least 1 byte long. A Chain Name with no elements is a special case where the ChainID is the hash of a null string:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.

ChainID

A ChainID is a series of SHA256 hashes of Chain Name segments. The ChainID is 32 bytes long. The ChainID must be the hash of something to only have opaque data in the higher level block structures.

The algorithm hashes each segment of the Chain Name. Those hashes are concatenated, and are hashed again into a single 32 byte value.

Getting a ChainID from a single segment Chain Name would be equivalent of hashing the Chain Name twice.

ChainID=SHA256(SHA256(Name[0])∣SHA256(Name[1])∣...∣SHA256(Name[X]))ChainID = SHA256( SHA256(Name[0]) | SHA256(Name[1]) | ... | SHA256(Name[X]) ) ChainID=SHA256(SHA256(Name[0])∣SHA256(Name[1])∣...∣SHA256(Name[X]))

The result of the SHA256 for each name should be concat as a byte array rather than hex!

PreviousData StructuresNextUser elements

Last updated 5 years ago

Was this helpful?