A web based interface to the Bitcoin API JSON-RPC

Command: encryptwallet

The encryptwallet RPC encrypts the wallet with a passphrase. This is only to enable encryption for the first time. After encryption is enabled, you will need to enter the passphrase to use private keys.

Parameter #1—a passphrase
Result—a notice (with program shutdown on success)

The passphrase to use for the encrypted wallet. Must be at least one character.
Successfully executing this command shuts down bitcoin core, it will need to be manually restarted.
encryptwallet "passphrase"

Encrypts the wallet with 'passphrase'. This is for first time encryption.
After this, any calls that interact with private keys such as sending or signing 
will require the passphrase to be set prior the making these calls.
Use the walletpassphrase call for this, and then walletlock call.
If the wallet is already encrypted, use the walletpassphrasechange call.
Note that this will shutdown the server.

1. "passphrase"    (string) The pass phrase to encrypt the wallet with. It must be at least 1 character, but should be long.


Encrypt your wallet
> bitcoin-cli encryptwallet "my pass phrase"

Now set the passphrase to use the wallet, such as for signing or sending bitcoin
> bitcoin-cli walletpassphrase "my pass phrase"

Now we can do something like sign
> bitcoin-cli signmessage "address" "test message"

Now lock the wallet again by removing the passphrase
> bitcoin-cli walletlock 

As a json rpc call
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "encryptwallet", "params": ["my pass phrase"] }' -H 'content-type: text/plain;'