Skip to main content
Version: v2.x

Minimal Anti Collusion Infrastructure (MACI) / cidToBytes32

Function: cidToBytes32()

cidToBytes32(hash): Promise<string>

Defined in: packages/sdk/ts/utils/cid.ts:12

Converts an IPFS CIDv1 to a bytes32-compatible hex string.

This function:

  • Decodes the Base32-encoded CIDv1
  • Extracts the SHA-256 digest from the multihash
  • Converts it to a Solidity-compatible bytes32 format

Parameters

hash

string

The CIDv1 string

Returns

Promise<string>

A bytes32-compatible hex string (e.g., 0x...)