Skip to content

Aligning RPC API with Bitcoin Core conventions #551

@JeremyRand

Description

@JeremyRand

The Namecoin Core RPC API for name operations has a bunch of inconsistencies with what Bitcoin Core does. Some of these inconsistencies are due to Vince doing weird things, others are due to Namecoin Core adding some features before Bitcoin Core did so. Other parts of the API are confusing for historical reasons (though not specifically in conflict with Bitcoin Core).

Some notable examples of API issues:

  • "Method naming: use consecutive lower-case names such as getrawtransaction and submitblock."
    • name_checkdb, name_firstupdate, name_history, name_list, name_new, name_pending, name_scan, name_show, and name_update don't follow this.
  • Method naming: Bitcoin Core RPC methods tend to be named in imperative form, e.g. abandontransaction.
    • I don't see any formal guideline in Bitcoin Core's developer notes for this, maybe we should ask them to document it?
    • The name_ methods don't follow this.
    • Suggested new names: registername (registration and pre-registration are more intuitive than firstupdate and new), getnamehistory (consistent with getmempoolancestors), listnames (consistent with listtransactions), preregistername (ibid), getmempoolname (consistent with getmempoolentry), scannameset (consistent with scantxoutset), getname (consistent with getrawtransaction/gettransaction), and updatename.
  • "Argument and field naming: ... use snake case fee_delta (and not, e.g. feedelta or camel case feeDelta)."
    • allowExisting, allowExpired, byHash, destAddress, minConf, maxConf, nameEncoding, sendCoins, and valueEncoding don't follow this.
  • Bitcoin Core supports name-based arguments now.
    • options does the same thing, but worse.
  • "Try to make the RPC response a JSON object."
    • name_checkdb, name_firstupdate, name_history, name_list, name_new, name_pending, name_scan, name_update, and queuerawtransaction don't follow this.
  • rand argument
    • Should be renamed to salt, since this value is typically not random anymore.
  • allowExisting vs allow_active
    • allow_active is probably more precise.
  • tx argument
    • Should be renamed to txid, since tx could be confused with rawtx

Would there be any objections to updating the API to fix these issues (leaving the existing API methods in place to avoid disrupting consumers of the current API)?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions