Installation & Setup
- Personal web3 provider url (Alchemy or other) if you need to use your own web3 provider instance to run a model during development.
- 1.

Note: credmark-models-py is publically available, so anyone can see it, fork it, and contribute to it.
2. Fork the repository by clicking on Fork

You will be directed to Create a new Fork page

Give a name to your Repository and click on Create Fork.
git clone https://github.com/<owner>/credmark-models-py.git
Setting up a virtual environment for your work isn't required but we highly recommend it. Following are instructions for both Conda and venv. Use the one you prefer.
- Install Conda.
- Create an environment named "cmf" with the system's default using the system's default version of Python:
conda create -y --name "cmf"
or
- create it specifying a particular version of Python:
conda create -y --name "cmk" python="3.10"*
- Install pip and other support packages in the Conda environment:
conda install -y --name cmk ipython jupyterlab nb_conda_kernels jupyterlab_code_formatter ipywidgetsNow, the credmarksdk has all the packages and programs that are required to create the correct Model according to the Credmark set of rules, so it is important that you call the credmarksdk before starting working on your Model.
- Activate the environment and follow the CMK installation instructions below:
conda activate cmk
The best place to create your venv environment is in the project directory you cloned.
Assuming your cwd is the one above the repository you've just cloned, create and activate your virtual environment:
cd credmark-models-py
python3 -m venv venv
source venv/bin/activate
Run:
pip install -r requirements.txt
For development, you should also run:
pip install -r requirements-dev.txt
When using the CMF, we need two bits of information:
- 1.Your API key.
- 2.The URL of a blockchain node.
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.
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 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>
- Register for an account
- Go to the individual account dashboard and select the API key of the required chain

credmark-dev run chain.get-latest-block -j
Your output should look something like:
2022-10-14 22:49:32,092 - credmark.cmf.engine.context - INFO - Using latest block number 15746805
{
"slug": "chain.get-latest-block",
"version": "0.1",
"chainId": 1,
"blockNumber": 15746805,
"output": {
"blockNumber": 15747036,
"timestamp": 1665758807
},
"dependencies": {
"chain.get-latest-block": {
"0.1": 1
}
}
}