Name | aiblock JSON |
Version |
0.2.9
JSON |
| download |
home_page | None |
Summary | Python SDK for interacting with the AIBlock blockchain |
upload_time | 2025-10-07 06:43:44 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT License
Copyright (c) 2024 AI3lock
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
|
keywords |
blockchain
aiblock
cryptocurrency
|
VCS |
 |
bugtrack_url |
|
requirements |
requests
pynacl
mnemonic
typing-extensions
base58
python-dotenv
bip32utils
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# AIBlock Python SDK
Python SDK for interacting with the AIBlock blockchain. This SDK provides a simple interface for wallet operations and blockchain queries.
## Installation
```bash
pip install aiblock
```
## Quick Start
### Basic Blockchain Queries
```python
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()
```
### Wallet Operations
```python
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)
```
## Features
### Blockchain Client
- **get_latest_block()** - Get the latest block information
- **get_block_by_num(block_num)** - Get a specific block by number
- **get_blockchain_entry(hash)** - Get blockchain entry by hash
- **get_transaction_by_hash(tx_hash)** - Get transaction details
- **fetch_transactions(tx_hashes)** - Get multiple transactions
- **get_total_supply()** - Get total token supply
- **get_issued_supply()** - Get issued token supply
### Wallet Operations
- Generate and manage seed phrases
- Create and manage keypairs
- Create and sign transactions
- Create item assets
- Check balances
- 2WayPayment protocol support
## Configuration
The SDK uses environment variables for configuration. Create a `.env` file:
```bash
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"
```
## Error Handling
All methods return `IResult` objects with proper error handling:
```python
result = client.get_latest_block()
if result.is_ok:
data = result.get_ok()
print(f"Success: {data}")
else:
print(result.error, result.error_message)
```
## Development
1. Clone the repository
2. Install uv (https://docs.astral.sh/uv/)
3. Run tests: `uv pip install -q pytest requests-mock && uv run pytest -q`
All 68 tests pass, ensuring reliability and compatibility.
## Documentation
- [API Reference](docs/api-reference.md) - Complete API documentation
- [Examples](docs/examples.md) - Usage examples and patterns
- [Troubleshooting](docs/troubleshooting.md) - Common issues and solutions
## Contributing
We welcome contributions! Please feel free to submit a Pull Request.
## License
MIT License
Raw data
{
"_id": null,
"home_page": null,
"name": "aiblock",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "blockchain, aiblock, cryptocurrency",
"author": null,
"author_email": "AIBlock Team <team@aiblock.dev>",
"download_url": "https://files.pythonhosted.org/packages/7b/58/88ab806650fb1aae09aa316f882a05a22b9ca1d3d406055a81582fb6552b/aiblock-0.2.9.tar.gz",
"platform": null,
"description": "# AIBlock Python SDK\n\nPython SDK for interacting with the AIBlock blockchain. This SDK provides a simple interface for wallet operations and blockchain queries.\n\n## Installation\n\n```bash\npip install aiblock\n```\n\n## Quick Start\n\n### Basic Blockchain Queries\n\n```python\nfrom aiblock.blockchain import BlockchainClient\n\n# Initialize blockchain client\nclient = BlockchainClient(\n storage_host='https://storage.aiblock.dev',\n mempool_host='https://mempool.aiblock.dev'\n)\n\n# Query blockchain\nlatest_block = client.get_latest_block()\nif latest_block.is_ok:\n print(f\"Latest block: {latest_block.get_ok()['content']['block_num']}\")\n\n# Get specific block by number\nblock = client.get_block_by_num(1)\nif block.is_ok:\n print(f\"Block 1: {block.get_ok()['content']}\")\n\n# Get blockchain entry by hash\nentry = client.get_blockchain_entry('some_hash')\n\n# Get transaction by hash\ntransaction = client.get_transaction_by_hash('tx_hash')\n\n# Get multiple transactions\ntransactions = client.fetch_transactions(['hash1', 'hash2'])\n\n# Get supply information (requires mempool host)\ntotal_supply = client.get_total_supply()\nissued_supply = client.get_issued_supply()\n```\n\n### Wallet Operations\n\n```python\nfrom aiblock.wallet import Wallet\n\n# Create wallet\nwallet = Wallet()\n\n# Generate seed phrase\nseed_phrase = wallet.generate_seed_phrase()\nprint(f\"Seed phrase: {seed_phrase}\")\n\n# Initialize wallet from seed\nconfig = {\n 'passphrase': 'your-secure-passphrase',\n 'mempoolHost': 'https://mempool.aiblock.dev',\n 'storageHost': 'https://storage.aiblock.dev',\n 'valenceHost': 'https://valence.aiblock.dev'\n}\n\nresult = wallet.from_seed(seed_phrase, config)\nif result.is_ok:\n print(f\"Wallet address: {wallet.get_address()}\")\nelse:\n print(result.error, result.error_message)\n```\n\n## Features\n\n### Blockchain Client\n- **get_latest_block()** - Get the latest block information\n- **get_block_by_num(block_num)** - Get a specific block by number\n- **get_blockchain_entry(hash)** - Get blockchain entry by hash\n- **get_transaction_by_hash(tx_hash)** - Get transaction details\n- **fetch_transactions(tx_hashes)** - Get multiple transactions\n- **get_total_supply()** - Get total token supply\n- **get_issued_supply()** - Get issued token supply\n\n### Wallet Operations\n- Generate and manage seed phrases\n- Create and manage keypairs\n- Create and sign transactions\n- Create item assets\n- Check balances\n- 2WayPayment protocol support\n\n## Configuration\n\nThe SDK uses environment variables for configuration. Create a `.env` file:\n\n```bash\nAIBLOCK_PASSPHRASE=\"your-secure-passphrase\"\nAIBLOCK_STORAGE_HOST=\"https://storage.aiblock.dev\"\nAIBLOCK_MEMPOOL_HOST=\"https://mempool.aiblock.dev\"\nAIBLOCK_VALENCE_HOST=\"https://valence.aiblock.dev\"\n```\n\n## Error Handling\n\nAll methods return `IResult` objects with proper error handling:\n\n```python\nresult = client.get_latest_block()\nif result.is_ok:\n data = result.get_ok()\n print(f\"Success: {data}\")\nelse:\n print(result.error, result.error_message)\n```\n\n## Development\n\n1. Clone the repository\n2. Install uv (https://docs.astral.sh/uv/)\n3. Run tests: `uv pip install -q pytest requests-mock && uv run pytest -q`\n\nAll 68 tests pass, ensuring reliability and compatibility.\n\n## Documentation\n\n- [API Reference](docs/api-reference.md) - Complete API documentation\n- [Examples](docs/examples.md) - Usage examples and patterns\n- [Troubleshooting](docs/troubleshooting.md) - Common issues and solutions\n\n## Contributing\n\nWe welcome contributions! Please feel free to submit a Pull Request.\n\n## License\n\nMIT License\n",
"bugtrack_url": null,
"license": "MIT License\n \n Copyright (c) 2024 AI3lock\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n ",
"summary": "Python SDK for interacting with the AIBlock blockchain",
"version": "0.2.9",
"project_urls": {
"Bug Tracker": "https://github.com/AIBlockOfficial/2Way.py/issues",
"Documentation": "https://github.com/AIBlockOfficial/2Way.py/tree/main/docs",
"Homepage": "https://github.com/AIBlockOfficial/2Way.py"
},
"split_keywords": [
"blockchain",
" aiblock",
" cryptocurrency"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "cbf89bada0eb8526290622810ec1bd109af0e53e866162f5d496a633c30d2bb2",
"md5": "d395de264f133227b0232cb458a6fda2",
"sha256": "18a4c08835b59435e56d4efff006ed4f4478cfb7374e12e72c2d6cc1137fd90e"
},
"downloads": -1,
"filename": "aiblock-0.2.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d395de264f133227b0232cb458a6fda2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 33058,
"upload_time": "2025-10-07T06:43:43",
"upload_time_iso_8601": "2025-10-07T06:43:43.065789Z",
"url": "https://files.pythonhosted.org/packages/cb/f8/9bada0eb8526290622810ec1bd109af0e53e866162f5d496a633c30d2bb2/aiblock-0.2.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "7b5888ab806650fb1aae09aa316f882a05a22b9ca1d3d406055a81582fb6552b",
"md5": "07de8175e6b130a4baa4a99d76fb5678",
"sha256": "55314bdc83583014934dc0520cab9ea4aea4a6e4fb1e8b6337e1600479fd83bc"
},
"downloads": -1,
"filename": "aiblock-0.2.9.tar.gz",
"has_sig": false,
"md5_digest": "07de8175e6b130a4baa4a99d76fb5678",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 70432,
"upload_time": "2025-10-07T06:43:44",
"upload_time_iso_8601": "2025-10-07T06:43:44.228313Z",
"url": "https://files.pythonhosted.org/packages/7b/58/88ab806650fb1aae09aa316f882a05a22b9ca1d3d406055a81582fb6552b/aiblock-0.2.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-07 06:43:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "AIBlockOfficial",
"github_project": "2Way.py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "requests",
"specs": [
[
">=",
"2.25.1"
]
]
},
{
"name": "pynacl",
"specs": [
[
">=",
"1.4.0"
]
]
},
{
"name": "mnemonic",
"specs": [
[
">=",
"0.20"
]
]
},
{
"name": "typing-extensions",
"specs": [
[
">=",
"4.0.0"
]
]
},
{
"name": "base58",
"specs": [
[
">=",
"2.1.1"
]
]
},
{
"name": "python-dotenv",
"specs": [
[
">=",
"1.0.0"
]
]
},
{
"name": "bip32utils",
"specs": [
[
">=",
"0.3.0"
]
]
}
],
"lcname": "aiblock"
}