Crates.io | bittensor-wallet |
lib.rs | bittensor-wallet |
version | 0.1.0 |
source | src |
created_at | 2024-08-19 18:33:17.88374 |
updated_at | 2024-08-19 18:33:17.88374 |
description | A wallet implementation for the Bittensor network |
homepage | |
repository | https://github.com/distributedstatemachine/bittensor-rs |
max_upload_size | |
id | 1344319 |
size | 253,318 |
Bittensor Wallet is a Rust crate that provides wallet functionality for the Bittensor network. It includes features for managing wallets, keypairs, and integrates with Python through PyO3 bindings.
The crate is structured into several key components:
Key files:
src/wallet.rs
: Contains the Wallet
struct and its implementations.src/keypair.rs
: Implements the Keypair
struct for cryptographic operations.src/errors.rs
: Defines custom error types.src/python_bindings.rs
: Implements Python bindings using PyO3.This project uses Maturin to build and manage Python bindings. To use the Bittensor Wallet in Python:
Install Maturin:
pip install maturin
Build the Python module:
maturin develop
In your Python code:
import bittensor_wallet
# Create a new wallet
wallet = bittensor_wallet.PyWallet("my_wallet", "/path/to/wallet")
# Create a new wallet with a mnemonic
wallet.create_new_wallet(12, "my_password")
# Create a new hotkey
wallet.create_new_hotkey("my_hotkey", "my_password")
# Get the coldkey
coldkey = wallet.get_coldkey("my_password")
# Get a hotkey
hotkey = wallet.get_hotkey("my_hotkey", "my_password")
# Sign a message
message = b"Hello, Bittensor!"
signature = hotkey.sign(message, "my_password")
To build the crate:
cargo build
To run tests:
cargo test
This crate relies on several key dependencies:
pyo3
: For Python bindingssp-core
and sp-runtime
: For Substrate-based cryptographyaes-gcm
and argon2
: For encryption and key derivationbip39
: For mnemonic generation and handlingFor a full list of dependencies, please refer to the Cargo.toml
file.