Storing your API Keys

How to store API keys for third-party services

The package uses three services that each require an API key.

These steps will store your API keys locally, so that the package can use your keys with less risk of accidental exposure.

This package does not require any passwords or private keys.





Provides historical Ethereum data from public datasets.


Queries data directly from the Ethereum blockchain that is not available from BigQuery.


Pulls contract source code that have been published to Etherscan to help decode data.

BigQuery is a paid service with a free monthly allowance. You are likely to surpass your free allowance using this package. For more information, see Controlling Costs.


1. BigQuery

Sign up for BigQuery here. Then follow these instructions to create and download a service account key.

Keep following the instructions to set the environment variable GOOGLE_APPLICATION_CREDENTIALS.

$ export GOOGLE_APPLICATION_CREDENTIALS="/path/to/keys.json"

2. Infura

Sign up for Infura here. Create a new project and copy the project ID.

Set the environment variable INFURA_PROJECT_ID with your project ID.


3. Etherscan

Sign up for Etherscan here. Visit the API-KEYs portal and copy the API key.

Set the environment variable ETHERSCAN_API_KEY with your API key.


Checking your keys

Optional. If you would like to check that your keys have been saved correctly, run the command:

$ printenv