```
chore: enhance .gitignore and remove obsolete documentation files - Reorganize .gitignore with categorized sections for better maintainability - Add comprehensive ignore patterns for Python, Node.js, databases, logs, and build artifacts - Add project-specific ignore rules for coordinator, explorer, and deployment files - Remove outdated documentation: BITCOIN-WALLET-SETUP.md, LOCAL_ASSETS_SUMMARY.md, README-CONTAINER-DEPLOYMENT.md, README-DOMAIN-DEPLOYMENT.md ```
This commit is contained in:
110
apps/blockchain-node/scripts/create_bootstrap_genesis.py
Normal file
110
apps/blockchain-node/scripts/create_bootstrap_genesis.py
Normal file
@@ -0,0 +1,110 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Generate a genesis file with initial distribution for the exchange economy."""
|
||||
|
||||
import json
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
# Genesis configuration with initial token distribution
|
||||
GENESIS_CONFIG = {
|
||||
"chain_id": "ait-mainnet",
|
||||
"timestamp": None, # populated at runtime
|
||||
"params": {
|
||||
"mint_per_unit": 1000,
|
||||
"coordinator_ratio": 0.05,
|
||||
"base_fee": 10,
|
||||
"fee_per_byte": 1,
|
||||
},
|
||||
"accounts": [
|
||||
# Exchange Treasury - 10 million AITBC for liquidity
|
||||
{
|
||||
"address": "aitbcexchange00000000000000000000000000000000",
|
||||
"balance": 10_000_000_000_000, # 10 million AITBC (in smallest units)
|
||||
"nonce": 0,
|
||||
},
|
||||
# Community Faucet - 1 million AITBC for airdrop
|
||||
{
|
||||
"address": "aitbcfaucet0000000000000000000000000000000000",
|
||||
"balance": 1_000_000_000_000, # 1 million AITBC
|
||||
"nonce": 0,
|
||||
},
|
||||
# Team/Dev Fund - 2 million AITBC
|
||||
{
|
||||
"address": "aitbcteamfund00000000000000000000000000000000",
|
||||
"balance": 2_000_000_000_000, # 2 million AITBC
|
||||
"nonce": 0,
|
||||
},
|
||||
# Early Investor Fund - 5 million AITBC
|
||||
{
|
||||
"address": "aitbcearlyinvest000000000000000000000000000000",
|
||||
"balance": 5_000_000_000_000, # 5 million AITBC
|
||||
"nonce": 0,
|
||||
},
|
||||
# Ecosystem Fund - 3 million AITBC
|
||||
{
|
||||
"address": "aitbecosystem000000000000000000000000000000000",
|
||||
"balance": 3_000_000_000_000, # 3 million AITBC
|
||||
"nonce": 0,
|
||||
}
|
||||
],
|
||||
"authorities": [
|
||||
{
|
||||
"address": "aitbcvalidator00000000000000000000000000000000",
|
||||
"weight": 1,
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
def create_genesis_with_bootstrap():
|
||||
"""Create genesis file with initial token distribution"""
|
||||
|
||||
# Set timestamp
|
||||
GENESIS_CONFIG["timestamp"] = int(time.time())
|
||||
|
||||
# Calculate total initial distribution
|
||||
total_supply = sum(account["balance"] for account in GENESIS_CONFIG["accounts"])
|
||||
|
||||
print("=" * 60)
|
||||
print("AITBC GENESIS BOOTSTRAP DISTRIBUTION")
|
||||
print("=" * 60)
|
||||
print(f"Total Initial Supply: {total_supply / 1_000_000:,.0f} AITBC")
|
||||
print("\nInitial Distribution:")
|
||||
|
||||
for account in GENESIS_CONFIG["accounts"]:
|
||||
balance_aitbc = account["balance"] / 1_000_000
|
||||
percent = (balance_aitbc / 21_000_000) * 100
|
||||
print(f" {account['address']}: {balance_aitbc:,.0f} AITBC ({percent:.1f}%)")
|
||||
|
||||
print("\nPurpose of Funds:")
|
||||
print(" - Exchange Treasury: Provides liquidity for trading")
|
||||
print(" - Community Faucet: Airdrop to early users")
|
||||
print(" - Team Fund: Development incentives")
|
||||
print(" - Early Investors: Initial backers")
|
||||
print(" - Ecosystem Fund: Partnerships and growth")
|
||||
print("=" * 60)
|
||||
|
||||
return GENESIS_CONFIG
|
||||
|
||||
def write_genesis_file(genesis_data, output_path="data/genesis_with_bootstrap.json"):
|
||||
"""Write genesis to file"""
|
||||
path = Path(output_path)
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
with open(path, 'w') as f:
|
||||
json.dump(genesis_data, f, indent=2, sort_keys=True)
|
||||
|
||||
print(f"\nGenesis file written to: {path}")
|
||||
return path
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Create genesis with bootstrap distribution
|
||||
genesis = create_genesis_with_bootstrap()
|
||||
|
||||
# Write to file
|
||||
genesis_path = write_genesis_file(genesis)
|
||||
|
||||
print("\nTo apply this genesis:")
|
||||
print("1. Stop the blockchain node")
|
||||
print("2. Replace the genesis.json file")
|
||||
print("3. Reset the blockchain database")
|
||||
print("4. Restart the node")
|
||||
56
apps/blockchain-node/scripts/load_genesis.py
Normal file
56
apps/blockchain-node/scripts/load_genesis.py
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Load genesis accounts into the blockchain database"""
|
||||
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# Add the src directory to the path
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
|
||||
|
||||
from aitbc_chain.database import session_scope
|
||||
from aitbc_chain.models import Account
|
||||
|
||||
def load_genesis_accounts(genesis_path: str = "data/devnet/genesis.json"):
|
||||
"""Load accounts from genesis file into database"""
|
||||
|
||||
# Read genesis file
|
||||
genesis_file = Path(genesis_path)
|
||||
if not genesis_file.exists():
|
||||
print(f"Error: Genesis file not found at {genesis_path}")
|
||||
return False
|
||||
|
||||
with open(genesis_file) as f:
|
||||
genesis = json.load(f)
|
||||
|
||||
# Load accounts
|
||||
with session_scope() as session:
|
||||
for account_data in genesis.get("accounts", []):
|
||||
address = account_data["address"]
|
||||
balance = account_data["balance"]
|
||||
nonce = account_data.get("nonce", 0)
|
||||
|
||||
# Check if account already exists
|
||||
existing = session.query(Account).filter_by(address=address).first()
|
||||
if existing:
|
||||
existing.balance = balance
|
||||
existing.nonce = nonce
|
||||
print(f"Updated account {address}: balance={balance}")
|
||||
else:
|
||||
account = Account(address=address, balance=balance, nonce=nonce)
|
||||
session.add(account)
|
||||
print(f"Created account {address}: balance={balance}")
|
||||
|
||||
session.commit()
|
||||
|
||||
print("\nGenesis accounts loaded successfully!")
|
||||
return True
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) > 1:
|
||||
genesis_path = sys.argv[1]
|
||||
else:
|
||||
genesis_path = "data/devnet/genesis.json"
|
||||
|
||||
success = load_genesis_accounts(genesis_path)
|
||||
sys.exit(0 if success else 1)
|
||||
Reference in New Issue
Block a user