0x-prefixed hex string of a 32-byte hash digest
(66 characters total: "0x" + 64 hex chars).
Multihash code of the hashing algorithm (default: blake2b-256 0xb220).
Use HashAlgorithm for the supported values.
Multicodec code of the CID codec (default: raw 0x55).
Use CidCodec for the supported values.
Base32-lower CIDv1 string.
import { hashToCid, HashAlgorithm, CidCodec, gatewayUrl, getGateway } from "@polkadot-apps/bulletin";
// Default (blake2b-256, raw) — matches computeCid output
const cid = hashToCid(onChainHash);
// SHA2-256 content stored via bulletin-deploy
const cid2 = hashToCid(onChainHash, HashAlgorithm.Sha2_256);
// DAG-PB manifest with blake2b-256
const cid3 = hashToCid(manifestHash, HashAlgorithm.Blake2b256, CidCodec.DagPb);
const url = gatewayUrl(cid, getGateway("paseo"));
Reconstruct a CIDv1 from a
0x-prefixed hex hash stored on-chain.This is the inverse of cidToPreimageKey: given a 32-byte content hash and the CID configuration used when the data was stored, it rebuilds the original CIDv1 so you can construct IPFS gateway URLs.
The Bulletin Chain supports multiple hash algorithms and codecs — pass the values that match the on-chain
TransactionInfoto get the correct CID. When omitted, defaults match computeCid (blake2b-256, raw).