Observed since 21 Oct, 10:01 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Python SDK for interacting with the AIBlock blockchain
Python SDK for interacting with the AIBlock blockchain. This SDK provides a simple interface for wallet operations and blockchain queries.
pip install aiblock
from aiblock.blockchain import BlockchainClient
# Initialize blockchain client
client = BlockchainClient(
storage_host='https://storage.aiblock.dev',
mempool_host='https://mempool.aiblock.dev'
)
# Query blockchain
latest_block = client.get_latest_block()
if latest_block.is_ok:
print(f"Latest block: {latest_block.get_ok()['content']['block_num']}")
# Get specific block by number
block = client.get_block_by_num(1)
if block.is_ok:
print(f"Block 1: {block.get_ok()['content']}")
# Get blockchain entry by hash
entry = client.get_blockchain_entry('some_hash')
# Get transaction by hash
transaction = client.get_transaction_by_hash('tx_hash')
# Get multiple transactions
transactions = client.fetch_transactions(['hash1', 'hash2'])
# Get supply information (requires mempool host)
total_supply = client.get_total_supply()
issued_supply = client.get_issued_supply()
from aiblock.wallet import Wallet
# Create wallet
wallet = Wallet()
# Generate seed phrase
seed_phrase = wallet.generate_seed_phrase()
print(f"Seed phrase: {seed_phrase}")
# Initialize wallet from seed
config = {
'passphrase': 'your-secure-passphrase',
'mempoolHost': 'https://mempool.aiblock.dev',
'storageHost': 'https://storage.aiblock.dev',
'valenceHost': 'https://valence.aiblock.dev'
}
result = wallet.from_seed(seed_phrase, config)
if result.is_ok:
print(f"Wallet address: {wallet.get_address()}")
else:
print(result.error, result.error_message)
The SDK uses environment variables for configuration. Create a .env file:
AIBLOCK_PASSPHRASE="your-secure-passphrase"
AIBLOCK_STORAGE_HOST="https://storage.aiblock.dev"
AIBLOCK_MEMPOOL_HOST="https://mempool.aiblock.dev"
AIBLOCK_VALENCE_HOST="https://valence.aiblock.dev"
All methods return IResult objects with proper error handling:
result = client.get_latest_block()
if result.is_ok:
data = result.get_ok()
print(f"Success: {data}")
else:
print(result.error, result.error_message)
uv pip install -q pytest requests-mock && uv run pytest -qAll 68 tests pass, ensuring reliability and compatibility.
We welcome contributions! Please feel free to submit a Pull Request.
MIT License
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.2.9 | 7 Oct 2025 | 7 |
This describes our collected data; it is not a security assessment.
Observed since 21 Oct, 10:01 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:00b0d57153e01d7da4d0cb94030cd489fd80db036d4da5b15dd710a9cf3ba423