postgreChain
postgreChain · Query Solana RPC data and perform wallet, airdrop, and transfer operations directly from PostgreSQL
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100818 | postgreChain | postgreChain | 0.0.0 | UTIL | MIT | Rust |
PostgreSQL · 11, 12, 13, 14, 15, 16
Usage
Sources:
postgreChain version 0.0.0 exposes synchronous Solana RPC operations as PostgreSQL functions. It can read balances and program accounts, create wallets, request test-network airdrops, and submit transfers; network calls run inside the database backend, so latency, failures, and secret handling directly affect database sessions.
Core Workflow
Supported network strings are mainnet, devnet, testnet, and localhost. The pinned implementation silently falls back to devnet for any other value, so validate the network in application code.
Main Functions
pc_balance(address, network)returns the account balance in lamports; the implementation returns zero on address or RPC errors.pc_token_account_balance(address, network)returns an SPL token-account balance and also returns zero on error.pc_get_program_accounts(program_id, network)returns account keys, data lengths, lamports, rent epochs, and executable flags.pc_create_wallet()returns a newly generated public key and Base58-encoded secret key.pc_airdrop(address, amount, network)requests SOL and returns success as boolean.pc_transfer(public_key, secret_key, destination, amount, network)signs and submits a SOL transfer and returns success as boolean.
Security and Transaction Boundaries
Restrict execution aggressively. Wallet creation returns the secret key through SQL results, and transfer calls accept it as a SQL argument, which can expose it through client logs, statement logging, activity views, monitoring, or query history. A blockchain transfer or airdrop is an external side effect and is not rolled back with the surrounding PostgreSQL transaction.
RPC calls are synchronous and use fixed public Solana endpoints for the named networks. The catalog version is 0.0.0 and the source uses pgrx 0.11.3 with build features for PostgreSQL 11 through 16; verify the exact compiled package against your server and test on a non-production network before granting access.