From 7afb114fd6877604939cb2619546b60dab0bc998 Mon Sep 17 00:00:00 2001 From: Shannon Appelcline Date: Fri, 24 Feb 2017 16:14:22 -0800 Subject: [PATCH] 1B Capture the Private Key --- 3_Playing_with_Bitcoin.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/3_Playing_with_Bitcoin.md b/3_Playing_with_Bitcoin.md index 904b5bc..9e46ce7 100644 --- a/3_Playing_with_Bitcoin.md +++ b/3_Playing_with_Bitcoin.md @@ -65,6 +65,14 @@ alias br="bitcoin-cli -regtest" ``` For even more complexity, you could have each of your 'start' aliases use the -conf flag to load configuration from a different file. However, this complexity goes far beyond the scope of this tutorial, but we offer it as a starting point for when your explorations of Bitcoin reach the next level. +### Run Bitcoind + +Bitcoind _must_ be running to use bitcoin-cli. If you used our standard setup, it should be. You can double check by looking at the process table. +``` +$ ps auxww | grep bitcoind +user1 29360 11.5 39.6 2676812 1601416 ? SLsl Feb23 163:42 /usr/local/bin/bitcoind -daemon +``` + ### Verify Your Blocks You should have the whole blockchain (or the pruned blockchain) ready before you start playing. Just run the 'btcblock' alias to see if it's all loaded. You'll see two numbers, which tell you how many blocks have loaded out of how many total. @@ -285,4 +293,18 @@ We'll use this same technique when dealing with future address; note that you co ### Capture the Private Key +The address lets you receive bitcoins, but to spend them, you'll need the addresses private address. That's achieved with the "bitcoin-cli dumpprivkey" command. The following extracts the address from the variable created by the best practices, above, them dumps the private key into another variable: +``` +$ unset NEW_PRIV_KEY_1 +$ NEW_PRIV_KEY_1=$(bitcoin-cli dumpprivkey "$NEW_ADDRESS_1") +``` +As usual, an echo will show you what you have: +``` +$ echo $NEW_PRIV_KEY_1 +cUPty98cDC6aYfN1ba8SCbqSh2twyAh5voFEQu8q5io7LmMANnpK +``` +Usually you would not want to share this with anyone! + +### Sign a Message +