API key and nodes

Running models on Credmark Model Framework requires:

  1. Credmark API key

  2. URL of a blockchain node

CMF offers a default API key and blockchain nodes so that models run out of the box. This key and the nodes are provided as a community resource for early prototyping.

Since they are shared by all users (that have not acquired their own API key and nodes), they are aggressively throttled which means retries occur more frequently and the responses are slower.

It is highly recommended that you purchase a DeFi API key for uninterrupted access.

Configure your environment

When using the CMF, you can use your own API key and nodes by setting the appropriate environment variables. You can set your environment variables in memory or in a configuration file.

Memory

This assumes a bash or similar shell

export CREDMARK_API_KEY=<key>
export CREDMARK_WEB3_PROVIDER_CHAIN_ID_<x>=<url>

'x' is the chain ID. For the Ethereum mainnet, for example, the chain ID is 1. You should set a chain provider for every chain with which you'll be working.

Configuration File

The best place to put your configuration file is in the project root, i.e., credmark-models-py.

The file should be called ".env" and should contain the following:

CREDMARK_API_KEY=<key>
CREDMARK_WEB3_PROVIDER_CHAIN_ID_<x>=<url>

'x' is the chain ID. For the Ethereum mainnet, for example, the chain ID is 1. You should set a chain provider for every chain with which you'll be working.

Getting an API key

In order to run models only in your local environment, you don't need an API key, but chances are you'll need one. You can purchase a DeFi API key on our website. If you're just exploring, don't worry, you get a 30-day free trial.

Getting a blockchain node URL

If you happen to be running a node of the chain you'll be working with, use that one. If not, you can rent one from Infura or Alchemy.

We've provided instructions for Infura below. Note that websites change often, so the screenshot may be out of date.

Getting an Infura node

Last updated