Skip to content

RFC: Support a format description of our JSON-RPC interface#34683

Draft
willcl-ark wants to merge 14 commits intobitcoin:masterfrom
willcl-ark:json-rpc-schema
Draft

RFC: Support a format description of our JSON-RPC interface#34683
willcl-ark wants to merge 14 commits intobitcoin:masterfrom
willcl-ark:json-rpc-schema

Conversation

@willcl-ark
Copy link
Member

@willcl-ark willcl-ark commented Feb 26, 2026

Ref #29912.

This draft PR adds a machine-readable OpenRPC 1.3.2 specification of out JSON-RPC interface, auto-generated from existing RPCHelpMan metadata.

There is currently no formal, machine-readable specification of the RPC API. As discussed in #29912, this has knock-on consequences:

  • Client libraries re-implement the API manually, leading to bugs like unit mistakes (sats vs BTC, vB vs kvB) and missing/incorrect argument types. No existing client library fully and correctly implements the API in a type-safe manner.
  • When the API changes, every downstream client must manually discover and adapt, creating downstream maintenance burden. There is no artifact they can diff between releases.
  • Implementing a new client in a new language requires reading C++ source or help text and transcribing it, which is error-prone and tedious, and represents an on-going porting cost.
  • Existing documentation is either stale or not machine-readable. The developer.bitcoin.org docs are wrong/outdated in places, and the bitcoincore.org/en/doc/ pages are rendered from help output but not in a standard schema format.
  • (new/extra) AI/LLM tooling increasingly builds on structured API specifications. A standard spec format enables AI-assisted client generation and integration without the ambiguity of parsing human-readable help text.

This draft builds on prior art by @casey and the observations by @laanwj, @stickies-v, @kilianmh, @hodlinator, and @cdecker in #29912. Casey's work demonstrated that RPCHelpMan already contains all the structured information needed, which makes this feasible without duplicating any API definitions.

This differs from Casey's branches in that it uses the OpenRPC standard rather than an ad-hoc format or raw JSON Schema.

Why OpenRPC

I seletced OpenRPC for a number of reasons:

  • It's purpose-built for JSON-RPC APIs (suggested by @stickies-v, @nflatrea, and @kilianmh).
  • It wraps JSON schema for params/results, so consumers get both the method-level structure and the type-level schemas.
  • Unlike OpenAPI, it is not path-centric, which better fits our single-endpoint JSON-RPC model (concern raised by @hodlinator).
    • Although it therefore does not cover our REST interface.
  • It's kind of a standard format with (some) existing tooling for type generation (TypeScript, Rust, Python, Go) and client scaffolding, though maturity varies by language. More importantly though, IMO, a ~standardised format is inherently more useful than any ad-hoc one: any JSON Schema validator works, any LLM can consume it directly, and anyone can write a bespoke generator against a known schema rather than parsing help text.

Approach

RPCHelpMan metadata → getopenrpcinfo RPC → OpenRPC JSON

Tradeoffs

vs an ad-hoc format OpenRPC gives us interoperability with the (admittedly surprisingly limited) tooling, documentation generators, code generators, and validators, at the cost of needing x-bitcoin-* extensions for Bitcoin-specific concepts. As Casey noted after trying both approaches, JSON Schema "is probably not a great fit". OpenRPC's method-level framing on top of JSON Schema addresses the ergonomic issues while keeping the schema benefits. After testing both, I think I agree.

Types: JSON Schema cannot natively express units like "BTC/kvB" or semantic distinctions like "this hex string is a txid." These are preserved in description text and x-bitcoin-type-str extensions, but are not machine-enforceable from the schema alone. This was recognized as a fundamental limitation by several commenters in the issue. Future work could enrich the x-bitcoin-* extensions with a more structured unit vocabulary.

Some RPCs return different types depending on argument values (e.g. verbosity levels). These are represented as oneOf in the result schema with free-text condition descriptions. This is accurate but not fully machine-parseable — a code generator cannot automatically determine which result variant corresponds to which argument value without parsing the description. I still we have enough information to satisfy humans an agents alike though.

Regenerating the spec

The current functional test simply tests that the RPC runs, and produces valid JSON. We might want to consider extending this..

The RPC output documents which RPCs are available for any given built binary.

