Package: graphsense-lib
graphsense-libA central repository for python utility functions and everything that deals with the graphsense backend. Its CLI interface can be used to control important graphsense maintainance tasks.UseAs a libraryAccess the graphsense cassandra db. This requires a graphsense config (see Modules/Config)fromgraphsenselib.dbimportDbFactoryenv,currency="test","btc"withDbFactory().from_config(env,currency)asdb:print(db.transformed.get_highest_block())Alternatively, the database can also be accessed without relying on the graphsense config file.fromgraphsenselib.dbimportDbFactorywithDbFactory().from_name(raw_keyspace_name="eth_raw",transformed_keyspace_name="eth_transformed",schema_type="account",cassandra_nodes=["test.cassandra1","test.cassandra2"])asdb:print(db.transformed.get_highest_block())From the commandline.Graphsenslib exposes a commandline interface - graphsence-cli.Help can be viewed by:>graphsense-cli--help
Usage:graphsense-cli[OPTIONS]COMMAND[ARGS]...Commandlineinterfaceofgraphsense-libgraphsense-cliexposesmanytoolsandfeaturestomanageryourgraphsensecrypto-analyticsdatabase.

Options:-v,--verboseOnevforwarning,twoforinfoetc.--helpShowthismessageandexit.

Commands:configInspectthecurrentconfigurationofgraphsenselib.convertUsefulfileconvertionstoolsforthegraphsense...dbQueryrelatedfunctions.delta-updateUpdatingthetransformedkeyspacefromtherawkeyspace.exchange-ratesFetchingandingestingexchangerates.ingestIngestingrawcryptocurrencydatafromnodesintothe...monitoringToolstomonitorthegraphsenseinfrastructure.schemaCreatingandvalidatingthedbschema.versionDisplaythecurrentversion.watchCommandsforpermanentlywatchingcryptocurrencyevents.GraphSense-https://graphsense.github.io/ModulesDBAssess the current database state.>graphsense-clidb--help
Usage:graphsense-clidb[OPTIONS]COMMAND[ARGS]...DB-managementrelatedfunctions.

Options:--helpShowthismessageandexit.

Commands:blockSpecialdbqueryfunctionsregardingblocks.logsSpecialdbqueryfunctionsregardinglogs.stateSummaryPrintsthecurrentstateofthegraphsensedatabase.SchemaExtracting and validating the current database schema.>graphsense-clischema--help
Usage:graphsense-clischema[OPTIONS]COMMAND[ARGS]...Creatingandvalidatingthedbschema.

Options:--helpShowthismessageandexit.

Commands:createCreatesthenecessarygraphsensetablesinCassandra.show-by-currencyPrintsthecurrentdbschemaexpectedfromgraphsenselibshow-by-schema-typePrintsthecurrentdbschemaexpectedfromgraphsenselibvalidateValidatesiftheexpectedschemamatchesthedatabase.IngestLoading raw data from cryptocurrency nodes into the graphsense raw keyspace.>graphsense-cliingest--help
Usage:graphsense-cliingest[OPTIONS]COMMAND[ARGS]...Ingestingrawcryptocurrencydatafromnodesintothegraphsensedatabase

Options:--helpShowthismessageandexit.

Commands:from-nodeIngestscryptocurrencydataformtheclient/nodetothe...Delta UpdateUpdates the data in the transformed keyspace based on the raw keyspace>graphsense-clidelta-update--help
Usage:graphsense-clidelta-update[OPTIONS]COMMAND[ARGS]...Updatingthetransformedkeyspacefromtherawkeyspace.

Options:--helpShowthismessageandexit.

Commands:patch-exchange-ratesRewritesthetransformedexchangerateata...statusShowsthestatusofthedeltaupdater.updateUpdatestransformedfromraw,ifpossible.validateValidatesthecurrentdeltaupdatestatusandits...Exchange RatesFetches exchange_rates from different sources and adds them to the database.>graphsense-cliexchange-rates--help
Usage:graphsense-cliexchange-rates[OPTIONS]COMMAND[ARGS]...Fetchingandingestingexchangerates.

Options:--helpShowthismessageandexit.

Commands:coindeskFromcoindesk.coinmarketcapFromcoinmarketcap.ConfigShows the currently used configuration. Configurations reside per default in ~/graphsense.yaml. It contains the cassandra and keyspace configurations for different environments. A template config can be generated viagraphsense-cli config template>graphsense-cliconfig--help
Usage:graphsense-cliconfig[OPTIONS]COMMAND[ARGS]...Inspectthecurrentconfigurationofgraphsenselib.

Options:--helpShowthismessageandexit.

Commands:pathPrintsthepathwheretheconfigisloadedfrom.showPrintstheconfigurationusedintheenvironment.templateGeneratesaconfigurationtemplate.MonitoringHelpful functions to keep an eye on the state and health of your graphsense database state.>graphsense-climonitoring--help
Usage:graphsense-climonitoring[OPTIONS]COMMAND[ARGS]...Toolstomonitorthegraphsenseinfrastructure.

Options:--helpShowthismessageandexit.

Commands:get-summaryReceivesasummaryrecordofthecurrentdatabasestate.notifySendsamessagetotheconfiguredhandlers(e.g.aslackchannel)bytopic.Watch (Alpha)Provides functions to generate notifications on cryptocurrency events like value flows on certain addresses.>graphsense-cliwatch--help
Usage:graphsense-cliwatch[OPTIONS]COMMAND[ARGS]...Commandsforpermanentlywatchingcryptocurrencyevents.

Options:--helpShowthismessageandexit.

Commands:money-flowsWatchesformovementsmoneyflowsandgenerates...InstallTo install the package from the python package index run.>pipinstallgraphsense-libIf you want to install it from source run>makeinstallor>pipinstall.DevelopmentCaution: python 3.11 is currently not supported. Please usepython3.10.it is advised to use a virtual environment (venv) for development. Run the following command to initialize one>python3-mvenv.venvand activate it (in bash) using>source.venv/bin/activateFor more information refer to (venv). Run>makedevto initialize the dev environment.
If you want to install graphsenselib in development mode run>makeinstall-devBefore committing anything to the repository please format, lint and test your code in that order. Fix all linter warnings and make sure all test are passing before a commit.Use the following commands for that:>makeformat>makelint>maketestor equivalently run>makepre-commitSome slow tests are excluded when running make test. Occasionally, one should run>maketest-allto run the entire test-suite.Linting and formatting should be automatically executed on every git commit, using pre-commit.To create the documentation please run:>makedocsCreating the docs need python dev dependencies to build see (Stackoverflow)Tagging a releaseTo tag a new release please update the changelog first. Afterwards, update the Version numbers RELEASESEM and RELEASE in the main Makefile.To apply the tags run>maketag-versionOpen SSL - Errors running test suitesSome components used by graphsense-lib use OpenSSL, to provide certain hash functions. Since OpenSSL 3.0 some hash functions needed are not available anymore by default (e.g. ripemd160). This leads to errors while running the test suite. To avoid these errors, enable legacy providers in the OpenSSL config. An example of the necessary changes can be found in the "fix openssl legacy mode" step in .github/workflows/run_tests.yaml