WALLET.rdoc 2.77 KB

WALLET

The wallet stores your keys/addresses, knows which transactions belong to them, can create transactions, etc.

Keystores

A keystore is responsible for storing/accessing your keys/addresses.

The simple keystore (Bitcoin::Wallet::SimpleKeyStore) will create one key and put it into the given file. You can later ask it to generate more keys or add labels to the keys.

The deterministic keystore (Bitcoin::Wallet::KeyGenerator) uses the seed (which should be a large, unique, random string!) and generates the given number of keys. The nonce is optional, it just speeds up finding the first key. Note: Currently this keystore is not usable because it doesn't support labels yet.

Config

To use the wallet you should create a configfile. It's not required but more convenient. See CONFIG for details.

wallet:
  keystore: "simple::file=keys.json"
  # keystore: "deterministic::seed=foo,nonce=2116,keys=7"

Usage

Then you can list all addresses in the wallet:

bitcoin_wallet list

Display transaction history for a specific address:

bitcoin_wallet list <address>

Create new keys/addresses:

bitcoin_wallet new

Import keys from base58 format:

bitcoin_wallet import <base58>

Export keys to base58 format:

bitcoin_wallet export <address>

Transactions

Transactions consist of multiple inputs and outputs. Inputs are selected automatically, and you can define outputs of different types. Each output has a value (specified in base units/“satoshis”), and script represented by the script type (see below) and one or more recipients (addresses or public keys).

Outputs can be specified as a combination of type, recipient(s) and value.

bitcoin_wallet send <type>:<recipients>:<value> [<fee>]

This will create and sign a transaction and display it, asking for confirmation. If you accept, it will be sent to your node and relayed to the rest of the network.

There are different script types:

Address

Specify address/hash160 of the public key needed to spend the output again. This is the most commonly used transaction type at the moment.

bitcoin_wallet send address:1GQkkFvAFW2ts3YLnEvMnu76WyCB6yDb4d:0.1 0.005

Pubkey

Specify public key needed to spend the output. Somewhat deprecated (because of the higher long-term storage requirements compared to address-transactions).

bitcoin_wallet send pubkey:<pubkey in hex>:1.0 0.005

Multisig

Specify multiple addresses needed to spend the output.

bitcoin_wallet send <type>:<m>:<key>:<key>:<amount> [<fee>]
bitcoin_wallet send multisig:1:1GQkkFvAFW2ts3YLnEvMnu76WyCB6yDb4d:1C5uWeXorS46ZubciCLN4zyR7sAqeNJfLD:1.0 0.005

You can give up to 3 addresses/keys and m specifies how many of them are required to spend the output.

Note: Currently you need to have all keys in the same wallet for this to work.

P2SH

# TODO