Skip to content

Data Structures

Database record structure for storing processed blockchain transactions:

interface TransactionData {
id: string;
chain_id: number;
transaction_hash: string;
contract_address: string;
parsed_input: string | null;
document_data: string | null;
event_published: string | null;
}

RabbitMQ message format for publishing blockchain events:

interface BlockchainEvent {
eventType: string;
chainId: number;
txHash: string;
correlationId: string;
processHash?: string;
integraHash?: string;
data: Record<string, unknown>;
}

Alchemy webhook payload structure:

interface AlchemyWebhook {
webhookId: string;
type: string;
event: {
network: string;
activity: AlchemyActivity[];
};
}

Individual blockchain activity record:

interface AlchemyActivity {
fromAddress: string;
toAddress: string;
hash: string;
value: number;
asset: string;
category: string;
rawContract: {
address: string;
value: string;
};
log?: {
address: string;
topics: string[];
data: string;
logIndex: string;
};
}

Constant mapping between Alchemy network names and blockchain chain IDs:

const ALCHEMY_NETWORK_TO_CHAIN_ID = {
'ETH_MAINNET': 1,
'MATIC_MAINNET': 137,
'ETH_SEPOLIA': 11155111,
'MATIC_AMOY': 80002
};