Skip to content

Instantly share code, notes, and snippets.

@bitgord
Last active January 12, 2017 22:22
Show Gist options
  • Save bitgord/2ab01aa8c353b96e307ef167da66c930 to your computer and use it in GitHub Desktop.
Save bitgord/2ab01aa8c353b96e307ef167da66c930 to your computer and use it in GitHub Desktop.
Connect to Bitcoind in your terminal
// This gist assumes you have already setup bitcoind
// If you have not you can go to that walkthrough here https://gist.github.com/bitgord/88547c580139d7629dd103ec923adc0a
// When you first run bitcoind you get an arror message that requires a username and password
// create a new file in the bitcoin directory called bitcoin.conf and add a username and password
rpcuser=username
rpcpassword=1234
// While you are configuring the file you can add other customizations
// View the customizations with the help command
bitcoind --help
// Now you can run the Bitcoin Core client
bitcoind -daemon
// The Bitcoin Core client uses a JSON-RPC interface that can be accessed using bitcoin-cli
// With the command line we can interact with the API
bitcoin-cli help
// Get information on blockchain
bitcoin-cli get info // displays basic information about the status of the bitcoin network node, the wallet and the blockchain database
// Setup a wallet // First encrypt the wallet with a password
// replace PASSWORD with your chosen password
bitcoin-cli encryptwallet PASSWORD
// You can verify that the valley has been encrypted by running getinfo again // Note that you need to restart bitcoin daemon
// You will notice a new entry called unlocked_until which will show how long the decryption password will be store in memory (keeping the wallet unlocked)
// To unlock the wallet use the walletpassphrase command with the password and the number of seconds until the wallet is locked again automatically
bitcoin-cli walletpassphrase PASSWORD 100
// You can confirm the wallet is unlocked and see the timeout by running getinfo again
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment