Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return contract_abi in Stacks transaction metadata #376

Closed
rafaelcr opened this issue Aug 10, 2023 · 0 comments · Fixed by #378
Closed

return contract_abi in Stacks transaction metadata #376

rafaelcr opened this issue Aug 10, 2023 · 0 comments · Fixed by #378
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@rafaelcr
Copy link
Collaborator

rafaelcr commented Aug 10, 2023

The Stacks node sends the contract_abi in RPC events whenever it finds a transaction that deployed a smart contract:

    {
      "txid": "0xb55e53065b3e934716eb0f7dcce5138b719ea247459f18f60893e15c8d9a0159",
      "raw_tx": "0x00000... (truncated)",
      "status": "success",
      "tx_index": 49,
      "raw_result": "0x0703",
      "burnchain_op": null,
      "contract_abi": {
        "maps": [
          {
            "key": {
              "tuple": [
                { "name": "name", "type": { "buffer": { "length": 48 } } },
                { "name": "namespace", "type": { "buffer": { "length": 20 } } }
              ]
            },
            "name": "map_claimed_bns_note",
            "value": "bool"
          },
          {
            "key": "uint128",
            "name": "map_claimed_member_note",
            "value": "bool"
          }
        ],
        "epoch": "Epoch24",
        "functions": [

It would be extremely useful to the Metadata API (and other users) if that contract ABI was included as part of the transaction metadata in chainhook events. Something like:

      "transactions": [
        {
          "metadata": {
            "description": "deployed: SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.arkadiko-dao",
            "execution_cost": {
              "read_count": 41,
              "read_length": 366,
              "runtime": 165143000,
              "write_count": 47,
              "write_length": 31680
            },
            "contract_abi": {
        "maps": [
          {
            "key": {
              "tuple": [
                { "name": "name", "type": { "buffer": { "length": 48 } } },
                { "name": "namespace", "type": { "buffer": { "length": 20 } } }
              ]
            },
            "name": "map_claimed_bns_note",
            "value": "bool"
          },
          ...

Implementation idea: Hide this feature behind CONTRACT_ABI flag. Make it opt-in (default FALSE).

@rafaelcr rafaelcr added the enhancement New feature or request label Aug 10, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New in DevTools Aug 10, 2023
@smcclellan smcclellan moved this from 🆕 New to 📋 Backlog in DevTools Aug 14, 2023
@MicaiahReid MicaiahReid moved this from 📋 Backlog to 🏗 In Progress in DevTools Aug 16, 2023
@MicaiahReid MicaiahReid moved this from 🏗 In Progress to 👀 In Review in DevTools Aug 20, 2023
@smcclellan smcclellan linked a pull request Aug 21, 2023 that will close this issue
2 tasks
@smcclellan smcclellan modified the milestones: Q3-2023, Q4-2023 Aug 28, 2023
@github-project-automation github-project-automation bot moved this from 👀 In Review to ✅ Done in DevTools Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants