Logs

Get event logs by transaction hash

Returns the event logs by transaction hash.

Sample request

https://api.thespectre.io/api
   ?module=logs
   &action=getlogs
   &hash=0x5d46e804447353e3c7785d8c618fde6b9d68a5ecdcc7323463ddff5ea76aa6fa
   &offset=0
   &limit=10
   &apikey=YourApiKeyToken

Request query parameters

ParameterDescription

hash*

the string representing the transaction hash

offset

skips the offset records before beginning to return the records, default value is 0

limit

the number of records displayed per page, default value is 10000

Sample response

{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "address":"0xdac17f958d2ee523a2206206994597c13d831ec7",
            "blockNumber":"18468653",
            "data":"0x0000000000000000000000000000000000000000000000000000000002ca0254",
            "logIndex":"388",
            "topics":[
                "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                "0x0000000000000000000000008c8d7c46219d9205f056f28fee5950ad564d7465",
                "0x00000000000000000000000088b50d989682dac8f1b9e4f7bd29883138bd7154"
            ],
            "transactionHash":"0x5d46e804447353e3c7785d8c618fde6b9d68a5ecdcc7323463ddff5ea76aa6fa",
            "decoded": {
                "method_call":"Transfer(address indexed from, address indexed to, uint256 value)",
                "method_id":"0xddf252ad",
                "parameters":[
                    {
                        "indexed":true,
                        "name":"from",
                        "type":"address",
                        "value":"0x8c8d7c46219d9205f056f28fee5950ad564d7465"
                    },
                    {
                        "indexed":true,
                        "name":"to",
                        "type":"address",
                        "value":"0x88b50d989682dac8f1b9e4f7bd29883138bd7154"
                    },
                    {
                        "indexed":false,
                        "name":"value",
                        "type":"uint256",
                        "value":"46793300"
                    }
                ]
            },
        }
    ]
}

Get event logs by address

Returns the event logs from an address, with optional filtering by block range.

Sample request

https://api.thespectre.io/api
   ?module=logs
   &action=getlogs
   &address=0xdac17f958d2ee523a2206206994597c13d831ec7
   &startblock=12878196
   &endblock=12878196
   &offset=0
   &limit=10
   &sort=asc
   &apikey=YourApiKeyToken

Request query parameters

ParameterDescription

address*

the string representing the address to check for logs

startblock

the integer block number to start searching for logs

endblock

the integer block number to stop searching for logs

offset

skips the offset records before beginning to return the records, default value is 0

limit

the number of records displayed per page, default value is 10000

sort

the sorting preference, use asc to sort by ascending and desc to sort by descending, default value is asc

Sample response

{
    "status": "1",
    "message": "OK",
    "result": [
        {
            "address":"0xdac17f958d2ee523a2206206994597c13d831ec7",
            "blockNumber":"18468653",
            "data":"0x0000000000000000000000000000000000000000000000000000000002ca0254",
            "logIndex":"388",
            "topics":[
                "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                "0x0000000000000000000000008c8d7c46219d9205f056f28fee5950ad564d7465",
                "0x00000000000000000000000088b50d989682dac8f1b9e4f7bd29883138bd7154"
            ],
            "transactionHash":"0x5d46e804447353e3c7785d8c618fde6b9d68a5ecdcc7323463ddff5ea76aa6fa",
            "decoded": {
                "method_call":"Transfer(address indexed from, address indexed to, uint256 value)",
                "method_id":"0xddf252ad",
                "parameters":[
                    {
                        "indexed":true,
                        "name":"from",
                        "type":"address",
                        "value":"0x8c8d7c46219d9205f056f28fee5950ad564d7465"
                    },
                    {
                        "indexed":true,
                        "name":"to",
                        "type":"address",
                        "value":"0x88b50d989682dac8f1b9e4f7bd29883138bd7154"
                    },
                    {
                        "indexed":false,
                        "name":"value",
                        "type":"uint256",
                        "value":"46793300"
                    }
                ]
            },
        }
    ]
}

Get event logs count

Returns the event logs count either by transaction hash or by address.

Sample request

https://api.thespectre.io/api
   ?module=logs
   &action=getlogscount
   &hash=0x4ffd22d986913d33927a392fe4319bcd2b62f3afe1c15a2c59f77fc2cc4c20a9
   &apikey=YourApiKeyToken

Request query parameters

ParameterDescription

hash*

the string representing the transaction hash

address*

the string representing the address to check for logs

startblock

the integer block number to start searching for logs

endblock

the integer block number to stop searching for logs

offset

skips the offset records before beginning to return the records, default value is 0

limit

the number of records displayed per page, default value is 10000

Usage:

  • In order to get event logs count by transaction hash, specify the hash parameter

  • In order to get event logs count by address, specify the address parameter with optional filtering by block range (startblock and endblock parameters)

Sample response

{
    "status": "1",
    "message": "OK",
    "result": "32"
}

Last updated