Discussion questions

  • Is this valuable/wanted?
  • Do we like openrpc format? (less relevant if we don't want this in this repo, as another repo could generate one or many definitions).
  • Should we cover "hidden" RPCs? They are currently hidden, but don't have to be...

My personal thoughts are that this is very nice to have.

@DrahtBot
Copy link
Contributor

DrahtBot commented Feb 26, 2026

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept ACK sedited, janb84, nervana21, stickies-v, hodlinator, w0xlt, satsfy

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #34799 (rpc: Run type check on decodepsbt result by maflcko)
  • #34764 (rpc: replace ELISION references with explicit result fields by satsfy)
  • #34049 (rpc: Disallow captures in RPCMethodImpl by ajtowns)
  • #33186 (wallet, test: Ancient Wallet Migration from v0.14.3 (no-HD and Single Chain) by w0xlt)
  • #31252 (rpc: print P2WSH and P2SH redem Script in (get/decode)rawtransaction by polespinasa)
  • #21283 (Implement BIP 370 PSBTv2 by achow101)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@sedited
Copy link
Contributor

sedited commented Feb 26, 2026

Concept ACK

Copy link
Contributor

@janb84 janb84 left a comment

Choose a reason for hiding this comment

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

Concept ACK.
This was already useful for bitcoin-tui

committed = json.loads(openrpc_path.read_text(encoding="utf-8"))

if generated != committed:
self.log.info("Generated doc/openrpc.json:\n%s",
Copy link
Member

Choose a reason for hiding this comment

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

I guess it could be distracting to have to see every rpc change twice. Maybe the test could just check that generating the json does not crash?

In theory, there could be a diff output like #26706 (comment) somewhere for each pull request, but that seems better to be optional and hidden.

the doc/openrpc.json could have the same This is a placeholder file. content like the manpages.

(Of course it is fine to keep both commits in this pull for now, so that the json is visible here, and only drop them before merge)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for this comment.

Having the json checked in as a skeleton (like manpages) is a nice approach. It's kind of the opposite to stickies thoughts, so I guess I'll see which folks seem to generally prefer (and will leave the file in this PR for now for reference).

I guess it could be distracting to have to see every rpc change twice. Maybe the test could just check that generating the json does not crash?

This is also a nice idea/possibility. If we are not worrying about having a live artifact in this repo, then I agree this is almost certainly how it should work.

Copy link
Member

Choose a reason for hiding this comment

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

I am also thinking about devs on platforms that do not support a full build (IIRC external signer was not present on Windows for some time?). I guess they could manually undo the hunk that removes the $feature-related RPC from the json, or copy-paste the full json output from the CI log somehow.

In any case, either way seems fine and should be trivial to adjust post-merge. This is just a nit.

@nervana21
Copy link
Contributor

Concept ACK

@stickies-v
Copy link
Contributor

Big concept ACK, very nice work. If we want to cram less functionality in Bitcoin Core, we need to make it easier for people to build on top of it. A change like this will make it much easier for consumers to use the RPC. In addition, I think it will also help with our RPC stability guarantees and testing, and to make it easier for consumers to quickly find and incorporate any changes that have been made to the interface.

it could also cause more work for devs who change an rpc, as the workflow may involve: ...

This seems like a feature, not a bug? As long as devs can compile the binaries they need to test/dev, I think this doesn't impose any unnecessary overhead?

If so, should it live in this repo?

If OpenRPC is the best choice for our repo (from quick glance, it seems to work well), and we have enough support to commit to keeping our RPC OpenRPC compatible, I think it absolutely should live in this repo, so that we can quickly and strictly enforce continued compatibility with the spec.

I'm less opinionated on whether the output json should live in this repo. I think it's fine to do so - the changes should be a LOT less frequent than e.g. doxygen changes, and it's nice having it easily accessible. However, I think it's also acceptable for users to generate this on-the-fly, or use any other hosted mirror of this documentation, which should be trivial to do.

@ajtowns
Copy link
Contributor

ajtowns commented Feb 27, 2026

→ Python gen-openrpc.py
→ doc/openrpc.json (the artifact that gets committed)

I don't really see why it wouldn't be better to have a getopenrpcinfo command that returns the json directly, giving you a direct report of the interface your bitcoind supports (whether the wallet or zmq is compiled in or not). Is there any reason you need python code to do the conversion rather than having it be built in to the bitcoind binary?

If people want to grab the artifact from the web instead of their node, then providing a url on bitcoincore.org (like https://bitcoincore.org/en/doc/30.0.0/rpc/network/disconnectnode/ eg) seems plausible enough.

Having the json output in the repo just seems annoying to me; more data, more conflicts, more diffs to check, more things you have to manually mess around with that could be automated.

For the test suite, picking a rarely updated but somewhat interesting RPC, and checking that the "getopenrpcinfo" result for that command matches a fixed value, and that the commands listed match the output of "help" is probably fine, or at least seems like it would be to me.

OpenRPC seems fine to me; doesn't seem like there's much benefit in worrying about the details, beyond getting something that's moderately machine readable.

@willcl-ark
Copy link
Member Author

I don't really see why it wouldn't be better to have a getopenrpcinfo command that returns the json directly, giving you a direct report of the interface your bitcoind supports (whether the wallet or zmq is compiled in or not). Is there any reason you need python code to do the conversion rather than having it be built in to the bitcoind binary?

Good question, sorry I didn't answer in OP initially, I had meant to provide a comparison of sorts...

I tried this approach, and basically my reasoning was that you end up with a much larger c++ change (which I thought might be less desirable), although you get the nice benefits you note.

I think it could be useful to codify the possible approaches I see, and their impact on this codebase. So roughly in ascending order of LoC needed in this repo:

  1. a single dump_all_command_descriptions RPC command (and basic functional test), ~ the first commit here. Doesn't emit json. up to downstream to write their own transformer.
  2. The above + a transformer contrib/ script + skeleton openrpc.json file
  3. RPC to return fully-structured JSON (This needed a fair amount of cpp code, in my attempt)
  4. Something like this PR being proposed (including a living openrpc.json file)

I am going to rework my branch which outputs the json directly from RPC, and will post an update here with a comparison.

If people want to grab the artifact from the web instead of their node, then providing a url on bitcoincore.org (like bitcoincore.org/en/doc/30.0.0/rpc/network/disconnectnode eg) seems plausible enough.

agree, this would be fine.

Having the json output in the repo just seems annoying to me; more data, more conflicts, more diffs to check, more things you have to manually mess around with that could be automated.

Yeah I think I agree here too. I did test breaking an RPC to see how annoying it was to detect and fix. Quite annoying, was the answer.

OpenRPC seems fine to me; doesn't seem like there's much benefit in worrying about the details, beyond getting something that's moderately machine readable.

👍🏼 Thank you for articulating this, as I did spend a fair bit of time "worrying" about which format to select, but I see now you're correct; as long as it's structured (i.e valid json) and machine readable, it should be OK, and people can easily transform it into their own formats.

@satsfy
Copy link

satsfy commented Feb 27, 2026

Hey @willcl-ark, have you checked my comment on corepc? Is something like that you wanted to build?

@DrahtBot
Copy link
Contributor

DrahtBot commented Mar 2, 2026

🚧 At least one of the CI tasks failed.
Task Windows native, fuzz, VS: https://github.com/bitcoin/bitcoin/actions/runs/22572396443/job/65383261925
LLM reason (✨ experimental): Fuzz test failed because RPC command "getopenrpcinfo" is not listed in allowed RPC commands for fuzzing.

Hints

Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:

  • Possibly due to a silent merge conflict (the changes in this pull request being
    incompatible with the current code in the target branch). If so, make sure to rebase on the latest
    commit of the target branch.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

Leave a comment here, if you need help tracking down a confusing failure.

@willcl-ark willcl-ark force-pushed the json-rpc-schema branch 3 times, most recently from 5f58a98 to 0857f2b Compare March 2, 2026 20:40
@DrahtBot DrahtBot removed the CI failed label Mar 2, 2026
@willcl-ark
Copy link
Member Author

I don't really see why it wouldn't be better to have a getopenrpcinfo command that returns the json directly

@ajtowns I have updated the draft here now to work like this. It was not as much extra c++ code in sever.cpp as I thought, which seems nice, and I agree it's a better approach. Comparing the python output to the c++ output only differed on formatting. New output file from a --preset dev-mode build here.

Hey @willcl-ark, have you checked my rust-bitcoin/corepc#4 (comment)? Is something like that you wanted to build?

@natobritto I had not heard of this one, no. I knew there were one or two? unmaintained rust bitcoin core json rpc libs, but pretty sure neither was this one. I will check it out.

@janb84
Copy link
Contributor

janb84 commented Mar 3, 2026

I like the new C++ approach!

I found one conundrum:

As per openRPC output the command getopenrpcinfo should return an empty info object (explicit "additionalProperties": false):

Details
    {
      "name": "getopenrpcinfo",
      "description": "Returns an OpenRPC document for currently available RPC commands.",
      "params": [
      ],
      "result": {
        "name": "result",
        "schema": {
          "type": "object",
          "properties": {
            "openrpc": {
              "type": "string",
              "description": "OpenRPC specification version."
            },
            "info": {
              "type": "object",
              "properties": {
              },
              "additionalProperties": false,
              "description": "Metadata about this JSON-RPC interface."
            },
            "methods": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                },
                "additionalProperties": false
              },
              "description": "Documented RPC methods."
            }
          },
          "additionalProperties": false,
          "required": [
            "openrpc",
            "info",
            "methods"
          ]
        }
      },
      "x-bitcoin-category": "control"
    },

