This new major version brings the first round of Shelley-era features to the API, introduces a new genesis file API package, and hardens the migrations and metadata handling. This version is required for transitioning through the upcoming Shelley hard fork.
cardano-node
:1.18.0
cardano-db-sync
:3.1.0
- Note: The database must be recreated using the new version.
stakePools
,stakePools_aggregate
delegations
,delegations_aggregate
stakeRegistrations
,stakeRegistrations_aggregate
stakeDeregistrations
,stakeDeregistrations_aggregate
withdrawals
,withdrawals_aggregate
genesis
- Metadata and SQL migrations are now performed within the application layer, and make the service immune to schema
being removed should
cardano-db-sync
restart. using the Hasura CLI, which is included in the Dockerfile and NixOS service, however outside of this you must install and placehasura
on PATH. - A new API package
@cardano-graphql/api-genesis
allows access to the network genesis files. It's integrated into the server, with the config exposed as environment variables. As usual, the docker-compose.yaml serves as a good reference.
- The docker-compose file now mounts configuration managed in the repository, restoring the usual
separation of concerns with service configuration. The Docker images still have the
configuration included at build time, however in practice, being ready to managing your own
configuration if required is a good strategy. Simply copying the top level
config
and committing to source control gives you full control over the services using their native interface.
Cardano.networkName
removed. Use network magic from the genesis API identify networks.Cardano.protocolConst
,Cardano.slotDuration
,Cardano.startTime
,Cardano.slotsPerEpoch
removed. Access this info from the Genesis API.cardanoDbSync.slotDiffFromNetworkTip
removed in reponse to a change in strategy for determining sync status withcardano-db-sync
determining sync status relies on a chain that has produce
Dates we're previously formatted to ISO 3339, however ISO 8601 is being adopted with this release for alignment with the Shelley genesis file format and simplification when the precision is not required.
2017-10-03T21:43:51.000Z
->2017-10-03T21:43:51Z
Block.createdBy
->Block.slotLeader
links to an object, with a nullablestakePool
field. For previous behaviour,Block.slotLeader.description
can be used, however the description prefixes have changed upstream fromSlotLeader
toByronGenesis
Block.createdAt
->Block.forgedAt
Block.slotWithinEpoch
->Block.slotInEpoch
- Migrations have been squashed into a single step.
- Optimised versions of some key aggregated queries:
Block.transactionsCount
Epoch.transactionsCount
Epoch.blocksCount
Cardano.networkName
Transaction.size
Transaction.blockIndex
- Allow explicit ordering of
Transaction.outputs
by their naturalindex
Cardano
now matches the postgres view, and is an improvement over the previous version which performed two queries.- CLI tool
cgql
with commands to assist with Docker-based deployments, including init, snapshotting, and db rebuild. - Establish relationships to easily access transaction and block information from inputs and outputs
TransactionInput.transaction
TransactionInput.sourceTransaction
(where it was an output)TransactionOutput.transaction
CardanoDbMeta
viaQuery.cardanoDbMeta
exposes information to understand if the dataset is complete including:initialized
,syncPercentage
, andslotDiffFromNetworkTip
. Theepoch
data is incomplete untilinitialized = true
, which takes around 2 hours for the initial sync as of block number4388632
.syncPercentage
orslotDiffFromNetworkTip
provides progress.- The codebase is now modularized to enable new API segments to be added alongside as an extension, composition of services
for more use-cases, ability to import the executable schema and host on a different server. The packages are published,
to npm, or can be built from source:
- @cardano-graphql/server
- @cardano-graphql/api-cardano-db-hasura
- @cardano-graphql/client-ts
- @cardano-graphql/cli
- @cardano-graphql/util-dev
- @cardano-graphql/util
- Packages are now managed via an offline npm package cache, to facilitate reproducible builds when the --offline flag is passed to yarn install
- PostgreSQL views are now being managed in this codebase, so either switch to the
new Docker image
inputoutput/cardano-graphql-hasura
, or use the Hasura CLI as demonstrated in the entrypoint This change was needed to be compatible with the migration strategy determind bycardano-db-sync
, where the migrations need to be applied on each start of the service. The custom Docker image makes it possible to check your own docker-compose file into source control, as it supports Docker secrets, and also removes the requirement to clone this source repo to get data for mounting at runtime. - Transaction and Block IDs are now labelled as
hash
, aligning with the domain terminology. Block.merkelRootHash
->Block.merkelRoot
- The aggregated and known very large numbers are now typed as String. Cardano JS has utilities to work with these return values, currently limited to currency conversion.
Transaction.fee
previouslyString
, nowBigInt
- Entrypoint for the service previously found in
./dist/index.js
is now./packages/server/dist/index.js
after building. Cardano.blockHeight
removed in favour ofCardano.tip.number
, wheretip
= the most recentBlock
. This unlocks more information such asslotNo
, and capability to traverse the chain etc.- Dates are now coerced to RFC 3339 UTC date-time strings
- Updates to Hasura 1.2.1
- Improves CI process by consolidating the Jest snapshot files.
Block.nextBlock
Block.epochNo
is a workaround for the less performant Block.epoch.number
- Can now scope aggregated queries to the same filters as the non-aggregated counterparts
- Improves the domain-specific input type filtering, enabling control of results for Address summaries, and to deal with the model edge-cases such as Epoch Boundary Blocks needing to be excluded in most cases.
- Adds logical operators to filter fields, allowing stacking and more powerful expressions.
- Adds Block.createdBy identifier
- Corrected unnecessarily nullable fields in schema.
- Removed invalid Epoch_order_by fields
- Updates the pacakage manager to Yarn
- Runs the test suite on Jenkins with e2e assurance, deploying the service in a Docker container, and using an instance of ApolloClient to call the HTTP server. Previously the same setup suited to local development was being used, and was missing the full simulation of a real client.
- Extends API to include support for aggregated Epoch results
- Extends API to include network metadata:
protocolConst
,slotDuration
, andstartTime
- Extends API to include support for aggregated results
- Optional in-memory cache
- More control over nested list results
- Adds a load test
Initial pre-production release, scoped to the Byron-era network.