Skip to main content

GraphSense API

Project description

graphsense-python

GraphSense API provides programmatic access to various ledgers' addresses, entities, blocks, transactions and tags for automated and highly efficient forensics tasks.

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 1.15.5
  • Package version: 1.15.5
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python >= 3.6

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/graphsense/graphsense-REST.git#subdirectory=clients/python

Then import the package:

import graphsense

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import graphsense

Getting Started

Please follow the installation procedure and then run the following:

import time
import graphsense
from pprint import pprint
from graphsense.api import addresses_api
from graphsense.model.address import Address
from graphsense.model.address_tags import AddressTags
from graphsense.model.address_txs import AddressTxs
from graphsense.model.entity import Entity
from graphsense.model.height import Height
from graphsense.model.links import Links
from graphsense.model.neighbor_addresses import NeighborAddresses
from graphsense.model.related_addresses import RelatedAddresses
from graphsense.model.tag_summary import TagSummary
# Defining the host is optional and defaults to https://api.ikna.io
# See configuration.py for a list of all supported configuration parameters.
configuration = graphsense.Configuration(
    host = "https://api.ikna.io"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: api_key
configuration.api_key['api_key'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api_key'] = 'Bearer'


# Enter a context with an instance of the API client
with graphsense.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = addresses_api.AddressesApi(api_client)
    currency = "btc" # str | The cryptocurrency code (e.g., btc)
    address = "1Archive1n2C579dMsAu3iC6tWzuQJz8dN" # str | The cryptocurrency address
    include_actors = True # bool | Whether to include information about the actor behind the address (optional) (default to True)

    try:
        # Get an address
        api_response = api_instance.get_address(currency, address, include_actors=include_actors)
        pprint(api_response)
    except graphsense.ApiException as e:
        print("Exception when calling AddressesApi->get_address: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://api.ikna.io

Class Method HTTP request Description
AddressesApi get_address GET /{currency}/addresses/{address} Get an address
AddressesApi get_address_entity GET /{currency}/addresses/{address}/entity Get the entity of an address
AddressesApi get_tag_summary_by_address GET /{currency}/addresses/{address}/tag_summary Get attribution tag summary for a given address
AddressesApi list_address_links GET /{currency}/addresses/{address}/links Get outgoing transactions between two addresses
AddressesApi list_address_neighbors GET /{currency}/addresses/{address}/neighbors Get an address's neighbors in the address graph
AddressesApi list_address_txs GET /{currency}/addresses/{address}/txs Get all transactions an address has been involved in
AddressesApi list_related_addresses GET /{currency}/addresses/{address}/related_addresses Get related addresses to the input address
AddressesApi list_tags_by_address GET /{currency}/addresses/{address}/tags Get attribution tags for a given address
BlocksApi get_block GET /{currency}/blocks/{height} Get a block by its height
BlocksApi get_block_by_date GET /{currency}/block_by_date/{date} Get the closest blocks given a timestamp
BlocksApi list_block_txs GET /{currency}/blocks/{height}/txs Get block transactions
BulkApi bulk_csv POST /{currency}/bulk.csv/{operation} Get data as CSV in bulk
BulkApi bulk_json POST /{currency}/bulk.json/{operation} Get data as JSON in bulk
EntitiesApi get_entity GET /{currency}/entities/{entity} Get an entity
EntitiesApi list_address_tags_by_entity GET /{currency}/entities/{entity}/tags Get address tags for a given entity
EntitiesApi list_entity_addresses GET /{currency}/entities/{entity}/addresses Get an entity's addresses
EntitiesApi list_entity_links GET /{currency}/entities/{entity}/links Get transactions between two entities
EntitiesApi list_entity_neighbors GET /{currency}/entities/{entity}/neighbors Get an entity's direct neighbors
EntitiesApi list_entity_txs GET /{currency}/entities/{entity}/txs Get all transactions an entity has been involved in
EntitiesApi search_entity_neighbors GET /{currency}/entities/{entity}/search Search deeply for matching neighbors
GeneralApi get_statistics GET /stats Get statistics of supported currencies
GeneralApi search GET /search Returns matching addresses, transactions and labels
RatesApi get_exchange_rates GET /{currency}/rates/{height} Returns exchange rate for a given height
TagsApi get_actor GET /tags/actors/{actor} Returns an actor given its unique id or (unique) label
TagsApi get_actor_tags GET /tags/actors/{actor}/tags Returns the address tags for a given actor
TagsApi list_address_tags GET /tags Returns address tags associated with a given label
TagsApi list_concepts GET /tags/taxonomies/{taxonomy}/concepts Returns the supported concepts of a taxonomy
TagsApi list_taxonomies GET /tags/taxonomies Returns the supported taxonomies
TagsApi report_tag POST /tags/report-tag Users can use this endpoint to report a missing annotation.
TokensApi list_supported_tokens GET /{currency}/supported_tokens Returns a list of supported token (sub)currencies
TxsApi get_spending_txs GET /{currency}/txs/{tx_hash}/spending Returns in which other transaction's outputs the asked transaction spent. Think backwards references is the transaction graph. This endpoint is only available for utxo like currencies.
TxsApi get_spent_in_txs GET /{currency}/txs/{tx_hash}/spent_in Returns in which other transactions, outputs from the asked transaction are spent. Think forward references in the transaction graph. This endpoint is only available for utxo like currencies.
TxsApi get_tx GET /{currency}/txs/{tx_hash} Returns details of a specific transaction identified by its hash
TxsApi get_tx_conversions GET /{currency}/txs/{tx_hash}/conversions Returns conversion information (swaps or bridging txs) extracted from a specific transaction
TxsApi get_tx_io GET /{currency}/txs/{tx_hash}/{io} Returns input/output values of a specific transaction identified by its hash
TxsApi list_token_txs GET /{currency}/token_txs/{tx_hash} Returns all token transactions in a given transaction
TxsApi list_tx_flows GET /{currency}/txs/{tx_hash}/flows Returns all asset flows / Internal txs and token flows within a given transaction

Documentation For Models

Documentation For Authorization

api_key

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Examples

In ./examples you can find example Python scripts and Jupyter notebooks demonstrating how to use the GraphSense Python API. Please Follow these setup instructions to run them:

Setup a Python environment with Anaconda:

conda env create -f environment.yml
conda activate graphsense-python

Copy the config temp file and enter your Iknaio API key

cp config.json.tmp config.json
vi config.json

Run the jupyter notebooks

jupyter notebook

Generation from OpenAPI specification

This python package has been generated from Graphsense's OpenAPI specification hosted by Iknaio Cryptoasset Analytics GmbH using this command:

make generate-openapi-client

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

graphsense_python-1.15.5.tar.gz (80.0 kB view details)

Uploaded Source

Built Distribution

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

graphsense_python-1.15.5-py3-none-any.whl (233.3 kB view details)

Uploaded Python 3

File details

Details for the file graphsense_python-1.15.5.tar.gz.

File metadata

  • Download URL: graphsense_python-1.15.5.tar.gz
  • Upload date:
  • Size: 80.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for graphsense_python-1.15.5.tar.gz
Algorithm Hash digest
SHA256 1edbd7dd29fb4928815a34c2a37649e7e6b3522e35490644f2b7c92f8e579868
MD5 5f7030bb0a8fe8669d8b07d3b0c86d99
BLAKE2b-256 588a92757445cb63f3343d9aefc260ce39f8c5b9d89908747c5e5739ad4dc1ee

See more details on using hashes here.

File details

Details for the file graphsense_python-1.15.5-py3-none-any.whl.

File metadata

  • Download URL: graphsense_python-1.15.5-py3-none-any.whl
  • Upload date:
  • Size: 233.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for graphsense_python-1.15.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0c301775ad8a3364e199079d6b0cc17e16f913901e21c167d36b6a84bb8c3ce1
MD5 aeba39db7a84fb442827100ad97c1d7d
BLAKE2b-256 cb8807089beca088c583fed2e1d12094839aad49c99da17abcc19db23baf8b62

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