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.
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.
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.
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.
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.
We've provided instructions for Infura below. Note that websites change often, so the screenshot may be out of date.
- Register for an account
- Go to the individual account dashboard and select the API key of the required chain
