| Crates.io | ant-node |
| lib.rs | ant-node |
| version | 0.4.4 |
| created_at | 2024-12-18 14:13:53.192926+00 |
| updated_at | 2025-09-03 17:17:12.247796+00 |
| description | The Autonomi node binary |
| homepage | https://maidsafe.net |
| repository | https://github.com/maidsafe/autonomi |
| max_upload_size | |
| id | 1487728 |
| size | 1,042,434 |
The ant-node directory provides the antnode binary and Python bindings for the Safe Network node implementation. This directory contains the core logic for node operations, including API definitions, error handling, event management, and data validation.
Follow the main project's installation guide to set up the antnode binary.
To install the Python bindings, you'll need:
pip install maturin)Install the package using:
maturin develop
To run the antnode binary, follow the instructions in the main project's usage guide.
The Python module provides a comprehensive interface to run and manage Safe Network nodes. Here's a complete overview:
from antnode import AntNode
# Create and start a node
node = AntNode()
node.run(
rewards_address="0x1234567890123456789012345678901234567890", # Your EVM wallet address
evm_network="arbitrum_sepolia", # or "arbitrum_one" for mainnet
ip="0.0.0.0",
port=12000,
initial_peers=[
"/ip4/142.93.37.4/udp/40184/quic-v1/p2p/12D3KooWPC8q7QGZsmuTtCYxZ2s3FPXPZcS8LVKkayXkVFkqDEQB",
],
local=False,
root_dir=None, # Uses default directory
relay=False
)
Node Information:
peer_id(): Get the node's peer IDget_rewards_address(): Get current rewards/wallet addressset_rewards_address(address: str): Set new rewards address (requires restart)get_kbuckets(): Get routing table informationget_all_record_addresses(): Get all stored record addressesStorage Operations:
store_record(key: str, value: bytes, record_type: str): Store data
key: Hex stringvalue: Bytes to storerecord_type: "chunk" or "scratchpad"get_record(key: str) -> Optional[bytes]: Retrieve stored datadelete_record(key: str) -> bool: Delete stored dataget_stored_records_size() -> int: Get total size of stored dataDirectory Management:
get_root_dir() -> str: Get current root directory pathget_default_root_dir(peer_id: Optional[str]) -> str: Get default root directoryget_logs_dir() -> str: Get logs directory pathget_data_dir() -> str: Get data storage directory path# Get various directory paths
root_dir = node.get_root_dir()
logs_dir = node.get_logs_dir()
data_dir = node.get_data_dir()
# Get default directory for a specific peer
default_dir = AntNode.get_default_root_dir(peer_id)
src/: Source code files
api.rs: API definitionserror.rs: Error types and handlingevent.rs: Event-related logicget_validation.rs: Validation for GET requestsput_validation.rs: Validation for PUT requestsreplication.rs: Data replication logictests/: Test files
common/mod.rs: Common utilities for testsdata_with_churn.rs: Tests related to data with churnsequential_transfers.rs: Tests for sequential data transfersstorage_payments.rs: Tests related to storage paymentsverify_data_location.rs: Tests for verifying data locationsTo run tests, navigate to the ant-node directory and execute:
cargo test
Please feel free to clone and modify this project. Pull requests are welcome.
We follow the Conventional Commits specification for all commits. Make sure your commit messages adhere to this standard.
This Autonomi Network repository is licensed under the General Public License (GPL), version 3 (LICENSE).