Package Documentation

Storm Package: synapse-chainalysis

The following Commands are available from this package. This documentation is generated for version 0.1.0 of the package.

Storm Commands

This package implements the following Storm Commands.

chainalysis.config.add

Add a Synapse-Chainalysis configuration for a Chainalysis product.

The proxy argument can be set to one of the following values:
  true: Use the Cortex configured proxy if set.
  false: Do not use the Cortex configured proxy if set.
  <str>: A proxy URL to use.

Examples:

  // Add a global DS configuration
  chainalysis.config.add ds global_config apikey1234

  // Add a DS configuration for the current user
  chainalysis.config.add ds --scope self my_config apikey5678


Usage: chainalysis.config.add [options] <product> <name> <apikey>

Options:

  --help                      : Display the command usage.
  --ssl-noverify              : Do not perform SSL/TLS verification.
  --proxy <proxy>             : Configure the proxy usage. (default: True)
  --tag-prefix <tag_prefix>   : The tag prefix to use when recording data from Chainalysis. (default: rep.chainalysis)
  --scope <scope>             : Set the scope on the configuration. (default: global, choices: global, self, unscoped)
  --no-check-apikey           : Do not perform API key validation against the Chainalysis API.

Arguments:

  <product>                   : The Chainalysis product the configuration applies to. (choices: ds)
  <name>                      : A unique name for the configuration.
  <apikey>                    : The API key string.

The command is accessible to users with one or more of the following permissions:

  • power-ups.chainalysis.admin

  • power-ups.chainalysis.user

chainalysis.config.del

Delete a Synapse-Chainalysis configuration for a Chainalysis product.

Examples:

  // Delete the "fooconfig" DS configuration
  chainalysis.config.del ds fooconfig


Usage: chainalysis.config.del [options] <product> <name>

Options:

  --help                      : Display the command usage.

Arguments:

  <product>                   : The Chainalysis product the configuration applies to. (choices: ds)
  <name>                      : The name of the configuration.

The command is accessible to users with one or more of the following permissions:

  • power-ups.chainalysis.admin

  • power-ups.chainalysis.user

chainalysis.config.list

Display the list of Synapse-Chainalysis configurations you have access to.

Examples:

  // List configurations across all Chainalysis products
  chainalysis.config.list

  // List configurations for the DS product
  chainalysis.config.list ds


Usage: chainalysis.config.list [options] <product>

Options:

  --help                      : Display the command usage.

Arguments:

  [product]                   : If provided, only list configurations for the given Chainalysis product. (choices: ds)

The command is accessible to users with one or more of the following permissions:

  • power-ups.chainalysis.admin

  • power-ups.chainalysis.user

chainalysis.config.migrate

Migrate options for all Synapse-Chainalysis configurations of a Chainalysis product.

The proxy argument can be set to one of the following values:
  true: Use the Cortex configured proxy if set.
  false: Do not use the Cortex configured proxy if set.
  <str>: A proxy URL to use.

Examples:

  // Migrate the tag prefix for all DS configurations
  chainalysis.config.migrate ds --tag-prefix my.tagpref


Usage: chainalysis.config.migrate [options] <product>

Options:

  --help                      : Display the command usage.
  --ssl-verify <ssl_verify>   : Set whether to verify the SSL certificate of the server. (default: None)
  --proxy <proxy>             : Configure the proxy usage. (default: None)
  --tag-prefix <tag_prefix>   : The tag prefix to use when recording data from Chainalysis. (default: None)

Arguments:

  <product>                   : The Chainalysis product the configuration applies to. (choices: ds)

The command is accessible to users with one or more of the following permissions:

  • power-ups.chainalysis.admin

chainalysis.config.show

Show the details of a Synapse-Chainalysis configuration for a Chainalysis product.

Examples:

  // Show the in-use DS configuration for the current user
  chainalysis.config.show ds

  // Show a DS configuration by name
  chainalysis.config.show ds myconfig


Usage: chainalysis.config.show [options] <product> <name>

Options:

  --help                      : Display the command usage.