The output is enriched with an info object filled (so it has additional properties) :

  "info": {
    "title": "Bitcoin Core JSON-RPC",
    "version": "v30.99.0-dev",
    "description": "Autogenerated from Bitcoin Core RPC metadata."
  },

This invalidates the generated openRPC spec

@willcl-ark
Copy link
Member Author

This invalidates the generated openRPC spec

Doh! You're right that the getopenrpcinfo schema was indeed self-invalidating!

I've updated the RPCResult to fully describe the info fields (title, version, description) and the method object structure (name, description, params, result, x-bitcoin-category), including the param and result Content Descriptor shapes. Dynamic JSON Schema fields within those use unconstrained schemas since their structure varies per method. I don't think there's anything we can do about that. There are also a few bits related to optional args before required, but those are legacy RPC artefacts.

I also added a sample helper script I used to validate that it's now actually valid, per the meta-schema (you can run this yourself with uv run contrib/devtools/check-openrpc.py <path_to_generated_schema>). Could be useful to have something like this to avoid regressions, although if it's not running in the test suite, then I'm not so sure...

@DrahtBot
Copy link
Contributor

DrahtBot commented Mar 3, 2026

🚧 At least one of the CI tasks failed.
Task Windows native, fuzz, VS: https://github.com/bitcoin/bitcoin/actions/runs/22633855642/job/65591195202
LLM reason (✨ experimental): Fuzz test failure: assertion failed in fuzz/rpc.cpp (trigger_internal_bug not found) during RPC fuzz processing.

