Skip to content
pg_cardano

pg_cardano

pg_cardano : A suite of Cardano-related tools

Overview

ID Extension Package Version Category License Language
2920
pg_cardano
pg_cardano
1.2.0
FEAT
MIT
Rust
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--s-d--
No
Yes
No
Yes
no
no
Relationships
See Also
age
hll
rum
pg_graphql
pg_jsonschema
jsquery
pg_hint_plan
hypopg

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT
PIGSTY
1.2.0
18
17
16
15
14
pg_cardano -
RPM
PIGSTY
1.2.0
18
17
16
15
14
pg_cardano_$v -
DEB
PIGSTY
1.2.0
18
17
16
15
14
postgresql-$v-pg-cardano -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.1.1
el8.aarch64
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.1.1
el9.x86_64
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.1.1
el9.aarch64
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.1.1
el10.x86_64
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.1.1
el10.aarch64
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.1.1
d12.x86_64
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.1.1
d12.aarch64
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.1.1
d13.x86_64
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.1.1
d13.aarch64
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.1.1
u22.x86_64
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.1.1
u22.aarch64
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.1.1
u24.x86_64
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.1.1
u24.aarch64
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.2.0
PIGSTY 1.1.1
u26.x86_64
MISS
MISS
MISS
MISS
MISS
u26.aarch64
MISS
MISS
MISS
MISS
MISS
Package Version OS ORG SIZE File URL
pg_cardano_18 1.2.0 el8.x86_64 pigsty 518.4 KiB pg_cardano_18-1.2.0-1PIGSTY.el8.x86_64.rpm
pg_cardano_18 1.2.0 el8.aarch64 pigsty 379.9 KiB pg_cardano_18-1.2.0-1PIGSTY.el8.aarch64.rpm
pg_cardano_18 1.2.0 el9.x86_64 pigsty 536.6 KiB pg_cardano_18-1.2.0-1PIGSTY.el9.x86_64.rpm
pg_cardano_18 1.2.0 el9.aarch64 pigsty 404.4 KiB pg_cardano_18-1.2.0-1PIGSTY.el9.aarch64.rpm
pg_cardano_18 1.2.0 el10.x86_64 pigsty 537.0 KiB pg_cardano_18-1.2.0-1PIGSTY.el10.x86_64.rpm
pg_cardano_18 1.2.0 el10.aarch64 pigsty 404.0 KiB pg_cardano_18-1.2.0-1PIGSTY.el10.aarch64.rpm
postgresql-18-pg-cardano 1.2.0 d12.x86_64 pigsty 434.7 KiB postgresql-18-pg-cardano_1.2.0-1PIGSTY~bookworm_amd64.deb
postgresql-18-pg-cardano 1.2.0 d12.aarch64 pigsty 305.4 KiB postgresql-18-pg-cardano_1.2.0-1PIGSTY~bookworm_arm64.deb
postgresql-18-pg-cardano 1.2.0 d13.x86_64 pigsty 434.2 KiB postgresql-18-pg-cardano_1.2.0-1PIGSTY~trixie_amd64.deb
postgresql-18-pg-cardano 1.2.0 d13.aarch64 pigsty 305.3 KiB postgresql-18-pg-cardano_1.2.0-1PIGSTY~trixie_arm64.deb
postgresql-18-pg-cardano 1.2.0 u22.x86_64 pigsty 483.1 KiB postgresql-18-pg-cardano_1.2.0-1PIGSTY~jammy_amd64.deb
postgresql-18-pg-cardano 1.2.0 u22.aarch64 pigsty 351.7 KiB postgresql-18-pg-cardano_1.2.0-1PIGSTY~jammy_arm64.deb
postgresql-18-pg-cardano 1.2.0 u24.x86_64 pigsty 478.2 KiB postgresql-18-pg-cardano_1.2.0-1PIGSTY~noble_amd64.deb
postgresql-18-pg-cardano 1.2.0 u24.aarch64 pigsty 346.1 KiB postgresql-18-pg-cardano_1.2.0-1PIGSTY~noble_arm64.deb

Source

pig build pkg pg_cardano;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pg_cardano;		# install via package name, for the active PG version

pig install pg_cardano -v 18;   # install for PG 18
pig install pg_cardano -v 17;   # install for PG 17
pig install pg_cardano -v 16;   # install for PG 16
pig install pg_cardano -v 15;   # install for PG 15

Create this extension with:

CREATE EXTENSION pg_cardano;

Usage

Sources: README, Cargo.toml version 1.2.0

pg_cardano is a Rust extension for Cardano-oriented binary and crypto utilities inside PostgreSQL. The upstream repo does not publish GitHub releases or tags, but the current crate version on the default branch is 1.2.0.

CREATE EXTENSION pg_cardano;

Core Capabilities

  • Base58 encode/decode.
  • Bech32 encode/decode.
  • CBOR to and from jsonb, with both simple and extended pipelines.
  • Blake2b hashing.
  • Ed25519 signing and signature verification.
  • dRep ID helpers for CIP-105 and CIP-129.
  • Shelley address builders and parsers.
  • Asset-name decoding and CIP-88 pool key registration verification.

Common Patterns

Base58 and Bech32:

SELECT cardano.base58_encode('Cardano'::bytea);
SELECT cardano.base58_decode('3Z6ioYHE3x');
SELECT cardano.bech32_encode('ada', 'is amazing'::bytea);
SELECT cardano.bech32_decode_prefix('ada1d9ejqctdv9axjmn8dypl4d');
SELECT cardano.bech32_decode_data('ada1d9ejqctdv9axjmn8dypl4d');

CBOR conversion:

SELECT cardano.cbor_decode_jsonb('\xa3636164616b...'::bytea);
SELECT cardano.cbor_encode_jsonb('{"ada": "is amazing!", "bytes": "\\xdeadbeef"}'::jsonb);
SELECT cardano.cbor_decode_jsonb_ext('\xa3636164616b...'::bytea);
SELECT cardano.cbor_encode_jsonb_ext('{"type":"map","value":[...]}'::jsonb);

Hashing and signatures:

SELECT cardano.blake2b_hash('Cardano is amazing!'::bytea, 32);
SELECT cardano.ed25519_verify_signature(
  '\x432753BD...'::bytea,
  'Cardano is amazing!'::bytea,
  '\x74265f96...'::bytea
);

Address and governance helpers:

SELECT cardano.tools_drep_id_encode_cip105('\x28111ae1...'::bytea, FALSE);
SELECT cardano.tools_drep_id_encode_cip129('\x28111ae1...'::bytea, TRUE);
SELECT cardano.tools_shelley_address_build(
  '\x7415251f...'::bytea, FALSE,
  '\x7c3ae2f2...'::bytea, FALSE,
  0
);
SELECT cardano.tools_shelley_addr_get_type('addr_test1vp6p2fgl...');

Caveats

  • Upstream documents PostgreSQL 12+ and Linux builds via pgrx; the crate features currently target PostgreSQL 15 through 18, with pg18 as the default feature.
  • The simple CBOR helpers are intentionally lossy for some CBOR constructs; use the *_ext functions when exact structural round-tripping matters.
Last updated on