# decodeFunctionSelectors

**Identifier:** `sourcify_decodeFunctionSelectors`

**Provider:** [Sourcify](https://kirha.com/providers/sourcify.md)

Decode EVM function selectors (4 bytes, or the first 4 bytes of calldata) and event topics (32 bytes) into readable signatures such as transfer(address,uint256), using the Sourcify signature database. Use it to understand what a transaction or a signature request will actually call, e.g., spotting a hidden approve or setApprovalForAll.

## Run it with the CLI

```bash
kirha tools run sourcify_decodeFunctionSelectors \
  --input '{
    "selectors": [
      "<selectors>"
    ]
  }'
```

`--input` takes a JSON object that matches the input schema. Pass `--input -` to read it from stdin.

## Call it over HTTP

```bash
curl https://api.kirha.com/tools/v1/execute \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: **********' \
  --data '{
  "tool_name": "sourcify_decodeFunctionSelectors",
  "input": {
    "selectors": [
      "<selectors>"
    ]
  }
}'
```

Replace the stars with an API key from https://app.kirha.com/api-keys.

## Input schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "selectors": {
      "description": "Function selectors or calldata (0x + at least 8 hex), or event topics (0x + 64 hex)",
      "items": {
        "pattern": "^0x[0-9a-fA-F]{8,}$",
        "type": "string"
      },
      "maxItems": 20,
      "minItems": 1,
      "type": "array"
    }
  },
  "required": [
    "selectors"
  ],
  "type": "object"
}
```

## Output schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "context": {
      "type": "string"
    },
    "decoded": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "input": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "function",
              "event"
            ],
            "type": "string"
          },
          "selector": {
            "type": "string"
          },
          "signatures": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "verifiedSignature": {
            "type": "string"
          }
        },
        "required": [
          "input",
          "kind",
          "selector",
          "signatures"
        ],
        "type": "object"
      },
      "type": "array"
    }
  },
  "required": [
    "context",
    "decoded"
  ],
  "type": "object"
}
```

-----

[All Sourcify tools](https://kirha.com/providers/sourcify.md) · [< Back to tools list](https://kirha.com/tools.md)