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.1.1
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.1.1
18
17
16
15
14
pg_cardano -
RPM
PIGSTY
1.1.1
18
17
16
15
14
pg_cardano_$v -
DEB
PIGSTY
1.1.1
18
17
16
15
14
postgresql-$v-pg-cardano -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
el8.aarch64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
el9.x86_64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
el9.aarch64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
el10.x86_64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
el10.aarch64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
d12.x86_64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
d12.aarch64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
d13.x86_64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
d13.aarch64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
u22.x86_64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
u22.aarch64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
u24.x86_64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
u24.aarch64
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
PIGSTY 1.1.1
Package Version OS ORG SIZE File URL
pg_cardano_18 1.1.1 el8.x86_64 pigsty 523.1 KiB pg_cardano_18-1.1.1-1PIGSTY.el8.x86_64.rpm
pg_cardano_18 1.1.1 el8.aarch64 pigsty 378.9 KiB pg_cardano_18-1.1.1-1PIGSTY.el8.aarch64.rpm
pg_cardano_18 1.1.1 el9.x86_64 pigsty 540.7 KiB pg_cardano_18-1.1.1-1PIGSTY.el9.x86_64.rpm
pg_cardano_18 1.1.1 el9.aarch64 pigsty 402.5 KiB pg_cardano_18-1.1.1-1PIGSTY.el9.aarch64.rpm
pg_cardano_18 1.1.1 el10.x86_64 pigsty 539.5 KiB pg_cardano_18-1.1.1-1PIGSTY.el10.x86_64.rpm
pg_cardano_18 1.1.1 el10.aarch64 pigsty 403.5 KiB pg_cardano_18-1.1.1-1PIGSTY.el10.aarch64.rpm
postgresql-18-pg-cardano 1.1.1 d12.x86_64 pigsty 445.2 KiB postgresql-18-pg-cardano_1.1.1-1PIGSTY~bookworm_amd64.deb
postgresql-18-pg-cardano 1.1.1 d12.aarch64 pigsty 311.7 KiB postgresql-18-pg-cardano_1.1.1-1PIGSTY~bookworm_arm64.deb
postgresql-18-pg-cardano 1.1.1 d13.x86_64 pigsty 445.3 KiB postgresql-18-pg-cardano_1.1.1-1PIGSTY~trixie_amd64.deb
postgresql-18-pg-cardano 1.1.1 d13.aarch64 pigsty 312.0 KiB postgresql-18-pg-cardano_1.1.1-1PIGSTY~trixie_arm64.deb
postgresql-18-pg-cardano 1.1.1 u22.x86_64 pigsty 493.9 KiB postgresql-18-pg-cardano_1.1.1-1PIGSTY~jammy_amd64.deb
postgresql-18-pg-cardano 1.1.1 u22.aarch64 pigsty 356.7 KiB postgresql-18-pg-cardano_1.1.1-1PIGSTY~jammy_arm64.deb
postgresql-18-pg-cardano 1.1.1 u24.x86_64 pigsty 488.3 KiB postgresql-18-pg-cardano_1.1.1-1PIGSTY~noble_amd64.deb
postgresql-18-pg-cardano 1.1.1 u24.aarch64 pigsty 352.1 KiB postgresql-18-pg-cardano_1.1.1-1PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
pg_cardano_17 1.1.1 el8.x86_64 pigsty 522.9 KiB pg_cardano_17-1.1.1-1PIGSTY.el8.x86_64.rpm
pg_cardano_17 1.1.1 el8.aarch64 pigsty 379.5 KiB pg_cardano_17-1.1.1-1PIGSTY.el8.aarch64.rpm
pg_cardano_17 1.1.1 el9.x86_64 pigsty 540.1 KiB pg_cardano_17-1.1.1-1PIGSTY.el9.x86_64.rpm
pg_cardano_17 1.1.1 el9.aarch64 pigsty 402.9 KiB pg_cardano_17-1.1.1-1PIGSTY.el9.aarch64.rpm
pg_cardano_17 1.1.1 el10.x86_64 pigsty 539.7 KiB pg_cardano_17-1.1.1-1PIGSTY.el10.x86_64.rpm
pg_cardano_17 1.1.1 el10.aarch64 pigsty 403.5 KiB pg_cardano_17-1.1.1-1PIGSTY.el10.aarch64.rpm
postgresql-17-pg-cardano 1.1.1 d12.x86_64 pigsty 444.9 KiB postgresql-17-pg-cardano_1.1.1-1PIGSTY~bookworm_amd64.deb
postgresql-17-pg-cardano 1.1.1 d12.aarch64 pigsty 311.7 KiB postgresql-17-pg-cardano_1.1.1-1PIGSTY~bookworm_arm64.deb
postgresql-17-pg-cardano 1.1.1 d13.x86_64 pigsty 445.3 KiB postgresql-17-pg-cardano_1.1.1-1PIGSTY~trixie_amd64.deb
postgresql-17-pg-cardano 1.1.1 d13.aarch64 pigsty 311.8 KiB postgresql-17-pg-cardano_1.1.1-1PIGSTY~trixie_arm64.deb
postgresql-17-pg-cardano 1.1.1 u22.x86_64 pigsty 493.7 KiB postgresql-17-pg-cardano_1.1.1-1PIGSTY~jammy_amd64.deb
postgresql-17-pg-cardano 1.1.1 u22.aarch64 pigsty 357.2 KiB postgresql-17-pg-cardano_1.1.1-1PIGSTY~jammy_arm64.deb
postgresql-17-pg-cardano 1.1.1 u24.x86_64 pigsty 488.0 KiB postgresql-17-pg-cardano_1.1.1-1PIGSTY~noble_amd64.deb
postgresql-17-pg-cardano 1.1.1 u24.aarch64 pigsty 352.0 KiB postgresql-17-pg-cardano_1.1.1-1PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
pg_cardano_16 1.1.1 el8.x86_64 pigsty 522.7 KiB pg_cardano_16-1.1.1-1PIGSTY.el8.x86_64.rpm
pg_cardano_16 1.1.1 el8.aarch64 pigsty 378.9 KiB pg_cardano_16-1.1.1-1PIGSTY.el8.aarch64.rpm
pg_cardano_16 1.1.1 el9.x86_64 pigsty 539.7 KiB pg_cardano_16-1.1.1-1PIGSTY.el9.x86_64.rpm
pg_cardano_16 1.1.1 el9.aarch64 pigsty 402.4 KiB pg_cardano_16-1.1.1-1PIGSTY.el9.aarch64.rpm
pg_cardano_16 1.1.1 el10.x86_64 pigsty 539.3 KiB pg_cardano_16-1.1.1-1PIGSTY.el10.x86_64.rpm
pg_cardano_16 1.1.1 el10.aarch64 pigsty 403.4 KiB pg_cardano_16-1.1.1-1PIGSTY.el10.aarch64.rpm
postgresql-16-pg-cardano 1.1.1 d12.x86_64 pigsty 445.4 KiB postgresql-16-pg-cardano_1.1.1-1PIGSTY~bookworm_amd64.deb
postgresql-16-pg-cardano 1.1.1 d12.aarch64 pigsty 312.0 KiB postgresql-16-pg-cardano_1.1.1-1PIGSTY~bookworm_arm64.deb
postgresql-16-pg-cardano 1.1.1 d13.x86_64 pigsty 445.8 KiB postgresql-16-pg-cardano_1.1.1-1PIGSTY~trixie_amd64.deb
postgresql-16-pg-cardano 1.1.1 d13.aarch64 pigsty 311.9 KiB postgresql-16-pg-cardano_1.1.1-1PIGSTY~trixie_arm64.deb
postgresql-16-pg-cardano 1.1.1 u22.x86_64 pigsty 494.1 KiB postgresql-16-pg-cardano_1.1.1-1PIGSTY~jammy_amd64.deb
postgresql-16-pg-cardano 1.1.1 u22.aarch64 pigsty 357.1 KiB postgresql-16-pg-cardano_1.1.1-1PIGSTY~jammy_arm64.deb
postgresql-16-pg-cardano 1.1.1 u24.x86_64 pigsty 488.3 KiB postgresql-16-pg-cardano_1.1.1-1PIGSTY~noble_amd64.deb
postgresql-16-pg-cardano 1.1.1 u24.aarch64 pigsty 352.5 KiB postgresql-16-pg-cardano_1.1.1-1PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
pg_cardano_15 1.1.1 el8.x86_64 pigsty 522.7 KiB pg_cardano_15-1.1.1-1PIGSTY.el8.x86_64.rpm
pg_cardano_15 1.1.1 el8.aarch64 pigsty 379.0 KiB pg_cardano_15-1.1.1-1PIGSTY.el8.aarch64.rpm
pg_cardano_15 1.1.1 el9.x86_64 pigsty 539.4 KiB pg_cardano_15-1.1.1-1PIGSTY.el9.x86_64.rpm
pg_cardano_15 1.1.1 el9.aarch64 pigsty 402.6 KiB pg_cardano_15-1.1.1-1PIGSTY.el9.aarch64.rpm
pg_cardano_15 1.1.1 el10.x86_64 pigsty 538.9 KiB pg_cardano_15-1.1.1-1PIGSTY.el10.x86_64.rpm
pg_cardano_15 1.1.1 el10.aarch64 pigsty 403.7 KiB pg_cardano_15-1.1.1-1PIGSTY.el10.aarch64.rpm
postgresql-15-pg-cardano 1.1.1 d12.x86_64 pigsty 445.8 KiB postgresql-15-pg-cardano_1.1.1-1PIGSTY~bookworm_amd64.deb
postgresql-15-pg-cardano 1.1.1 d12.aarch64 pigsty 311.5 KiB postgresql-15-pg-cardano_1.1.1-1PIGSTY~bookworm_arm64.deb
postgresql-15-pg-cardano 1.1.1 d13.x86_64 pigsty 445.5 KiB postgresql-15-pg-cardano_1.1.1-1PIGSTY~trixie_amd64.deb
postgresql-15-pg-cardano 1.1.1 d13.aarch64 pigsty 312.2 KiB postgresql-15-pg-cardano_1.1.1-1PIGSTY~trixie_arm64.deb
postgresql-15-pg-cardano 1.1.1 u22.x86_64 pigsty 494.0 KiB postgresql-15-pg-cardano_1.1.1-1PIGSTY~jammy_amd64.deb
postgresql-15-pg-cardano 1.1.1 u22.aarch64 pigsty 357.4 KiB postgresql-15-pg-cardano_1.1.1-1PIGSTY~jammy_arm64.deb
postgresql-15-pg-cardano 1.1.1 u24.x86_64 pigsty 488.4 KiB postgresql-15-pg-cardano_1.1.1-1PIGSTY~noble_amd64.deb
postgresql-15-pg-cardano 1.1.1 u24.aarch64 pigsty 352.5 KiB postgresql-15-pg-cardano_1.1.1-1PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
pg_cardano_14 1.1.1 el8.x86_64 pigsty 522.9 KiB pg_cardano_14-1.1.1-1PIGSTY.el8.x86_64.rpm
pg_cardano_14 1.1.1 el8.aarch64 pigsty 379.5 KiB pg_cardano_14-1.1.1-1PIGSTY.el8.aarch64.rpm
pg_cardano_14 1.1.1 el9.x86_64 pigsty 539.5 KiB pg_cardano_14-1.1.1-1PIGSTY.el9.x86_64.rpm
pg_cardano_14 1.1.1 el9.aarch64 pigsty 402.9 KiB pg_cardano_14-1.1.1-1PIGSTY.el9.aarch64.rpm
pg_cardano_14 1.1.1 el10.x86_64 pigsty 538.9 KiB pg_cardano_14-1.1.1-1PIGSTY.el10.x86_64.rpm
pg_cardano_14 1.1.1 el10.aarch64 pigsty 403.4 KiB pg_cardano_14-1.1.1-1PIGSTY.el10.aarch64.rpm
postgresql-14-pg-cardano 1.1.1 d12.x86_64 pigsty 445.3 KiB postgresql-14-pg-cardano_1.1.1-1PIGSTY~bookworm_amd64.deb
postgresql-14-pg-cardano 1.1.1 d12.aarch64 pigsty 311.5 KiB postgresql-14-pg-cardano_1.1.1-1PIGSTY~bookworm_arm64.deb
postgresql-14-pg-cardano 1.1.1 d13.x86_64 pigsty 445.1 KiB postgresql-14-pg-cardano_1.1.1-1PIGSTY~trixie_amd64.deb
postgresql-14-pg-cardano 1.1.1 d13.aarch64 pigsty 311.6 KiB postgresql-14-pg-cardano_1.1.1-1PIGSTY~trixie_arm64.deb
postgresql-14-pg-cardano 1.1.1 u22.x86_64 pigsty 494.2 KiB postgresql-14-pg-cardano_1.1.1-1PIGSTY~jammy_amd64.deb
postgresql-14-pg-cardano 1.1.1 u22.aarch64 pigsty 357.0 KiB postgresql-14-pg-cardano_1.1.1-1PIGSTY~jammy_arm64.deb
postgresql-14-pg-cardano 1.1.1 u24.x86_64 pigsty 488.4 KiB postgresql-14-pg-cardano_1.1.1-1PIGSTY~noble_amd64.deb
postgresql-14-pg-cardano 1.1.1 u24.aarch64 pigsty 351.9 KiB postgresql-14-pg-cardano_1.1.1-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
pig install pg_cardano -v 14;   # install for PG 14

Create this extension with:

CREATE EXTENSION pg_cardano;

Usage

pg_cardano: Cardano blockchain data types and cryptographic functions for PostgreSQL

The pg_cardano extension provides cryptographic and utility functions for working with Cardano blockchain data in PostgreSQL, including Base58, Bech32, CBOR, Blake2b, Ed25519, and Shelley address utilities.

CREATE EXTENSION pg_cardano;

Base58 Encoding/Decoding

SELECT cardano.base58_encode('Cardano'::bytea);
-- '3Z6ioYHE3x'

SELECT cardano.base58_decode('3Z6ioYHE3x');
-- '\x43617264616e6f'

Bech32 Encoding/Decoding

SELECT cardano.bech32_encode('ada', 'is amazing'::bytea);
-- 'ada1d9ejqctdv9axjmn8dypl4d'

SELECT cardano.bech32_decode_prefix('ada1d9ejqctdv9axjmn8dypl4d');
-- 'ada'

SELECT cardano.bech32_decode_data('ada1d9ejqctdv9axjmn8dypl4d');
-- '\x697320616d617a696e67'

CBOR Encoding/Decoding

Simple CBOR (lightweight, sufficient for most Cardano tasks):

SELECT cardano.cbor_decode_jsonb('\xa3636164616b...'::bytea);
SELECT cardano.cbor_encode_jsonb('{"ada": "is amazing!", "bytes": "\\xdeadbeef"}'::jsonb);

Extended CBOR (full support, no limitations):

SELECT cardano.cbor_decode_jsonb_ext('\xa3636164616b...'::bytea);
SELECT cardano.cbor_encode_jsonb_ext('{"type":"map","value":[...]}'::jsonb);

Blake2b Hashing

SELECT cardano.blake2b_hash('Cardano is amazing!'::bytea, 32);
-- '\x2244d5c9699fa93b...'

Ed25519 Signing and Verification

SELECT cardano.ed25519_sign_message(
    '\x43D68AEC...'::bytea,       -- signing key
    'Cardano is amazing!'::bytea   -- message
);

SELECT cardano.ed25519_verify_signature(
    '\x432753BD...'::bytea,        -- verification key
    'Cardano is amazing!'::bytea,  -- message
    '\x74265f96...'::bytea         -- signature
);
-- true

dRep View ID Builders (CIP-105/CIP-129)

SELECT cardano.tools_drep_id_encode_cip105('\x28111ae1...'::bytea, FALSE);
-- 'drep_vkh19qg34ctllr7lh48nnj4akfc978qzqzuwzkgsdu6r3zc42lnl6a0'

SELECT cardano.tools_drep_id_encode_cip129('\x28111ae1...'::bytea, TRUE);
-- 'drep1yv5pzxhp0lu0m7757ww2hke8qhcuqgqt3c2ezphngwytz4gj324g7'

Shelley Address Utilities

-- Build a base address
SELECT cardano.tools_shelley_address_build(
    '\x7415251f...'::bytea, FALSE,  -- payment cred, is_script
    '\x7c3ae2f2...'::bytea, FALSE,  -- stake cred, is_script
    0                                -- network id
);

-- Extract payment/stake credentials
SELECT cardano.tools_shelley_addr_extract_payment_cred('addr_test1qp6p2fgl...');
SELECT cardano.tools_shelley_addr_extract_stake_cred('addr_test1qp6p2fgl...');

-- Get address type
SELECT cardano.tools_shelley_addr_get_type('addr_test1vp6p2fgl...');
-- 'PMT_KEY:NONE'

Asset Name Conversion

SELECT cardano.tools_read_asset_name('hello'::bytea);
-- 'hello' (valid UTF-8 returned as string)

SELECT cardano.tools_read_asset_name('\xdeadbeef'::bytea);
-- 'deadbeef' (non-UTF-8 returned as hex)

CIP-88 Pool Key Registration Verification

SELECT cardano.tools_verify_cip88_pool_key_registration('\xa119...'::bytea);
-- true
Last updated on