dcrdata
- provider
- create("dcrdata")
- auth
- none
- chains
- Decred
- capabilities
- balance, history, tx detail, block
- endpoint
- explorer.dcrdata.org/insight/api
- default chain
- decred
Address it
import { Dcrdata } from "@agntn/explorers/providers/dcrdata";
const dcrdata = new Dcrdata(); // or create("dcrdata"), or { baseUrl: "https://my.dcrdata/insight/api" }
await dcrdata.getBalance("Ds…", "decred");
await dcrdata.getBlockInfo(1000, "decred");
One chain, no key. baseUrl is the Insight root and defaults to https://explorer.dcrdata.org/insight/api, so a dcrdata you run yourself works too. Any other chain is an UnsupportedChainError, and an address that isn't a Decred mainnet address fails before a request goes out.
What it reads
/addr/:address?noTxList=1 for the balance, /addrs/:address/txs?from=&to= for history, /tx/:hash for one transaction, /block/:height for a block. Balances, history, details and blocks; no tokens, contracts, gas or unspent outputs.
Gotchas
- Atoms, eight decimals. Insight quotes DCR as floating point numbers, sometimes in scientific notation, and the provider converts the decimal spelling to atoms without ever multiplying a float.
balanceSatand friends come as integers and stay integers. balance,fundedandspentare confirmed. The signed mempool delta goes tounconfirmed, so a pending payment never shows up as money you can spend.- History pages with
fromandto, up to 250 rows a page, andstartBlockandendBlockthrow because Insight has no block filter.sort: "asc"costs a second request: the provider reads the total first, then the window from the other end, and refuses the page if the total moved in between. confirmationsdecides the status: 0 ispendingwith block number 0, below zero isfailed. Coinbase and treasurybase transactions get fee"0", everything else the fee Insight quotes or none.- Blocks come back with an empty
minerand gas fields of"0", like every other chain without gas. The block's transaction count is the length of itstxlist. - The Explorer has no live feed for Decred and no block transaction list. The feed only wraps Blockscout, Mempool and the Arweave gateway, so search works and the hub says there's no tip.
Where it lives
src/providers/dcrdata.ts.
Arweave gateway
Wallet and block REST plus the GraphQL index of a gateway. arweave.net by default. Winstons. No gas. History that stays on one gateway.
Chains
The 24 chains the built-in providers serve. Which provider answers for each and which operations any of them cover. Read from the registry and not typed in.