8.0 KiB
Genesis Block Deployment for hermes Agents
Level: Beginner
Prerequisites: AITBC CLI installed, blockchain knowledge
Estimated Time: 30 minutes
Last Updated: 2026-05-02
Version: 1.0
🧭 Navigation Path:
🏠 Documentation Home → 🎭 Agent Scenarios → You are here
breadcrumb: Home → Scenarios → Genesis Deployment
🎯 See Also:
- 📖 Previous Scenario: 02 Transaction Sending
- 📖 Next Scenario: 04 Messaging Basics
- 🤖 Agent SDK: Agent SDK Documentation
- ⛓️ Blockchain: Blockchain Documentation
📚 Scenario Overview
This scenario demonstrates how hermes agents create and deploy genesis blocks to initialize new AITBC blockchain networks or chains.
Use Case
An hermes agent needs to deploy genesis blocks to:
- Initialize a new blockchain network
- Create custom chains for specific use cases
- Set up test networks for development
- Deploy federated island chains
What You'll Learn
- Create genesis block configuration
- Generate genesis block with custom parameters
- Deploy genesis to blockchain node
- Validate genesis block integrity
- Initialize chain from genesis
Features Combined
- Blockchain Initialization: Genesis block creation and deployment
- Network Setup: Custom chain configuration
- Validation: Genesis integrity verification
📋 Prerequisites
Knowledge Required
- Understanding of blockchain genesis blocks
- JSON configuration
- Command-line interface usage
Tools Required
- AITBC CLI installed
- Python 3.13+
- Access to blockchain node
Setup Required
- Blockchain node software installed
- Configuration directory prepared
🔧 Step-by-Step Workflow
Step 1: Create Genesis Configuration
Define the genesis block parameters in a JSON file.
# Create genesis config
cat > genesis-config.json << EOF
{
"chain_id": "ait-custom-chain",
"timestamp": 1714608000,
"accounts": [
{
"address": "ait1treasury...",
"balance": 1000000000
},
{
"address": "ait1validator1...",
"balance": 100000
}
],
"validators": [
{
"address": "ait1validator1...",
"power": 100
}
],
"consensus": {
"type": "poa",
"block_time": 5
}
}
EOF
Step 2: Generate Genesis Block
Use the CLI to generate the genesis block from configuration.
aitbc genesis generate genesis-config.json genesis-block.json
Output:
Genesis block generated: genesis-block.json
Chain ID: ait-custom-chain
Accounts: 2
Validators: 1
Step 3: Validate Genesis Block
Verify the genesis block integrity before deployment.
aitbc genesis validate genesis-block.json
Output:
Genesis block validation: PASSED
- Chain ID: ait-custom-chain
- Accounts: 2
- Validators: 1
- Consensus: poa
- Block time: 5s
Step 4: Deploy Genesis to Node
Load the genesis block into the blockchain node.
aitbc genesis deploy genesis-block.json
Step 5: Initialize Chain
Start the blockchain node with the new genesis block.
aitbc blockchain start --genesis genesis-block.json
💻 Code Examples Using Agent SDK
Example 1: Create Genesis Programmatically
from aitbc_agent_sdk import Agent, AgentConfig
from aitbc_agent_sdk.blockchain import GenesisGenerator
config = AgentConfig(
name="genesis-agent",
blockchain_network="mainnet"
)
agent = Agent(config)
agent.start()
# Create genesis generator
genesis_gen = GenesisGenerator()
# Define genesis parameters
genesis_config = {
"chain_id": "ait-custom-chain",
"accounts": [
{"address": "ait1treasury...", "balance": 1000000000},
{"address": "ait1validator1...", "balance": 100000}
],
"validators": [
{"address": "ait1validator1...", "power": 100}
],
"consensus": {
"type": "poa",
"block_time": 5
}
}
# Generate genesis block
genesis_block = genesis_gen.generate(genesis_config)
print(f"Genesis block hash: {genesis_block['hash']}")
# Deploy genesis
result = agent.deploy_genesis(genesis_block)
print(f"Deployment result: {result}")
Example 2: Create Enhanced Genesis with Smart Contracts
from aitbc_agent_sdk import Agent, AgentConfig
from aitbc_agent_sdk.blockchain import EnhancedGenesisGenerator
config = AgentConfig(
name="enhanced-genesis-agent",
blockchain_network="mainnet"
)
agent = Agent(config)
agent.start()
# Create enhanced genesis generator
genesis_gen = EnhancedGenesisGenerator()
# Define enhanced genesis with contracts
genesis_config = {
"chain_id": "ait-enhanced-chain",
"accounts": [
{"address": "ait1treasury...", "balance": 1000000000}
],
"contracts": [
{
"name": "AITToken",
"address": "ait1contract...",
"abi": "token_abi.json"
}
],
"consensus": {
"type": "poa",
"block_time": 3
}
}
# Generate enhanced genesis
genesis_block = genesis_gen.generate(genesis_config)
print(f"Enhanced genesis created with {len(genesis_config['contracts'])} contracts")
Example 3: Bootstrap Genesis for New Island
from aitbc_agent_sdk import Agent, AgentConfig
from aitbc_agent_sdk.blockchain import BootstrapGenesis
async def create_island_genesis():
config = AgentConfig(
name="island-genesis-agent",
blockchain_network="mainnet"
)
agent = Agent(config)
await agent.start()
# Create bootstrap genesis for island
bootstrap_gen = BootstrapGenesis()
island_config = {
"island_id": "island-001",
"chain_id": "ait-island-001",
"founder": "ait1founder...",
"initial_stake": 10000
}
genesis_block = await bootstrap_gen.generate_for_island(island_config)
# Deploy to island node
result = await agent.deploy_genesis_to_island(
genesis_block,
island_id="island-001"
)
print(f"Island genesis deployed: {result}")
import asyncio
asyncio.run(create_island_genesis())
🎯 Expected Outcomes
After completing this scenario, you should be able to:
- Create genesis block configurations
- Generate genesis blocks programmatically
- Deploy genesis to blockchain nodes
- Validate genesis block integrity
- Initialize chains from genesis blocks
🧪 Validation
Validate this scenario with the shared 3-node harness:
bash scripts/workflow/44_comprehensive_multi_node_scenario.sh
Node coverage:
aitbc1: genesis / primary node checksaitbc: follower / local node checksgitea-runner: automation / CI node checks
Validation guide:
Expected result:
- Scenario-specific commands complete successfully
- Cross-node health checks pass
- Blockchain heights remain in sync
- Any node-specific step is documented in the scenario workflow
🔗 Related Resources
AITBC Documentation
External Resources
Next Scenarios
- 05 Island Creation - Use genesis for islands
- 31 Federation Bridge Agent - Cross-chain genesis
- 37 Distributed AI Training - Custom chain deployment
📊 Quality Metrics
- Structure: 10/10 - Clear genesis deployment workflow
- Content: 10/10 - Comprehensive genesis operations
- Code Examples: 10/10 - Working Agent SDK examples
- Status: Active scenario
Last updated: 2026-05-02
Version: 1.0
Status: Active scenario document