ビットコインアドレスの生成

Bitcoin Coreで自分のwalletに新しい公開鍵暗号の鍵のペアを作成する
vagrant@vagrant-ubuntu-trusty-64:~/bitcoin$ bitcoind -daemon
Bitcoin server starting
vagrant@vagrant-ubuntu-trusty-64:~/bitcoin$ bitcoin-cli getnewaddress
39Gydphv6RaWwmx3bwEbGihtvXdXWXnobW

walletの秘密鍵の暗号化
vagrant@vagrant-ubuntu-trusty-64:~/bitcoin$ bitcoin-cli encryptwallet password
wallet encrypted; Bitcoin server stopping, restart to run with encrypted wallet. The keypool has been flushed and a new HD seed was generated (if you are using HD). You need to make a new backup.
vagrant@vagrant-ubuntu-trusty-64:~/bitcoin$ bitcoind -daemon
Bitcoin server starting

U01 testnet Faucet https://bitcoinfaucet.uo1.net/

あれ、rpc errorってなってる??

transactionがpendingになっているので、Proof of workがまだって理解でOK?
vagrant@vagrant-ubuntu-trusty-64:~/bitcoin$ bitcoin-cli getbalance
0.00000000

vagrant@vagrant-ubuntu-trusty-64:~/bitcoin$ bitcoin-cli listunspent
[
]

bitcoin coreを動かすと、大分具体的になるね。

require 'bitcoin'
require 'net/http'
require 'json'
Bitcoin.network = :testnet3
RPCUSER = 
RPCPASSWORD =
HOST = "localhost"
PORT=18332

def bitcoinRPC(method, param)
	http = Net::HTTP.new(HOST, PORT)
	request = Net::HTTP::Post.new('/')
	request.basic_auth(RPCUSER,RPCPASSWORD)
	request.content_type = 'application/json'
	request.body = {method: method, params: param, id: 'jsonrpc'}.to_json
	JSON.parse(http.request(request).body)["result"]
end