Arguments:

  <product>                   : The Chainalysis product the configuration applies to. (choices: ds)
  [name]                      : The name of the configuration.

The command is accessible to users with one or more of the following permissions:

  • power-ups.chainalysis.admin

  • power-ups.chainalysis.user

chainalysis.config.update

Update the configuration of a defined Synapse-Chainalysis configuration for a Chainalysis product.

The proxy argument can be set to one of the following values:
  true: Use the Cortex configured proxy if set.
  false: Do not use the Cortex configured proxy if set.
  <str>: A proxy URL to use.

Examples:

  // Set the permission level for user "myuser" to "admin" on the "fooconfig"
  // DS configuration
  chainalysis.config.update ds fooconfig --perm user myuser admin

  // Set the permission level for the "all" role to "deny" on the
  // "fooconfig" DS configuration
  chainalysis.config.update ds fooconfig --perm role all deny

  // Do not verify the SSL certificate when connecting to the "fooconfig" DS configuration
  chainalysis.config.update ds fooconfig --ssl-verify (false)

  // Change the name of the "fooconfig" DS configuration to "barconfig"
  chainalysis.config.update ds fooconfig --name barconfig


Usage: chainalysis.config.update [options] <product> <config>

Options:

  --help                      : Display the command usage.
  --apikey <apikey>           : The API key string. (default: None)
  --perm <perm>               : Set the permission level for a user or role on this configuration.
                                Arguments to this option are <scope>, <name>, <level>:
                                  <scope>: The scope for the permission, either "user" or "role".
                                  <name>: The user/role name depending on scope.
                                  <level>: The $lib.auth.easyperm.level, or None to remove the permission.
                                 (default: None)
  --ssl-verify <ssl_verify>   : Set whether to verify the SSL certificate of the server. (default: None)
  --proxy <proxy>             : Configure the proxy usage. (default: None)
  --tag-prefix <tag_prefix>   : The tag prefix to use when recording data from Chainalysis. (default: None)
  --name <name>               : Rename the configuration. (default: None)
  --no-check-apikey           : Do not perform API key validation against the Chainalysis API.

Arguments:

  <product>                   : The Chainalysis product the configuration applies to. (choices: ds)
  <config>                    : The name of the configuration to modify.

The command is accessible to users with one or more of the following permissions:

  • power-ups.chainalysis.admin

  • power-ups.chainalysis.user

chainalysis.ds.sql.execute

Execute a SQL query against the Chainalysis Data Solutions analytical API.

Examples:

  // Issue a query
  chainalysis.ds.sql.execute "select * from bitcoin.clusters where address = '1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa'"


Endpoints:

  /sql/analytical/async       : Submit an asynchronous SQL query against the DS analytical endpoint.
  /sql/analytical/status      : Poll for the status and results of an asynchronous SQL query.

Usage: chainalysis.ds.sql.execute [options] <query>

Options:

  --help                      : Display the command usage.
  --debug                     : Show verbose debug output.
  --pprint                    : Pretty-print result rows.
  --config <config>           : Override the default config with the provided name.

Arguments:

  <query>                     : The SQL query string to execute against the analytical endpoint.

The command is accessible to users with one or more of the following permissions:

  • power-ups.chainalysis.admin

  • power-ups.chainalysis.user

chainalysis.ds.table.list

Display the available Chainalysis Data Solutions tables for the configured API key.

Queries the analytical schemas endpoint and displays the available SQL tables.
Use chainalysis.ds.table.show to view column-level detail for a specific table.

Examples:

  // Display all available tables
  chainalysis.ds.table.list

  // Restrict the listing to a single schema
  chainalysis.ds.table.list --schema bitcoin

  // Restrict the listing to a single table name across all schemas
  chainalysis.ds.table.list --table clusters

  // Display available tables for a specific configuration
  chainalysis.ds.table.list --config myconfig


Endpoints:

  /sql/analytical/schemas     : Enumerate available SQL tables for the current API key.

Usage: chainalysis.ds.table.list [options]