Hints

Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:

  • Possibly due to a silent merge conflict (the changes in this pull request being
    incompatible with the current code in the target branch). If so, make sure to rebase on the latest
    commit of the target branch.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

Leave a comment here, if you need help tracking down a confusing failure.

Copy link
Contributor

@hodlinator hodlinator left a comment

Choose a reason for hiding this comment

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

Concept ACK

My gut says we should be maintaining a shared spec and generate stub C++ binding code from it, as is done for .capnp files. However, the current reverse approach of generating the spec from the C++ declarations has the following benefits:

  • Doesn't add more codegen complexity to the build.
  • Doesn't add complexity of keeping generated C++ code and version controlled code in sync.
  • Doesn't touch existing C++ RPC declarations.
  • If we were to decide we want to switch to non-C++ spec + codegen, the current approach gives us the raw material for that spec.

doc/openrpc.json Outdated
"info": {
"title": "Bitcoin Core JSON-RPC",
"version": "v30.99.0-dev",
"description": "Placeholder OpenRPC skeleton. Regenerate this file for release candidates using `bitcoin-cli getopenrpcinfo`."
Copy link
Contributor

Choose a reason for hiding this comment

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

Not clear to me if this should be in this repo, or done like the rpc help at https://github.com/bitcoin-core/bitcoincore.org/blob/master/contrib/doc-gen/generate.go

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I think the final 4 commits here are up for conceptual-inclusion review; we could... drop them all. The other extreme is to vendor the schema into this repo and use that in the functional test. Or we could keep something like the basic sanity test I have here and drop the final 3.

IMO if we want to distribute in guix tarballs keeping the skeleton file checked in isn't too bad. But I'm not strongly wedded to the idea either. If we didn't want to distribute a static file, we could drop both the skeleton file and guix commits.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's very useful to be able to interrogate bitcoind for its schema, it makes the schema much more discoverable, and makes it much more likely that the code will be kept up to date. It's also probably the path to integrate it with the least code, since there's minimal additional code for a new API call, and the C++ objects which represent the RPC API are all available to the schema generator.

@w0xlt
Copy link
Contributor

w0xlt commented Mar 6, 2026

Concept ACK

@satsfy
Copy link

satsfy commented Mar 9, 2026

Concept ACK

Glad to see this moving forward. I recently experimented with a similar OpenRPC generation approach, so I have some context here. I was able to use the generated spec to codegen types for Rust successfully, which gives me confidence that the overall approach is sound.

This review covers the spec output only. I will review the code separately.


getblockstats.stats currently has a redundant oneOf:

"oneOf": [
	{ "type": "string" },
	{ "type": "string" }
]

x-bitcoin-type-str has inconsistent values. It appears in 5 fields, including values like ["", "string or numeric"]. If we keep this extension, it would help to define it more tightly, otherwise dropping it for now may be cleaner.

Dummy/ignored params should carry some annotation, like getbalance.dummy, sendmany.dummy, sendmany.minconf, prioritisetransaction.dummy, submitblock.dummy. These are long-lived positional placeholders that cannot realistically be removed without shifting indices and breaking callers. I’m not sure deprecated: true is the right fit, since these are compatibility placeholders rather than removal candidates. Perhaps this warrants a Bitcoin-specific extension instead.

There are no minimum/maximum constraints on numeric fields. For example, walletpassphrase.timeout is capped at 100000000 per its description and getblock.verbosity accepts 0-3, but the schema does not encode those bounds.

Similarly, many hex string fields use ^[0-9a-fA-F]*$, which allows empty strings (312 occurrences). Since identifiers like txids and block hashes are fixed-width hex, fields like these could carry "minLength": 64, "maxLength": 64. More generally, this area could benefit from tighter field-specific constraints.

The spec currently inlines everything. It may be worth leveraging OpenRPC reuse via $ref and components/schemas, since structures like scriptPubKey, transaction objects, fee objects, and UTXO shapes appear repeatedly. The most important cases seem to be the ones currently falling back to additionalProperties: true (10 occurrences). I opened #34764 to address the most common cause (ELISION placeholders that should be explicit result fields), though recursive structures like getaddressinfo.embedded would likely require $ref support in the generator. That seems like follow-up work rather than something for this PR.

type: "number" is used universally; there is no type: "integer". Block heights, confirmations, vsize, weight, sequence numbers, byte sizes, and timestamps are all integers in practice. Distinguishing integer from non-integer matters for code generators, which otherwise map these to floats/doubles. I ran into this while generating Rust types for corepc. Fixing it likely requires deeper RPCArg typing changes, so probably outside the scope here.

estimate_mode is plain string with no enum (11 occurrences). The valid values are "unset", "economical", "conservative", but the schema itself has no constraint. If we added enum support to the help metadata (even just an optional std::vector<std::string> on string args), code generators downstream would get proper constrained types. Example:

"schema": {
	"type": "string",
	"enum": ["unset", "economical", "conservative"]
}

This likely affects other params too (sighashtype, address_type, change_type). This could be a follow-up.

On the spec file: I agree with @ajtowns that checking the generated JSON into the repo creates ongoing friction for contributors touching RPCs. Consumers who want diffs between releases can run bitcoin-cli getopenrpcinfo on two versions. CI could instead validate generation and enforce a few structural invariants, for example, that every method in help appears in the output, no oneOf contains duplicate entries, and every param has required.

Happy to help later with follow-up patches for any of these.

willcl-ark and others added 9 commits March 10, 2026 14:01
CRPCTable::help() takes std::string_view but server.h relies on
transitive includes for it.

Add the direct include (probably makes iwyu happier too?)
After removing the last CRPCCommand pointer for a given name,
erase the now-empty vector from mapCommands. Without this,
listCommands() returns the name of a fully removed command
because it iterates mapCommands keys unconditionally.

For example, when unloading the wallet the RPCs are deregistered, and
this prevents getopenrpcinfo from returning non-existant RPCs.
RPCResult::Type::ANY triggers NONFATAL_UNREACHABLE() in ToSections(),
which crashes the help() RPC when a command uses Type::ANY in a
nested result field.

Previously this was never hit because Type::ANY was only used as a
top-level alternate result type, filtered out before ToSections() is
called.

getopenrpcinfo() will use this result type, so render it like other
types allowing it to be used in nested result definitions like schema.
DecodeTxDoc() uses positional bool arguments to control which
optional fields appear in decoded transaction result documentation.
As more call sites need different combinations of prevout, fee, and
hex fields, this becomes harder to read and more error-prone.

Replace it with TxDoc(), which takes a TxDocOptions struct with
named fields defaulting to false. Callers can then opt into the
needed fields explicitly, e.g.

    TxDoc("The transaction id", TxDocOptions{.prevout = true, .fee = true})

This is a pure refactor. Help output is unchanged. Move the helper
to rpc/util.{h,cpp} so it can be reused across subsystems in
follow-up commits.
decodepsbt describes its "tx" and "non_witness_utxo" result fields
using ELISION prose referring to decoderawtransaction output. This
works for human-readable help, but schema generators cannot resolve
those references into structured field definitions.

Replace both ELISION entries with TxDoc() so the transaction layout
is represented directly in RPCHelpMan metadata.
The verbosity=2 result for getrawtransaction contains ELISION prose
both at the top level ("Same output as verbosity = 1") and within
each vin entry. These references are readable for humans but do not
provide structured result metadata.

Replace them with the full result structure using Cat() and TxDoc()
with prevout enabled.
@willcl-ark
Copy link
Member Author

willcl-ark commented Mar 10, 2026

Glad to see this moving forward. I recently experimented with a similar OpenRPC generation approach, so I have some context here. I was able to use the generated spec to codegen types for Rust successfully, which gives me confidence that the overall approach is sound.

This review covers the spec output only. I will review the code separately.

Thanks for the review!

I have picked your changes from #34764 (thanks) and stacked them (with a small fixup) in here, with additional fixes for the following from your review:

  • getblockstats.stats having a redundant oneOf

    Now deduplicated

  • x-bitcoin-type-str having inconsistent values

    Now removed

  • Dummy/ignored params needing annotation

    Fixed using x-bitcoin-placeholder metadata

  • Hex regex allowing empty strings

    Partially addressed by changing ^[0-9a-fA-F]*$ to ^[0-9a-fA-F]+$. I did not add field-specific fixed lengths like minLength/maxLength as this would be more invasive than I'd like here.

  • additionalProperties: true caused by ELISION

    Partially fixed via cherry-pick from your branch. However recursive cases like getaddressinfo.embedded still need $ref-style support, which I certainly plan to leave out of this PR/for a followup, if I can :)

