You can upload and manage any smart contract of interest through the CDP Portal, CDP SDK or the CDP API. It simplifies the retrieval of event data from specific smart contracts, making it easier to integrate blockchain data into your application.
Here are some quickstart examples for using the Smart Contract Events API.
You can retrieve smart contract events using either:
Both methods support various blockchain networks and allow seamless integration into your infrastructure.
The following is an example of a parsed smart contract event. This is typically returned when you query for events using the indexer.
Field | Description |
---|---|
networkId | Blockchain network for the smart contract, e.g., base-mainnet . |
protocolName | Name of the blockchain protocol, e.g., public . |
contractName | Name of the smart contract, e.g., AERO . |
eventName | Type of event, e.g., token transfer. |
sig | The event signature for the smart contract event. |
fourBytes | The first 4 bytes (8 hex characters) of the Keccak-256 hash of the event signature (also known as the event topic). |
contractAddress | Address of the smart contract. |
blockTime | Timestamp when the block was mined. |
blockHeight | Number of the block containing the transaction. |
txHash | Hash of the transaction that triggered the event. |
txIndex | Position of the transaction within the block. |
eventIndex | Position of the event log within the transaction. |
data | The event-specific data emitted during the event in JSON format, e.g., - from : Address of the sender in the token transfer. - to : Address of the recipient. - value : Amount of tokens transferred. |
The following is an example of a smart contract object.
Field | Description |
---|---|
abi | ABI of the smart contract |
network_id | Blockchain network for the smart contract, e.g., base-mainnet . |
contract_name | Name of the smart contract, e.g., AERO . |
contract_address | Address of the smart contract. |
type | Type of the smart contract. “Custom” indicates the contract is uploaded by yourself |
smart_contract_id | ID of the smart contract |