amountcommitment or valuecommitment

Open
#1,389 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp
Domain
api

Research direction

Start by inspecting the listunspent and gettxout RPC implementations and their existing tests, if present, to compare how the commitment fields are exposed. Clarify the intended field name and compatibility or deprecation requirements; done means the two RPC outputs follow the agreed naming consistently with appropriate coverage.

Written by the indexing model from the issue text.

Description

In listunspent RPC there is ammountcommitment:

$ elements-cli -rpcwallet=real listunspent
[
  {
    "txid": "2ef46ad30a0a002fadb5214c1c746d361a4adfdde1d47a3a6bd77e29229c3151",
    "vout": 1,
    "address": "H4iZbR67ywSKvpRgYqGSuqfmAtJLxgiTQ4",
    "label": "c2",
    "redeemScript": "001489a5ca6bfa43e3e60bc8545fd448262bc29cd587",
    "scriptPubKey": "a914ec395de045564b4851f188d8991b3a11ac7408db87",
    "amount": 0.00000001,
    "assetcommitment": "0b80363e4a0f0332e9a6cd338eed1247eb59242e047b8c2dacdbc9590c609484c6",
    "asset": "6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d",
    "amountcommitment": "09ff0377d7f474048fff55c41bfa369624db069f9b30a7e574ab49d335c3a0cbee",
    "amountblinder": "258f64b23ae417a63bf8167728aeecb95889464b1af9b8d1c48ba29670e58933",
    "assetblinder": "75082cc0e11be120913e7f5b8ca74b2019af64812488dfd858a47a3e8db39db8",
    "confirmations": 299187,
    "spendable": true,
    "solvable": true,
    "desc": "sh(wpkh([8baa2a22/0'/0'/1213']0274c2569ed3907d21b5b4850daf6a324a402c96e9b4fb67f5bb72f35ce38ce84d))#vs2k8pq9",
    "safe": true
  }
]

But in gettxout RPC output the same is written as valuecommitment:

$ elements-cli -rpcwallet=real gettxout 2ef46ad30a0a002fadb5214c1c746d361a4adfdde1d47a3a6bd77e29229c3151 1
{
  "bestblock": "9fd47ccb007675fc1fb6147c1d62cd9346f76d9e5edbcf4af17d0fc19813d23a",
  "confirmations": 299189,
  "valuecommitment": "09ff0377d7f474048fff55c41bfa369624db069f9b30a7e574ab49d335c3a0cbee",
  "assetcommitment": "0b80363e4a0f0332e9a6cd338eed1247eb59242e047b8c2dacdbc9590c609484c6",
  "commitmentnonce": "",
  "scriptPubKey": {
    "asm": "OP_HASH160 ec395de045564b4851f188d8991b3a11ac7408db OP_EQUAL",
    "desc": "addr(H4iZbR67ywSKvpRgYqGSuqfmAtJLxgiTQ4)#8v4mh22p",
    "hex": "a914ec395de045564b4851f188d8991b3a11ac7408db87",
    "address": "H4iZbR67ywSKvpRgYqGSuqfmAtJLxgiTQ4",
    "type": "scripthash"
  },
  "coinbase": false
}

Could be something to deprecate in the future version. @delta1

Dominant language
C++
Stars
1.2k
Forks
418
Avg merge
1d 23h
Merged PRs (30d)
15

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ElementsProject/elements

All issues in ElementsProject/elements

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.