Metadata-Version: 2.4
Name: aiblock
Version: 0.2.2
Summary: Python SDK for interacting with the AIBlock blockchain
Author-email: AIBlock Team <team@aiblock.dev>
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.
        
Project-URL: Homepage, https://github.com/AIBlockOfficial/2Way.py
Project-URL: Documentation, https://github.com/AIBlockOfficial/2Way.py/tree/main/docs
Project-URL: Bug Tracker, https://github.com/AIBlockOfficial/2Way.py/issues
Keywords: blockchain,aiblock,cryptocurrency
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Security :: Cryptography
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.25.1
Requires-Dist: pynacl>=1.4.0
Requires-Dist: mnemonic>=0.20
Requires-Dist: typing-extensions>=4.0.0
Requires-Dist: base58>=2.1.1
Requires-Dist: python-dotenv>=1.0.0
Dynamic: license-file

# 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-sdk
```

## Quick Start

### Configuration Setup

The SDK uses environment variables for configuration:

```bash
# Required environment variables
export AIBLOCK_PASSPHRASE="your-secure-passphrase"

# Optional environment variables (defaults shown)
export AIBLOCK_STORAGE_HOST="https://storage.aiblock.dev"
export AIBLOCK_MEMPOOL_HOST="https://mempool.aiblock.dev"
export AIBLOCK_VALENCE_HOST="https://valence.aiblock.dev"
```

### Basic Usage

```python
from aiblock.wallet import Wallet
from aiblock.blockchain import BlockchainClient
from aiblock.config import get_config, validate_env_config

# Get and validate configuration
config = get_config()
error = validate_env_config(config)
if error:
    print(f"Configuration error: {error}")
    return

# Initialize blockchain client
blockchain_client = BlockchainClient(
    storage_host=config['storageHost'],
    mempool_host=config['mempoolHost']
)

# Create and initialize wallet
wallet = Wallet()
seed_phrase = wallet.generate_seed_phrase()
keypair = wallet.generate_keypair()

# Query blockchain
latest_block = blockchain_client.get_latest_block()
total_supply = blockchain_client.get_total_supply()
issued_supply = blockchain_client.get_issued_supply()
balance = blockchain_client.get_balance(keypair['address'])
```

## Features

### Wallet Operations
- Generate and manage seed phrases
- Create and manage keypairs
- Create and sign transactions
- Create item assets
- Check balances

### Blockchain Operations
- Query latest block
- Get block by number
- Get blockchain entry by hash
- Get total supply
- Get issued supply
- Get balance for address

## Example Usage

See `try_sdk.py` for a complete example of using the SDK, including:
- Wallet initialization
- Keypair generation
- Blockchain queries
- Asset creation
- Transaction creation

## Development

1. Clone the repository
2. Install dependencies: `pip install -r requirements.txt`
3. Install test dependencies: `pip install -r requirements-test.txt`
4. Run tests: `pytest`

## Contributing

We welcome contributions! Please feel free to submit a Pull Request.

## License

MIT License
