Skip to content

Commit

Permalink
docs(rpc): remaining v21.0.0 rpc updates (#109)
Browse files Browse the repository at this point in the history
* docs(rpc): fix getnetworkinfo example

* docs(rpc): add listdescriptors

* chore: add prompt for creating new rpc documentation

* docs(rpc): update gettransaction

* docs(rpc): listdescriptors fixes

* docs(rpc): update gettxout, decoderawtx, gettx, getrawtx, decodescript

* docs(rpc): update getpeerinfo

* docs(rpc): update sendmany and sendtoaddress

* docs(rpc): add sethdseed
  • Loading branch information
thephez authored Aug 8, 2024
1 parent 65643e1 commit e29e558
Show file tree
Hide file tree
Showing 6 changed files with 366 additions and 154 deletions.
101 changes: 100 additions & 1 deletion docs/api/ai-prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,103 @@ Only list any discrepancies (including parameters and/or response fields that ha

## Remove the excess whitespace at the end of tables

Remove the whitespace padding from the last column of this markdown table. do not worry about alignment of the end of the line but do include the ending "|" with a single space before it
Remove the whitespace padding from the last column of this markdown table. do not worry about alignment of the end of the line but do include the ending "|" with a single space before it

## Create documentation for a new RPC

Use this RPC documentation as a template to create documentation for new RPCs:

```## ImportMulti
> 📘
>
> Requires [wallet](../resources/glossary.md#wallet) support (**unavailable on masternodes**). Wallet must be unlocked.
_Added in Dash Core 0.12.3 / Bitcoin Core 0.14.0_
The [`importmulti` RPC](../api/remote-procedure-calls-wallet.md#importmulti) imports addresses or scripts (with private keys, public keys, or P2SH redeem scripts) and optionally performs the minimum necessary rescan for all imports.
_Parameter #1---the addresses/scripts to import_
| Name | Type | Presence | Description|
| --------------------- | --------------------- | ----------------------- | -----------|
| Imports | array | Required<br>(exactly 1) | An array of JSON objects, each one being an address or script to be imported |
| → Import | object | Required<br>(1 or more) | A JSON object describing a particular import |
| → →<br>`scriptPubKey` | string (hex) | Optional<br>(0 or 1) | The script (string) to be imported. Must have either this field or `address` below |
| → →<br>`address` | string (base58) | Optional<br>(0 or 1) | The P2PKH or P2SH address to be imported. Must have either this field or `scriptPubKey` above |
| → →<br>`timestamp` | number (int) / string | Required<br>(exactly 1) | The creation time of the key in Unix epoch time or the string “now” to substitute the current synced block chain time. The timestamp of the oldest key will determine how far back block chain rescans need to begin. Specify `now` to bypass scanning for keys which are known to never have been used. Specify `0` to scan the entire block chain. Blocks up to 2 hours before the earliest key creation time will be scanned |
| → →<br>`redeemscript` | string | Optional<br>(0 or 1) | A redeem script. Only allowed if either the `address` field is a P2SH address or the `scriptPubKey` field is a P2SH scriptPubKey |
| → →<br>`pubkeys` | array | Optional<br>(0 or 1) | Array of strings giving pubkeys that must occur in the scriptPubKey or redeemscript |
| → →<br>`keys` | array | Optional<br>(0 or 1) | Array of strings giving private keys whose corresponding public keys must occur in the scriptPubKey or redeemscript |
| → →<br>`internal` | bool | Optional<br>(0 or 1) | Stating whether matching outputs should be treated as change rather than incoming payments. The default is `false` |
| → →<br>`watchonly` | bool | Optional<br>(0 or 1) | Stating whether matching outputs should be considered watched even when they're not spendable. This is only allowed if keys are empty. The default is `false` |
| → →<br>`label` | string | Optional<br>(0 or 1) | Label to assign to the address, only allowed with `internal` set to `false`. The default is an empty string (“”) |
_Parameter #2---options regarding the import_
| Name | Type | Presence | Description |
| -------------- | ------ | -------------------- | ----------- |
| Option | object | Optional<br>(0 or 1) | JSON object with options regarding the import |
| → <br>`rescan` | bool | Optional<br>(0 or 1) | Set to `true` (the default) to rescan the entire local block chain for transactions affecting any imported address or script. Set to `false` to not rescan after the import. Rescanning may take a considerable amount of time and may require re-downloading blocks if using block chain pruning |
_Result---execution result_
| Name | Type | Presence | Description |
| ------------------- | --------------- | ----------------------- | ----------------------------------------------------------------------------------------- |
| `result` | array | Required<br>(exactly 1) | An array of JSON objects, with each object describing the execution result of each import |
| → Result | object | Required<br>(1 or more) | A JSON object describing the execution result of an imported address or script |
| → → <br>`success` | string | Required<br>(exactly 1) | Displays `true` if the import has been successful or `false` if it failed |
| → → <br>`error` | string : object | Optional<br>(0 or 1) | A JSON object containing details about the error. Only displayed if the import fails |
| → → → <br>`code` | number (int) | Optional<br>(0 or 1) | The error code |
| → → → <br>`message` | string | Optional<br>(0 or 1) | The error message |
_Example from Dash Core 0.12.3_
Import the address `ycCsAUKsjdmoP4qAXiS1cjYA4ixM48zJWe` (giving it a label and scanning the entire block chain) and the scriptPubKey `76a9146cf5870411edc31ba5630d61c7cddff55b884fda88ac` (giving a specific timestamp and label):
```bash
dash-cli importmulti '
[
{
"scriptPubKey" : { "address": "ycCsAUKsjdmoP4qAXiS1cjYA4ixM48zJWe" },
"timestamp" : 0,
"label" : "Personal"
},
{
"scriptPubKey" : "76a9146cf5870411edc31ba5630d61c7cddff55b884fda88ac",
"timestamp" : 1493912405,
"label" : "TestFailure"
}
]' '{ "rescan": true }'
```

Result (scriptPubKey import failed because `internal` was not set to `true`):

```json
[
{
"success": true
},
{
"success": false,
"error": {
"code": -8,
"message": "Internal must be set for hex scriptPubKey"
}
}
]
```

_See also_

* [ImportPrivKey](../api/remote-procedure-calls-wallet.md#importprivkey): adds a private key to your wallet. The key should be formatted in the wallet import format created by the [`dumpprivkey` RPC](../api/remote-procedure-calls-wallet.md#dumpprivkey).
* [ImportAddress](../api/remote-procedure-calls-wallet.md#importaddress): adds an address or pubkey script to the wallet without the associated private key, allowing you to watch for transactions affecting that address or pubkey script without being able to spend any of its outputs.
* [ImportWallet](../api/remote-procedure-calls-wallet.md#importwallet): imports private keys from a file in wallet dump file format (see the [`dumpwallet` RPC](../api/remote-procedure-calls-wallet.md#dumpwallet)). These keys will be added to the keys currently in the wallet. This call may need to rescan all or parts of the block chain for transactions affecting the newly-added keys, which may take several minutes.
```
Create documentation for the following new RPC using the style of previously provided RPC documentation as a template:
```
INSERT "HELP <RPCNAME>" OUTPUT HERE
```
15 changes: 9 additions & 6 deletions docs/api/remote-procedure-call-quick-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ These RPCs are all Dash-specific and not found in Bitcoin Core
* [GetMerkleBlocks](../api/remote-procedure-calls-blockchain.md#getmerkleblocks): returns an array of hex-encoded merkleblocks for <count> blocks starting from <hash> which match <filter>. _New in Dash Core 0.15.0_
* [GetSpecialTxes](../api/remote-procedure-calls-blockchain.md#getspecialtxes): returns an array of special transactions found in the specified block _New in Dash Core 0.13.1_
* [GetSpentInfo](../api/remote-procedure-calls-blockchain.md#getspentinfo): returns the txid and index where an output is spent (requires `spentindex` to be enabled). New in Dash Core 0.12.1
* [GetTxOut](../api/remote-procedure-calls-blockchain.md#gettxout): returns details about an unspent transaction output (UTXO). _Updated in Dash Core 0.15.0_
* [GetTxOut](../api/remote-procedure-calls-blockchain.md#gettxout): returns details about an unspent transaction output (UTXO). **Updated in Dash Core 21.0.0**
* [GetTxOutProof](../api/remote-procedure-calls-blockchain.md#gettxoutproof): returns a hex-encoded proof that one or more specified transactions were included in a block.
* [GetTxOutSetInfo](../api/remote-procedure-calls-blockchain.md#gettxoutsetinfo): returns statistics about the confirmed unspent transaction output (UTXO) set. Note that this call may take some time and that it only counts outputs from confirmed transactions---it does not count outputs from the memory pool. _Updated in Dash Core 18.1.0_
* [PreciousBlock](../api/remote-procedure-calls-blockchain.md#preciousblock): treats a block as if it were received before others with the same work. _New in Dash Core 0.12.3_
Expand Down Expand Up @@ -127,11 +127,11 @@ These RPCs are all Dash-specific and not found in Bitcoin Core
* [GetAssetUnlockStatuses](../api/remote-procedure-calls-raw-transactions.md#getassetunlockstatuses): returns the status of the provided Asset Unlock indexes at the tip of the chain or at a particular block height if specified. **New in Dash Core 20.1.0**
* [CreateRawTransaction](../api/remote-procedure-calls-raw-transactions.md#createrawtransaction): creates an unsigned serialized transaction that spends a previous output to a new output with a P2PKH or P2SH address. The transaction is not stored in the wallet or transmitted to the network. _Updated in Dash Core 0.17.0_
* [DecodePSBT](../api/remote-procedure-calls-raw-transactions.md#decodepsbt): returns a JSON object representing the serialized, base64-encoded partially signed Dash transaction. _New in Dash Core 18.0.0_
* [DecodeRawTransaction](../api/remote-procedure-calls-raw-transactions.md#decoderawtransaction): decodes a serialized transaction hex string into a JSON object describing the transaction. _Updated in Dash Core 0.13.0_
* [DecodeScript](../api/remote-procedure-calls-raw-transactions.md#decodescript): decodes a hex-encoded P2SH redeem script.
* [DecodeRawTransaction](../api/remote-procedure-calls-raw-transactions.md#decoderawtransaction): decodes a serialized transaction hex string into a JSON object describing the transaction. **Updated in Dash Core 21.0.0**
* [DecodeScript](../api/remote-procedure-calls-raw-transactions.md#decodescript): decodes a hex-encoded P2SH redeem script. **Updated in Dash Core 21.0.0**
* [FinalizePSBT](../api/remote-procedure-calls-raw-transactions.md#finalizepsbt): finalizes the inputs of a PSBT. The PSBT produces a network serialized transaction if the transaction is fully signed. _New in Dash Core 18.0.0_
* [FundRawTransaction](../api/remote-procedure-calls-raw-transactions.md#fundrawtransaction): adds inputs to a transaction until it has enough in value to meet its out value. **Updated in Dash Core 21.0.0**
* [GetRawTransaction](../api/remote-procedure-calls-raw-transactions.md#getrawtransaction): gets a hex-encoded serialized transaction or a JSON object describing the transaction. By default, Dash Core only stores complete transaction data for UTXOs and your own transactions, so the RPC may fail on historic transactions unless you use the non-default `txindex=1` in your Dash Core startup settings. _Updated in Dash Core 0.16.0_
* [GetRawTransaction](../api/remote-procedure-calls-raw-transactions.md#getrawtransaction): gets a hex-encoded serialized transaction or a JSON object describing the transaction. By default, Dash Core only stores complete transaction data for UTXOs and your own transactions, so the RPC may fail on historic transactions unless you use the non-default `txindex=1` in your Dash Core startup settings. **Updated in Dash Core 21.0.0**
* [GetRawTransactionMulti](../api/remote-procedure-calls-raw-transactions.md#getrawtransactionmulti): gets hex-encoded serialized transactions or a JSON object describing the multiple transactions. **Added in Dash Core 20.1.0**
* [GetTxChainlocks](../api/remote-procedure-calls-raw-transactions.md#gettxchainlocks): returns the block height each transaction was mined at and whether it is ChainLocked or not. **Updated in Dash Core 20.1.0**
* [JoinPSBTs](../api/remote-procedure-calls-raw-transactions.md#joinpsbts): joins multiple distinct PSBTs with different inputs and outputs into one PSBT with inputs and outputs from all of the PSBTs.
Expand Down Expand Up @@ -186,6 +186,7 @@ These RPCs are all Dash-specific and not found in Bitcoin Core
* [KeyPoolRefill](../api/remote-procedure-calls-wallet.md#keypoolrefill): fills the cache of unused pre-generated keys (the keypool).
* [ListAddressBalances](../api/remote-procedure-calls-wallet.md#listaddressbalances): lists addresses of this wallet and their balances _New in Dash Core 0.12.3_
* [ListAddressGroupings](../api/remote-procedure-calls-wallet.md#listaddressgroupings): lists groups of addresses that may have had their common ownership made public by common use as inputs in the same transaction or from being used as change from a previous transaction. _Updated in Dash Core 0.17.0_
* [ListDescriptors](../api/remote-procedure-calls-wallet.md#listdescriptors): lists descriptors imported into a descriptor-enabled wallet. **New in Dash Core 21.0.0**
* [ListLabels](../api/remote-procedure-calls-wallet.md#listlabels): returns the list of all labels, or labels that are assigned to addresses with a specific purpose. _New in Dash Core 0.17.0_
* [ListLockUnspent](../api/remote-procedure-calls-wallet.md#listlockunspent): returns a list of temporarily unspendable (locked) outputs.
* [ListReceivedByAddress](../api/remote-procedure-calls-wallet.md#listreceivedbyaddress): lists the total number of dash received by each address. _Updated in Dash Core 0.17.0_
Expand All @@ -201,8 +202,10 @@ These RPCs are all Dash-specific and not found in Bitcoin Core
* [RescanBlockChain](../api/remote-procedure-calls-wallet.md#rescanblockchain): rescans the local blockchain for wallet related transactions. _New in Dash Core 0.16.0_
* [ScanTxOutset](../api/remote-procedure-calls-wallet.md#scantxoutset): scans the unspent transaction output set for entries that match certain output descriptors. _New in Dash Core 18.0.0_
* [Send](../api/remote-procedure-calls-wallet.md#send): sends a transaction with specified outputs. **New in Dash Core 21.0.0**
* [SendMany](../api/remote-procedure-calls-wallet.md#sendmany): creates and broadcasts a transaction which sends outputs to multiple addresses. **Updated in Dash Core 20.0.0**
* [SendToAddress](../api/remote-procedure-calls-wallet.md#sendtoaddress): spends an amount to a given address. **Updated in Dash Core 20.0.0**
* [SendMany](../api/remote-procedure-calls-wallet.md#sendmany): creates and broadcasts a transaction which sends outputs to multiple addresses. **Updated in Dash Core 21.0.0**
* [SendToAddress](../api/remote-procedure-calls-wallet.md#sendtoaddress): spends an amount to a given address. **Updated in Dash Core 21.0.0**
* [SetHDSeed](../api/remote-procedure-calls-wallet.md#sethdseed): sets or generates a new HD wallet seed **New in Dash Core 21.0.0**
* [SetLabel](../api/remote-procedure-calls-wallet.md#setlabel): sets the label associated with the given address.
* [SetCoinJoinAmount](../api/remote-procedure-calls-wallet.md#setcoinjoinamount): sets the amount of DASH to be processed _New in Dash Core 0.13.0_
* [SetCoinJoinRounds](../api/remote-procedure-calls-wallet.md#setcoinjoinrounds): sets the number of rounds to use _New in Dash Core 0.13.0_
* [SetTxFee](../api/remote-procedure-calls-wallet.md#settxfee): sets the transaction fee per kilobyte paid by transactions created by this wallet.
Expand Down
10 changes: 4 additions & 6 deletions docs/api/remote-procedure-calls-blockchain.md
Original file line number Diff line number Diff line change
Expand Up @@ -1994,9 +1994,10 @@ Name | Type | Presence | Description
→<br>`scriptPubKey` | string : object | Optional<br>(0 or 1) | An object with information about the pubkey script. This may be `null` if there was no pubkey script
→ →<br>`asm` | string | Required<br>(exactly 1) | The pubkey script in decoded form with non-data-pushing opcodes listed
→ →<br>`hex` | string (hex) | Required<br>(exactly 1) | The pubkey script encoded as hex
→ →<br>`reqSigs` | number (int) | Optional<br>(0 or 1) | The number of signatures required; this is always `1` for P2PK, P2PKH, and P2SH (including P2SH multisig because the redeem script is not available in the pubkey script). It may be greater than 1 for bare multisig. This value will not be returned for `nulldata` or `nonstandard` script types (see the `type` key below)
→ →<br>`reqSigs` | number (int) | Optional<br>(0 or 1) | **Deprecated in Dash Core 21.0.0** (returned only if config option -deprecatedrpc=addresses is passed)<br><br>The number of signatures required; this is always `1` for P2PK, P2PKH, and P2SH (including P2SH multisig because the redeem script is not available in the pubkey script). It may be greater than 1 for bare multisig. This value will not be returned for `nulldata` or `nonstandard` script types (see the `type` key below)
→ →<br>`type` | string | Optional<br>(0 or 1) | The type of script. This will be one of the following:<br>• `pubkey` for a P2PK script<br>• `pubkeyhash` for a P2PKH script<br>• `scripthash` for a P2SH script<br>• `multisig` for a bare multisig script<br>• `nulldata` for nulldata scripts<br>• `nonstandard` for unknown scripts
→ →<br>`addresses` | string : array | Optional<br>(0 or 1) | The P2PKH or P2SH addresses used in this transaction, or the computed P2PKH address of any pubkeys in this transaction. This array will not be returned for `nulldata` or `nonstandard` script types
→ →<br>`address` | string | Optional<br>(0 or 1) | Dash address (only if a well-defined address exists)
→ →<br>`addresses` | string : array | Optional<br>(0 or 1) | **Deprecated in Dash Core 21.0.0** (returned only if config option -deprecatedrpc=addresses is passed)<br><br>The P2PKH or P2SH addresses used in this transaction, or the computed P2PKH address of any pubkeys in this transaction. This array will not be returned for `nulldata` or `nonstandard` script types
→ → →<br>Address | string | Required<br>(1 or more) | A P2PKH or P2SH address
→<br>`coinbase` | bool | Required<br>(exactly 1) | Set to `true` if the transaction output belonged to a coinbase transaction; set to `false` for all other transactions. Coinbase transactions need to have 101 confirmations before their outputs can be spent

Expand All @@ -2021,11 +2022,8 @@ Result:
"scriptPubKey": {
"asm": "OP_DUP OP_HASH160 b66266c5017a759817f3bb99e8d9124bf5bb2e74 OP_EQUALVERIFY OP_CHECKSIG",
"hex": "76a914b66266c5017a759817f3bb99e8d9124bf5bb2e7488ac",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"ycwoiAibTjpwnoCZSX7S4kiB2H8wULw9qo"
]
"address": "ycwoiAibTjpwnoCZSX7S4kiB2H8wULw9qo"
},
"coinbase": false
}
Expand Down
Loading

0 comments on commit e29e558

Please sign in to comment.