Links

Create the output and run the model

Finally, we can create the output to catch all created data variables and run the model afterwards.
return {'block_number': input.block_number,
'count_txs': count.data[0]['count_tx'],
'max_gas': max_gas,
'total_gas_cost': total_gas_cost,
'count_address': count_address}
In order to run the model, we will have to write credmark-dev run contrib.ape-count
The contrib.ape count is the model that uses -i '{"block_number": XXXX}' to pass in the input and use -j to pretty print the output.
Note: In Windows native (non-WSL), you need double double-quotes `-i '{""block_number"": XXXX}.
> credmark-dev run contrib.ape-count -i '{"block_number_count": 2}' -j
2022-10-25 16:01:34,156 - credmark.cmf.engine.context - INFO - Using latest block number 15823462
{
"slug": "contrib.ape-count",
"version": "1.0",
"chainId": 1,
"blockNumber": 15823462,
"output": {
"block_number_count": 2,
"count_txs": 238,
"max_gas": 2138710,
"total_gas_cost": 0.1784772783190307,
"count_address": 373
},
"dependencies": {
"ledger.transaction_data": {
"1.0": 2
},
"ledger.receipt_data": {
"1.0": 1
},
"contrib.ape-count": {
"1.0": 1
}
}
}
🥳 Congratulations! You finished your first model! 🥳