MCPcopy Index your code
hub / github.com/dcSpark/carp

github.com/dcSpark/carp @3.3.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 3.3.0 ↗ · + Follow
587 symbols 1,133 edges 242 files 12 documented · 2%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Carp - Cardano Postgres Indexer

Important: - Documentation: here - NPM package (client): here

Welcome to Carp, a Cardano Postgres Indexer. This project is designed to sync data from the Cardano blockchain and store it into a Postgres database. The backend is written in Rust using Oura and CML, while the server and client are written in TypeScript.

Core Pillars

The core pillars of Carp are:

Speed: Queries should be fast so they can be used inside production applications like wallets without the user feeling the application is not responsive.

Modular: It should be easy to enable only the database functionality you need to keep sync times fast and size requirements low.

Flexible: Instead of assuming the format users will need, we prefer to use raw cbor or raw bytes. Almost all applications already implement CML so they should be able to parse this data without any issue.

Type safe: Using and exposing types to avoid bugs is crucial in financial software. Database queries and the web server should have all its types checked and available to users.

Documented: Although we have to assume the user has read the Cardano ledger specs, design decisions, usage, and pitfalls should all be documented​1.

FAQ

How long does it take to sync the database from scratch?

Around 4-5 days. The first epochs are really fast, but Alonzo takes about ~1hr per epoch. We recommend taking occasional snapshots of the database so that you can easily spin up new nodes or recover from crashes without having to resync from scratch.

How long does it take to query history?

Querying the transaction history for an address should take <10ms for local queries (no network overhead). Of course, it will take longer if you're using a slow machine or if your machine is at max utilization.

How can I launch my own network?

We support parsing genesis blocks so it should be doable. However, this feature is still in development. Feel free to make a PR for more concrete steps​1​.

Running Carp

This project contains two different parts:

  • An indexer that stores the chain to a Postgres database.
  • A webserver that provides a REST API for querying the database (ex: for light wallets)​1​.

For detailed instructions on how to run each component, please refer to the respective README files of the indexer and the webserver.

Contributing

Contributions to Carp are very welcome. If you're interested in improving the project, feel free to make a PR.

Extension points exported contracts — how you extend this code

StoppableService (Interface)
(no doc) [4 implementers]
indexer/src/types.rs
Dex (Interface)
(no doc) [4 implementers]
indexer/tasks/src/multiera/dex/common.rs
ISqlCredentialAddressesParams (Interface)
(no doc)
webserver/server/app/models/credentials/sqlCredentialAddresses.queries.ts
Sink (Interface)
(no doc) [1 implementers]
indexer/src/sink.rs
MarkdownTaskMeta (Interface)
(no doc)
indexer/tasks/src/dsl/markdown_task.rs
ISqlCredentialAddressesResult (Interface)
(no doc)
webserver/server/app/models/credentials/sqlCredentialAddresses.queries.ts
TaskMarkdownBuilder (Interface)
(no doc)
indexer/tasks/src/dsl/markdown_task.rs
ISqlCredentialAddressesQuery (Interface)
(no doc)
webserver/server/app/models/credentials/sqlCredentialAddresses.queries.ts

Core symbols most depended-on inside this repo

from
called by 118
indexer/tasks/src/types.rs
query
called by 56
webserver/client/src/template.ts
genErrorMessage
called by 43
webserver/shared/errors.ts
add
called by 37
indexer/src/perf_aggregator.rs
to
called by 37
indexer/entity/src/address.rs
add_relation
called by 35
indexer/tasks/src/multiera/relation_map.rs
parseAssetItem
called by 20
webserver/server/app/services/utils.ts
get_asset_amount
called by 18
indexer/tasks/src/multiera/utils/common.rs

Shape

Method 168
Function 163
Class 121
Interface 91
Enum 44

Languages

Rust65%
TypeScript33%
Python2%

Modules by API surface

indexer/tasks/src/multiera/dex/common.rs20 symbols
indexer/tasks/src/multiera/multiera_projected_nft.rs17 symbols
indexer/plan-visualizer/src/generate_image.rs17 symbols
indexer/tasks/src/era_common.rs12 symbols
indexer/src/sinks/cardano.rs10 symbols
indexer/src/main.rs10 symbols
webserver/server/app/models/asset/mintBurnHistory.queries.ts9 symbols
docs/bin/sql_graphviz.py9 symbols
indexer/tasks/src/utils.rs7 symbols
indexer/tasks/src/multiera/multiera_address.rs7 symbols
indexer/tasks/src/dsl/database_task.rs7 symbols
webserver/server/app/models/zapatos/schema.d.ts6 symbols

Datastores touched

carp_mainnetDatabase · 1 repos
carp_preprodDatabase · 1 repos
carp_previewDatabase · 1 repos

For agents

$ claude mcp add carp \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact