pg_cryptocurrency
pg_cryptocurrency · Native blockchain asset, amount, address, and uint256 types
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 101973 | pg_cryptocurrency | pg_cryptocurrency | 0.2.0 | TYPE | MIT | Rust |
PostgreSQL · 14, 15, 16, 17, 18
Usage
Sources:
pg_cryptocurrency supplies exact blockchain asset amounts, network-qualified identities, addresses, and unsigned 256-bit integers on PostgreSQL 14–18. It performs no blockchain access or network requests.
Core Workflow
Objects and Identity
crypto_amount binds an exact amount to an asset. crypto_asset identifies native currencies and tokens; crypto_address validates network-qualified addresses, and uint256 stores unsigned 256-bit values. crypto_register_asset registers a token using its symbol, network, contract, and decimals. crypto_amount_value, crypto_amount_asset, and crypto_amount_network inspect a value.
A ticker alone is not token identity: network and contract matter. Mixed-asset arithmetic fails rather than converting implicitly. Conversion to smallest units checks the asset scale and amount bounds. Address validation does not prove ownership or on-chain existence.
Operation
The extension is relocatable and requires no preload. Administrative registry operations need explicit privilege review. The optional adapter for pg_money is separate from the core type workflow; installing this extension does not establish a wallet, custody service, or exchange-rate source.