Using either bitcoin-cli in your terminal, or a Jupyter notebook in conjunction with the TestShell class from the Bitcoin Core Test Framework, try to complete the following exercises.

Changes to the codebase will require you to re-compile afterwards.

Don’t forget to use the compiled binaries found in your source directory, for example /home/user/bitcoin/src/bitcoind, otherwise your system might select a previously-installed (non-modified) version of bitcoind.

  1. Modify a wallet RPC

    • Create a descriptor wallet

    • Generate coins to yourself

    • Remove the "dummy" parameter from the getbalance Wallet RPC

    • Ensure that the rpc_help.py functional test passes (but ignore other test failures), fixing any errors

      run test/functional/rpc_help.py to just run a single test
    • Check that the rpc call getbalance 3 true true passes with the dummy parameter removed

  1. IsMine

    • Create a descriptor wallet

    • Generate coins to yourself

    • Send coins to yourself in a transaction and generate a block to confirm

    • Modify the wallet’s IsMine() logic to always return false

    • Generate a new block and try to send coins to yourself in a transaction again

    • Observe the changes

  2. Coin Selection

    • Create a descriptor wallet

    • Generate 200 blocks to yourself

    • Call listunspent and then send a large amount (e.g. 600 BTC) to yourself and observe how many inputs were used

    • Add a new preferred coin selection algorithm to the wallet that uses all UTXOs in the wallet and optionally remove the other algorithms.

    • Redo the send and confirm that this time it will select all inputs in the wallet for the transaction

  3. Adding a new RPC

    • Add a new RPC which when called will simply return to the user a random UTXO from the wallet in the form

        "txid": <txid>,
        "vout": <vout>