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
|
PG18 fix by https://github.com/Vonng/pg_cardano
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
|
Source
pig build pkg pg_cardano; # build rpm/debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall 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 15Create 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, withpg18as the default feature. - The simple CBOR helpers are intentionally lossy for some CBOR constructs; use the
*_extfunctions when exact structural round-tripping matters.
Last updated on