Skip to main content

Python SDK for interacting with the Open Labels Initiative; A framework for address labels in the blockchain space. Read & write labels into the OLI Label Pool, check your labels for OLI compliance.

Project description

OLI Python Package

Python SDK for interacting with the Open Labels Initiative; A framework for address labels in the blockchain space. Read & write labels into the OLI Label Pool, check your labels for OLI compliance.

Installation

pip install oli-python

Basic Usage

from oli import OLI
import os

# Initialize the client
# Make sure to pull in your private key from an .env file
oli = OLI(private_key=os.environ['private_key'], is_production=True)

# Create an offchain label
address = "0x9438b8B447179740cD97869997a2FCc9b4AA63a2"
chain_id = "eip155:1" # Ethereum
tags = {
    "contract_name": "growthepie donation address",
    "is_eoa": True,
    "owner_project": "growthepie"
}

# Check if your label is OLI compliant
possible_to_attest = oli.check_label_correctness(address, chain_id, tags)
print(f"You can attest your label: {possible_to_attest}")

# Submit a label as an offchain attestation
response = oli.create_offchain_label(address, chain_id, tags)
print(f"Attestation created: {response.text}")

# Submit a label as an onchain attestation
tx_hash, uid = oli.create_onchain_label(address, chain_id, tags)
print(f"Transaction hash: {tx_hash}")
print(f"Attestation UID: {uid}")

# Batch submit multiple labels as one onchain attestation
labels = [
    {'address': address, 'chain_id': chain_id, 'tags': tags},
    {'address': address, 'chain_id': chain_id, 'tags': tags}
]
tx_hash, uids = oli.create_multi_onchain_labels(labels)
print(f"Batch transaction hash: {tx_hash}")
print(f"Attestation UIDs: {uids}")

# Revoke an attestation (revoking onchain attestations here)
trx_hash = oli.revoke_attestation(uid, onchain=True)

# Revoke multiple attestations (revoking onchain attestations here)
trx_hash, count = oli.multi_revoke_attestations(uids, onchain=True)

# Query attestations for a specific address
result = oli.graphql_query_attestations(address=address)
print(result)

# Download parquet export of raw attestations
oli.get_full_raw_export_parquet()

# Download parquet export of decoded attestations
oli.get_full_decoded_export_parquet()

Wallet Requirements

Make sure your wallet contains ETH to pay for onchain attestations (including revocations). Offchain attestations are free.

The OLI Label Pool is deployed on Base mainnet. For testing purposes, you can use Base Sepolia Testnet (set is_production=False).

Features

  • Create onchain (single or batch) and offchain (single) OLI label attestations
  • Revoke attestations (single or batch)
  • Check your label if it is OLI compliant
  • Query attestations using GraphQL
  • Download full dataset exports in Parquet format

Documentation

For more details, see the OLI Documentation.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oli_python-0.1.1.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oli_python-0.1.1-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file oli_python-0.1.1.tar.gz.

File metadata

  • Download URL: oli_python-0.1.1.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for oli_python-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9f259a24c2777876bb7ec342c7c27fbb7dca44e82dd1feb148f0ace0b5738cee
MD5 6f2b8f6e25a93c666c4d6a1efe2a67b1
BLAKE2b-256 f6ba50c9a99199463c6d4981c554395dbd33407ba65be84e54239cec38a01b1a

See more details on using hashes here.

File details

Details for the file oli_python-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: oli_python-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for oli_python-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5a834a0e6a80b9fb34cee537754ee9fdbf80bba85c14b6692b88332051d057e8
MD5 4509732d4f14b274c1242993f75a168c
BLAKE2b-256 2a3e772fe6434bbc47d55b96b0c4b2c62b39110bc0445033262d4766d2c0a0b1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page