I have also dropped the skeleton document, and Guix packaging commits.

@willcl-ark
Copy link
Member Author

If we are generally Concept ACK in here, it would probably make sense to split this up as:

  1. i) First 5 'setup' commits here
    ii) PR rpc: replace ELISION references with explicit result fields #34764
  2. The final two commits here as a standalone PR once prep work has been done

satsfy and others added 5 commits March 10, 2026 14:58
getblock defines four verbosity levels. The verbosity=2 and
verbosity=3 results use ELISION entries to refer to lower verbosity
layouts, even though the only material difference between levels is
the shape of the "tx" field.

Introduce GetBlockFields(RPCResult tx_result) to build the full
block result structure while substituting the appropriate "tx"
definition in the correct position. This avoids ELISION prose and
also avoids the duplicate "tx" field a naive Cat() approach would
produce.

Remove the now-unused getblock_vin helper.
The "removed" array in listsinceblock is described with an ELISION
entry referring to the "transactions" array layout. This is clear in
human-readable help, but it leaves the result structure implicit.

Extract ListSinceBlockTxFields() and use it for both arrays so the
transaction layout is defined once and represented explicitly in
RPCHelpMan metadata.
This is a basic smoke test for the generated openrpc document.

Verify the RPC returns a serializable document (valid JSON) and that the
top-level shape is ~ correct:

- openrpc is a string
- info is an object
- methods is an array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.