<p>You can sign a message using the <code>signmessage</code> command. Note that this only works if you are using <code>legacy</code> addresses (Bitcoin Core currently defaults to <code>p2sh-segwit</code> addresses which cannot be used to sign a message). You an get a legacy address using:</p>

<pre><code>bitcoin-cli getnewaddres "" legacy
</code></pre>

<p>If the wallet is locked, you won't be able to sign a message.</p>

CC BY-SA 4.0
2019-10-21T03:40:13.447Z
2019-10-21T03:40:13.447Z
Ava Chow
<p>I simply want to unit test that my lock/unlock process works well on an encrypted wallet.</p>

<p>What would be the easiest command I could send (that doesn't involve sending coins) to actually validate if my wallet is locked or unlocked? Can I try to sign a dummy transaction for example?</p>

<bitcoind><wallet><json-rpc><testnet><testing>
What is the simplest command I could use to test that my wallet unlocking process works properly?
electrotype
# What is the simplest command I could use to test that my wallet unlocking process works properly?

(Asked by: username_0 on 2019-10-21)

I simply want to unit test that my lock/unlock process works well on an encrypted wallet.

What would be the easiest command I could send (that doesn't involve sending coins) to actually validate if my wallet is locked or unlocked? Can I try to sign a dummy transaction for example?

**Tags:** bitcoind, wallet, json-rpc, testnet, testing


---

## 1 answers

### Answer by username_1 on 2019-10-21. Score: 2 | Accepted answer

You can sign a message using the signmessage command. Note that this only works if you are using legacy addresses (Bitcoin Core currently defaults to p2sh-segwit addresses which cannot be used to sign a message). You an get a legacy address using:
bitcoin-cli getnewaddres "" legacy

If the wallet is locked, you won't be able to sign a message.


---

