Contracts API
Get Contracts Creations

Get Contracts Creations

Overview

The Get Contracts Creations endpoint obtains data on smart contracts' creations. At least one of the following parameters must be specified: contract, origin, or caller. The range should be defined by either block_number, timestamp, or block_hash.

📘️

Multiple values can be set for the contract parameter with a maximum of five items.

Use Cases

Several possible combinations of parameters should be considered, where origin refers to the address of an EOA wallet, contract is the address of a smart contract being created, caller represents the address of a smart contract that triggers the creation of another smart contract. To retrieve specific details about contracts' creations, follow the guidelines below.

  1. For getting data on a contract's creation, specify contract.
  2. For all contracts' creations initiated by an EOA wallet, specify origin.
  3. For all contracts' creations triggered by another smart contract, specify caller.
  4. For all contracts' creations triggered by another smart contract but initiated by an EOA wallet, specify both origin and caller.
📘️

The caller and origin parameters can both represent an EOA wallet but the actual purpose of the caller field is to be used as the smart contract's address that triggers the creation of another smart contract.

Usage

In this example, we receive data from all blocks where the origin address 0xcc2c2cd417a9c39cf0e48622988dbec0b1b37064 initiated the creation of contract 0xfc934b64a945b0c99e09b9c137dabe271a5a1a06 through another smart contract 0x7c20218efc2e07c8fe2532ff860d4a5d8287cb31 specified as caller.

import * as Parsiq from '@parsiq/parsiq.js';
 
const client = Parsiq.createClient(process.env.API_KEY, Parsiq.ChainId.ETH_MAINNET);
 
const creations = client.contracts.creations.getByBlockRange(
    1, 'latest',
    {
      contract: ['0xfc934b64a945b0c99e09b9c137dabe271a5a1a06'],
      origin: '0xcc2c2cd417a9c39cf0e48622988dbec0b1b37064',
      caller: '0x7c20218efc2e07c8fe2532ff860d4a5d8287cb31'
    },
    {
      limit: 1
    }
);
 
for await (const creation of creations) {
    console.log(creation);
}

Output:

{
  id: '0000000000250d98-0007-00000001',
  contract: '0xfc934b64a945b0c99e09b9c137dabe271a5a1a06',
  caller: '0x7c20218efc2e07c8fe2532ff860d4a5d8287cb31',
  tx_hash: '0xcd5c2996bacdf42bba4c1dc66b453df6a92b77f86a7f575a706487da001c1650',
  block_hash: '0x62094ff27e5aa257dab3a2798370d207996d0814933c585d79fc6efc73f7ac2a',
  data: '0x6004600c60003960046000f3600035ff00000000000000000000000000000000',
  origin: '0xcc2c2cd417a9c39cf0e48622988dbec0b1b37064',
  block_number: 2428312,
  timestamp: 1476300836,
  value: '0',
  op_code: 'CREATE'
}

Parameters

Path params
chainId
string
REQUIRED
version
string
REQUIRED
Query params
block_number_start
number
REQUIRED
block_number_end
string
number
REQUIRED
origin
string
OR
contract
array of strings
OR
caller
string
offset
string
limit
number
estimate_cu
boolean