2

What's the simplest way to test and verify that I am the owner of the fund except sending a real coin?

In fact, this problem contains two aspects. One is to prove to ourself, and the other is to prove to strangers. Why is it also very important to prove to ourself? Because for a newcomer, it may ask an expert to help set up a wallet and buy some BTCs. Of course, we cannot just think that we has mastered these BTCs just by seeing which number on the bitcoin core.

For legacy address, I think i can verify with signing/verifying(for ourself and stranger) message, is this simplest?

But what can i do for the SegWit address?

How about isMine in getaddressinfo RPC? (for ourself only?)

3

1 Answer 1

3

Funds on Bitcoin aren't necessarily locked by a single key.

Each output on the bitcoin blockchain is locked by a Bitcoin Script. To spend an output, you have to provide the correct inputs to the locking script, such that the evaluation is successful (and meets other consensus requirements).

Standard addresses, whether P2PKH, P2WPKH-P2SH, or P2WPKH, require a valid signature from a pre-selected private key.

To prove that you can spend such an output, it suffices to prove that you can produce signatures from that private key - this can be done by signing a message, or spending an output (in the event that multiple outputs are available for the same locking script, spending a single output suffices as proof).

However, there can be other kinds of locking scripts - multi-signature scripts require M of N keys to sign, which in turn would require you to prove that you control at least M of the N keys listed in the locking script.

There are other kinds of scripts, such as timelocks or hashing puzzles, which could require waiting until a pre-determined block height or time, or providing the pre-image to a specific hash. For those cases, you would need to prove your ability to wait, or knowledge of the pre-image (which may be difficult to achieve without sharing the pre-image itself).

More complex scripts (essentially, any scenario that can be represented as a series of Bitcoin Script operations), can be created - with Taproot, you could have multiple branches that allow unlocking of the assets under different scenarios - proving control of those funds would be script specific.

When sharing such proofs, you should be careful - proofs not bound by a signature or a similar value may accidentally reveal all required information to unlock an output - for instance, a script that only requires a pre-image for a specific hash, will be spendable by anyone who knows that pre-image. Thus, sharing that with a third-party, even outside of a transaction, may result in funds being lost.

3
  • Thank you for your answer. But what you said is too complicated or too theoretical. Actually, I just want to know that in practice, for a wallet in Bitcoin Core, in order to verify whether I have full control over its funds, besides spending it, what specific methods are there? Just as you said, there are various signatures or scripts in various situations. For a novice, a more concise and intuitive verification method is needed. @Raghav Sood
    – foolbear
    Commented May 10 at 1:40
  • If you're using a bog standard Bitcoin Core wallet, you fall into the Standard addresses, whether P2PKH, P2WPKH-P2SH, or P2WPKH category - to prove you control an address in the wallet, you would need to be able to sign a message with a key corresponding to that address in that wallet. Note that Bitcoin Core uses hardened derivations, so you would have to do this for each address that contains funds (as opposed to proving a single address and then sharing an xpub to show control of sister keys). Commented May 10 at 1:50
  • signing/verifying message works for legacy address only, right? what can i do for the non-legacy address(Most of the addresses nowadays are non-legacy) in Bitcoin Core?
    – foolbear
    Commented May 10 at 1:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.