- class DipDupConfig(spec_version, package, datasources=<factory>, database=SqliteDatabaseConfig(kind='sqlite', path=':memory:'), contracts=<factory>, indexes=<factory>, templates=<factory>, jobs=<factory>, hooks=<factory>, hasura=None, sentry=SentryConfig(dsn='', environment=None, server_name=None, release=None, user_id=None, debug=False), prometheus=None, advanced=AdvancedConfig(reindex={}, scheduler=None, postpone_jobs=False, early_realtime=False, merge_subscriptions=False, metadata_interface=False, skip_version_check=False, rollback_depth=2, crash_reporting=False, decimal_precision=None, alt_operation_matcher=False), custom=<factory>, logging=LoggingValues.default)¶
Main indexer config
- Parameters:
spec_version (str) – Version of config specification, currently always 1.2
package (str) – Name of indexer’s Python package, existing or not
datasources (dict[str, TzktDatasourceConfig | CoinbaseDatasourceConfig | MetadataDatasourceConfig | IpfsDatasourceConfig | HttpDatasourceConfig]) – Mapping of datasource aliases and datasource configs
database (SqliteDatabaseConfig | PostgresDatabaseConfig) – Database config
contracts (dict[str, ContractConfig]) – Mapping of contract aliases and contract configs
indexes (dict[str, OperationIndexConfig | BigMapIndexConfig | HeadIndexConfig | TokenTransferIndexConfig | EventIndexConfig | OperationUnfilteredIndexConfig | IndexTemplateConfig]) – Mapping of index aliases and index configs
templates (dict[str, OperationIndexConfig | BigMapIndexConfig | HeadIndexConfig | TokenTransferIndexConfig | EventIndexConfig | OperationUnfilteredIndexConfig]) – Mapping of template aliases and index templates
jobs (dict[str, JobConfig]) – Mapping of job aliases and job configs
hooks (dict[str, HookConfig]) – Mapping of hook aliases and hook configs
hasura (HasuraConfig | None) – Hasura integration config
sentry (SentryConfig) – Sentry integration config
prometheus (PrometheusConfig | None) – Prometheus integration config
advanced (AdvancedConfig) – Advanced config
custom (dict[str, Any]) – User-defined configuration to use in callbacks
logging (LoggingValues) – Modify logging verbosity
- class AdvancedConfig(reindex=<factory>, scheduler=None, postpone_jobs=False, early_realtime=False, merge_subscriptions=False, metadata_interface=False, skip_version_check=False, rollback_depth=2, crash_reporting=False, decimal_precision=None, alt_operation_matcher=False)¶
Feature flags and other advanced config.
- Parameters:
reindex (dict[ReindexingReason, ReindexingAction]) – Mapping of reindexing reasons and actions DipDup performs
scheduler (dict[str, Any] | None) – apscheduler scheduler config
postpone_jobs (bool) – Do not start job scheduler until all indexes are in realtime state
early_realtime (bool) – Establish realtime connection immediately after startup
merge_subscriptions (bool) – Subscribe to all operations instead of exact channels
metadata_interface (bool) – Expose metadata interface for TzKT
skip_version_check (bool) – Do not check for new DipDup versions on startup
rollback_depth (int) – A number of levels to keep for rollback
crash_reporting (bool) – Enable crash reporting
decimal_precision (int | None) – Adjust decimal context precision.
alt_operation_matcher (bool) – Use different algorithm to match operations (undocumented)
- class BigMapHandlerConfig(callback, contract, path)¶
Big map handler config
- Parameters:
callback (str) – Callback name
contract (str | ContractConfig) – Contract to fetch big map from
path (str) – Path to big map (alphanumeric string with dots)
- class BigMapIndexConfig(kind, datasource, handlers, skip_history=SkipHistory.never, first_level=0, last_level=0)¶
Big map index config
- Parameters:
kind (Literal['big_map']) – always big_map
datasource (str | TzktDatasourceConfig) – Index datasource to fetch big maps with
handlers (tuple[BigMapHandlerConfig, ...]) – Mapping of big map diff handlers
skip_history (SkipHistory) – Fetch only current big map keys ignoring historical changes
first_level (int) – Level to start indexing from
last_level (int) – Level to stop indexing at
- class CoinbaseDatasourceConfig(kind, api_key=None, secret_key=None, passphrase=None, http=None)¶
Coinbase datasource config
- Parameters:
kind (Literal['coinbase']) – always ‘coinbase’
api_key (str | None) – API key
secret_key (str | None) – API secret key
passphrase (str | None) – API passphrase
http (HTTPConfig | None) – HTTP client configuration
- class ContractConfig(address=None, code_hash=None, typename=None)¶
Contract config
- Parameters:
address (str | None) – Contract address
code_hash (int | str | None) – Contract code hash or address to fetch it from
typename (str | None) – User-defined alias for the contract script
- class EventHandlerConfig(callback, contract, tag)¶
Event handler config
- Parameters:
callback (str) – Callback name
contract (str | ContractConfig) – Contract which emits event
tag (str) – Event tag
- class EventIndexConfig(kind, datasource, handlers=<factory>, first_level=0, last_level=0)¶
Event index config
- Parameters:
kind (Literal['event']) – Index kind
datasource (str | TzktDatasourceConfig) – Datasource config
handlers (tuple[EventHandlerConfig | UnknownEventHandlerConfig, ...]) – Event handlers
first_level (int) – First block level to index
last_level (int) – Last block level to index
- class HasuraConfig(url, admin_secret=None, create_source=False, source='default', select_limit=100, allow_aggregations=True, allow_inconsistent_metadata=False, camel_case=False, rest=True, http=None)¶
Config for the Hasura integration.
- Parameters:
url (str) – URL of the Hasura instance.
admin_secret (str | None) – Admin secret of the Hasura instance.
create_source (bool) – Whether source should be added to Hasura if missing.
source (str) – Hasura source for DipDup to configure, others will be left untouched.
select_limit (int) – Row limit for unauthenticated queries.
allow_aggregations (bool) – Whether to allow aggregations in unauthenticated queries.
allow_inconsistent_metadata (bool) – Whether to ignore errors when applying Hasura metadata.
camel_case (bool) – Whether to use camelCase instead of default pascal_case for the field names (incompatible with metadata_interface flag)
rest (bool) – Enable REST API both for autogenerated and custom queries.
http (HTTPConfig | None) – HTTP connection tunables
- class HeadHandlerConfig(callback)¶
Head block handler config
- Parameters:
callback (str) – Callback name
- class HeadIndexConfig(kind, datasource, handlers)¶
Head block index config
- Parameters:
kind (Literal['head']) – always head
datasource (str | TzktDatasourceConfig) – Index datasource to receive head blocks
handlers (tuple[HeadHandlerConfig, ...]) – Mapping of head block handlers
- class HookConfig(callback, args=<factory>, atomic=False)¶
Hook config
- Parameters:
args (dict[str, str]) – Mapping of argument names and annotations (checked lazily when possible)
atomic (bool) – Wrap hook in a single database transaction
callback (str) – Callback name
- class HTTPConfig(retry_count=None, retry_sleep=None, retry_multiplier=None, ratelimit_rate=None, ratelimit_period=None, ratelimit_sleep=None, connection_limit=None, connection_timeout=None, batch_size=None, replay_path=None)¶
Advanced configuration of HTTP client
- Parameters:
retry_count (int | None) – Number of retries after request failed before giving up
retry_sleep (float | None) – Sleep time between retries
retry_multiplier (float | None) – Multiplier for sleep time between retries
ratelimit_rate (int | None) – Number of requests per period (“drops” in leaky bucket)
ratelimit_period (int | None) – Time period for rate limiting in seconds
ratelimit_sleep (float | None) – Sleep time between requests when rate limit is reached
connection_limit (int | None) – Number of simultaneous connections
connection_timeout (int | None) – Connection timeout in seconds
batch_size (int | None) – Number of items fetched in a single paginated request (for some APIs)
replay_path (str | None) – Development-only option to use cached HTTP responses instead of making real requests
- class HttpDatasourceConfig(kind, url, http=None)¶
Generic HTTP datasource config
- Parameters:
kind (Literal['http']) – always ‘http’
url (str) – URL to fetch data from
http (HTTPConfig | None) – HTTP client configuration
- class IndexTemplateConfig(template, values, first_level=0, last_level=0)¶
Index template config
- Parameters:
kind – always template
values (dict[str, str]) – Values to be substituted in template (<key> -> value)
first_level (int) – Level to start indexing from
last_level (int) – Level to stop indexing at
template (str) – Template alias in templates section
- class IpfsDatasourceConfig(kind, url='https://ipfs.io/ipfs', http=None)¶
IPFS datasource config
- Parameters:
kind (Literal['ipfs']) – always ‘ipfs’
url (str) – IPFS node URL, e.g. https://ipfs.io/ipfs/
http (HTTPConfig | None) – HTTP client configuration
- class JobConfig(hook, args=<factory>, crontab=None, interval=None, daemon=False)¶
Job schedule config
- Parameters:
hook (str | HookConfig) – Name of hook to run
crontab (str | None) – Schedule with crontab syntax (* * * * *)
interval (int | None) – Schedule with interval in seconds
daemon (bool) – Run hook as a daemon (never stops)
args (dict[str, Any]) – Arguments to pass to the hook
- class LoggingValues(value)¶
Enum for logging field values.
- default = 'default'¶
- quiet = 'quiet'¶
- verbose = 'verbose'¶
- class MetadataDatasourceConfig(kind, network, url='https://metadata.dipdup.net', http=None)¶
DipDup Metadata datasource config
- Parameters:
kind (Literal['metadata']) – always ‘metadata’
network (MetadataNetwork) – Network name, e.g. mainnet, ghostnet, etc.
url (str) – GraphQL API URL, e.g. https://metadata.dipdup.net
http (HTTPConfig | None) – HTTP client configuration
- class OperationHandlerConfig(callback, pattern)¶
Operation handler config
- Parameters:
callback (str) – Callback name
pattern (tuple[OperationHandlerTransactionPatternConfig | OperationHandlerOriginationPatternConfig, ...]) – Filters to match operation groups
- class OperationHandlerOriginationPatternConfig(type='origination', source=None, similar_to=None, originated_contract=None, optional=False, strict=False, alias=None)¶
Origination handler pattern config
- Parameters:
type (Literal['origination']) – always ‘origination’
source (str | ContractConfig | None) – Match operations by source contract alias
similar_to (str | ContractConfig | None) – Match operations which have the same code/signature (depending on strict field)
originated_contract (str | ContractConfig | None) – Match origination of exact contract
optional (bool) – Whether can operation be missing in operation group
strict (bool) – Match operations by storage only or by the whole code
alias (str | None) – Alias for transaction (helps to avoid duplicates)
- class OperationHandlerTransactionPatternConfig(type='transaction', source=None, destination=None, entrypoint=None, optional=False, alias=None)¶
Operation handler pattern config
- Parameters:
type (Literal['transaction']) – always ‘transaction’
source (str | ContractConfig | None) – Match operations by source contract alias
destination (str | ContractConfig | None) – Match operations by destination contract alias
entrypoint (str | None) – Match operations by contract entrypoint
optional (bool) – Whether can operation be missing in operation group
alias (str | None) – Alias for transaction (helps to avoid duplicates)
- class OperationIndexConfig(kind, datasource, handlers, contracts=<factory>, types=(<OperationType.transaction: 'transaction'>, ), first_level=0, last_level=0)¶
Operation index config
- Parameters:
kind (Literal['operation']) – always operation
datasource (str | TzktDatasourceConfig) – Alias of index datasource in datasources section
handlers (tuple[OperationHandlerConfig, ...]) – List of indexer handlers
types (tuple[OperationType, ...]) – Types of transaction to fetch
contracts (list[str | ContractConfig]) – Aliases of contracts being indexed in contracts section
first_level (int) – Level to start indexing from
last_level (int) – Level to stop indexing at
- class OperationType(value)¶
Type of blockchain operation
- migration = 'migration'¶
- origination = 'origination'¶
- transaction = 'transaction'¶
- class OperationUnfilteredIndexConfig(kind, datasource, callback, types=(<OperationType.transaction: 'transaction'>, ), first_level=0, last_level=0)¶
Operation index config
- Parameters:
kind (Literal['operation_unfiltered']) – always operation_unfiltered
datasource (str | TzktDatasourceConfig) – Alias of index datasource in datasources section
callback (str) – Callback name
types (tuple[OperationType, ...]) – Types of transaction to fetch
first_level (int) – Level to start indexing from
last_level (int) – Level to stop indexing at
- class PostgresDatabaseConfig(kind, host, user='postgres', database='postgres', port=5432, schema_name='public', password='', immune_tables=<factory>, connection_timeout=60)¶
Postgres database connection config
- Parameters:
kind (Literal['postgres']) – always ‘postgres’
host (str) – Host
port (int) – Port
user (str) – User
password (str) – Password
database (str) – Database name
schema_name (str) – Schema name
immune_tables (set[str]) – List of tables to preserve during reindexing
connection_timeout (int) – Connection timeout
- class PrometheusConfig(host, port=8000, update_interval=1.0)¶
Config for Prometheus integration.
- Parameters:
host (str) – Host to bind to
port (int) – Port to bind to
update_interval (float) – Interval to update some metrics in seconds
- class ReindexingAction(value)¶
Action that should be performed on reindexing
- exception = 'exception'¶
- ignore = 'ignore'¶
- wipe = 'wipe'¶
- class ReindexingReason(value)¶
Reason that caused reindexing
- config_modified = 'config_modified'¶
- manual = 'manual'¶
- migration = 'migration'¶
- rollback = 'rollback'¶
- schema_modified = 'schema_modified'¶
- class SentryConfig(dsn='', environment=None, server_name=None, release=None, user_id=None, debug=False)¶
Config for Sentry integration.
- Parameters:
dsn (str) – DSN of the Sentry instance
environment (str | None) – Environment; if not set, guessed from docker/ci/gha/local.
server_name (str | None) – Server name; defaults to obfuscated hostname.
release (str | None) – Release version; defaults to DipDup package version.
user_id (str | None) – User ID; defaults to obfuscated package/environment.
debug (bool) – Catch warning messages, increase verbosity.
- class SkipHistory(value)¶
Whether to skip indexing operation history and use only current state
- always = 'always'¶
- never = 'never'¶
- once = 'once'¶
- class SqliteDatabaseConfig(kind, path=':memory:')¶
SQLite connection config
- Parameters:
kind (Literal['sqlite']) – always ‘sqlite’
path (str) – Path to .sqlite3 file, leave default for in-memory database (:memory:)
- class TokenTransferHandlerConfig(callback, contract=None, token_id=None, from_=None, to=None)¶
Token transfer handler config
- Parameters:
callback (str) – Callback name
contract (str | ContractConfig | None) – Filter by contract
token_id (int | None) – Filter by token ID
from – Filter by sender
to (str | ContractConfig | None) – Filter by recipient
from_ (str | ContractConfig | None) –
- class TokenTransferIndexConfig(kind, datasource, handlers=<factory>, first_level=0, last_level=0)¶
Token transfer index config
- Parameters:
kind (Literal['token_transfer']) – always token_transfer
datasource (str | TzktDatasourceConfig) – Index datasource to use
handlers (tuple[TokenTransferHandlerConfig, ...]) – Mapping of token transfer handlers
first_level (int) – Level to start indexing from
last_level (int) – Level to stop indexing at
- class TzktDatasourceConfig(kind, url='https://api.tzkt.io', http=None, buffer_size=0)¶
TzKT datasource config
- Parameters:
kind (Literal['tzkt']) – always ‘tzkt’
url (str) – Base API URL, e.g. https://api.tzkt.io/
http (HTTPConfig | None) – HTTP client configuration
buffer_size (int) – Number of levels to keep in FIFO buffer before processing
- class UnknownEventHandlerConfig(callback, contract)¶
Unknown event handler config
- Parameters:
callback (str) – Callback name
contract (str | ContractConfig) – Contract which emits event