Options:

  --help                      : Display the command usage.
  --debug                     : Show verbose debug output.
  --config <config>           : Override the default config with the provided name.
  --schema <schema>           : Only display tables in the given schema (e.g. bitcoin). (default: None)
  --table <table>             : Only display tables whose table name matches (e.g. clusters). (default: None)

The command is accessible to users with one or more of the following permissions:

  • power-ups.chainalysis.admin

  • power-ups.chainalysis.user

chainalysis.ds.table.show

Display the column-level schema for a single Chainalysis Data Solutions table.

The "table" argument is the dotted "schema.table" name as rendered by
chainalysis.ds.table.list. Use chainalysis.ds.table.list to discover
available tables.

Examples:

  // Show the schema for the bitcoin.clusters table
  chainalysis.ds.table.show bitcoin.clusters

  // Show the schema using a specific configuration
  chainalysis.ds.table.show bitcoin.clusters --config myconfig


Endpoints:

  /sql/analytical/schemas     : Enumerate available SQL tables for the current API key.

Usage: chainalysis.ds.table.show [options] <table>

Options:

  --help                      : Display the command usage.
  --debug                     : Show verbose debug output.
  --config <config>           : Override the default config with the provided name.

Arguments:

  <table>                     : The dotted "schema.table" name (e.g. bitcoin.clusters).

The command is accessible to users with one or more of the following permissions:

  • power-ups.chainalysis.admin

  • power-ups.chainalysis.user

Storm Modules

This package implements the following Storm Modules.

chainalysis.ds

resolveOpts(opts=(null))

Resolve opts against the configured Chainalysis Data Solutions credentials. Exposed so callers can read the resolved config.

Args:

opts (dict): Optional opts dict to resolve.

Returns:

The resolved opts dict. The return type is dict.

getMetaSource()

Return the meta:source node for Chainalysis Data Solutions, creating it if it does not already exist. Intended for use as the n1 of -(seen)> light edges on ingested nodes.

Returns:

The Chainalysis Data Solutions meta:source node. The return type is storm:node.

sqlExecute(query, opts=(null))

Execute a SQL query against the Chainalysis Data Solutions analytical endpoint and emit results.

Example:

Iterate over results and print the data rows:

$mod = $lib.import(chainalysis.ds)

$query = "select * from bitcoin.clusters where address = '1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa'"

for ($mtyp, $data, $info) in $mod.sqlExecute($query) {
  switch $mtyp {
    "init": {
      $lib.print(`query_id={$data}`)
    }
    "data": {
      if $info.columns { $lib.print(`columns={$info.columns}`) }
      $lib.print($data)
    }
    "print": {
      $lib.print($data)
    }
    "warn": {
      $lib.warn($data)
    }
    *: {
      $lib.warn(`Unexpected message type {$mtyp} - {$data}`)
    }
  }
}
Args:

query (str): The SQL query string to execute.

opts (dict): Options passed to resolveOpts.

Yields:

A message list containing (type, data, info). The return type is list.

listTableSchemas(opts=(null))

Query the Chainalysis Data Solutions analytical schemas endpoint and return the schemas/tables visible to the configured API key as a dict. Returns null on failure.

Args:

opts (dict): Options passed to resolveOpts.

Returns:

A dict of available schemas/tables, or null on failure. The return type is dict.

getTableSchema(table, opts=(null))

Return the schema dict for a single Chainalysis Data Solutions table. The table argument is the dotted schema.table name (e.g. bitcoin.clusters). Returns null if the schemas response does not contain the requested table.

Args:

table (str): The dotted schema.table name.

opts (dict): Options passed to resolveOpts.

Returns:

The table schema dict, or null if not found. The return type is dict.

printSqlResults(genr, pprint=(false))

Consume a sqlExecute() generator and render the result tuples to standard output via $lib.print / $lib.pprint / $lib.warn. Used by the chainalysis.ds.sql.execute command.

Args:

genr (generator): A (mtyp, data, info) generator returned by sqlExecute().

pprint (boolean): Pretty-print result rows.

Returns:

Returns null. The return type is null.