Skip to content

getblockmeta: allow request by height #73

New issue

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

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

Already on GitHub? # to your account

Merged
merged 2 commits into from
Mar 4, 2025

Conversation

Ximik
Copy link
Contributor

@Ximik Ximik commented Feb 11, 2025

One can use

curl -X POST http://127.0.0.1:7224 -H "Content-Type: application/json" -d '{
    "jsonrpc":"2.0",
    "method":"getblockmeta",
    "params":["00000000003a037a98a512ca38147af1d3a21d858596d24f83d65fbf2f6d5131"],
    "id":1
}'

or

curl -X POST http://127.0.0.1:7224 -H "Content-Type: application/json" -d '{
    "jsonrpc":"2.0",
    "method":"getblockmeta",
    "params":[55879],
    "id":1
}'

Both calls will return the same result

{
  "jsonrpc": "2.0",
  "result": {
    "hash": "00000000003a037a98a512ca38147af1d3a21d858596d24f83d65fbf2f6d5131",
    "height": 55879,
    "tx_meta": [
      {
        "txid": "394ebef5203c4306c3f7a6d1a5c2058bac130deb24c1d7725094b31d1ff54ea4",
        "spends": [
          {
            "n": 0
          }
        ],
        "creates": [
          {
            "n": 0,
            "value": 662,
            "script_pubkey": "512065a7b5051fe33239e6ddb0d69e809a74d1702fde541bdf3431c6994b72317f33"
          }
        ],
        "updates": []
      },
      {
        "txid": "f811529d79c9fc808c240a1b5087ba19610c4177a01ffa8047c3cc143cf3eb1a",
        "spends": [
          {
            "n": 0
          },
          {
            "n": 1
          },
          {
            "n": 2
          },
          {
            "n": 3
          }
        ],
        "creates": [
          {
            "n": 1,
            "name": "@bitcoin",
            "covenant": {
              "type": "transfer",
              "expire_height": 108439,
              "data": "68656c6c6f20776f726c64"
            },
            "value": 666,
            "script_pubkey": "5120611454515f9fe8c656f80c51de229dc5d9cba9a05d00486b43a1e9033ef6393b"
          }
        ],
        "updates": []
      }
    ]
  },
  "id": 1
}

Copy link
Member

@buffrr buffrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, also please limit code changes to the thing being added/updated. Avoid formatting changes/or at least have them in a separate commit.

@Ximik Ximik force-pushed the block_by_height branch from 3f0740f to 94bcc11 Compare March 4, 2025 12:04
@Ximik Ximik requested a review from buffrr March 4, 2025 18:17
Copy link
Member

@buffrr buffrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks

@buffrr buffrr merged commit d8f23f4 into spacesprotocol:main Mar 4, 2025
1 check passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants