bitcoin-ruby 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.travis.yml +2 -7
- data/COPYING +1 -1
- data/Gemfile +2 -6
- data/Gemfile.lock +34 -0
- data/README.rdoc +16 -68
- data/Rakefile +3 -6
- data/bin/bitcoin_shell +0 -1
- data/{concept-examples/blockchain-pow.rb → examples/concept-blockchain-pow.rb} +0 -0
- data/lib/bitcoin.rb +350 -296
- data/lib/bitcoin/builder.rb +3 -1
- data/lib/bitcoin/connection.rb +2 -1
- data/lib/bitcoin/contracthash.rb +76 -0
- data/lib/bitcoin/dogecoin.rb +97 -0
- data/lib/bitcoin/ffi/bitcoinconsensus.rb +74 -0
- data/lib/bitcoin/ffi/openssl.rb +98 -2
- data/lib/bitcoin/ffi/secp256k1.rb +144 -0
- data/lib/bitcoin/key.rb +12 -2
- data/lib/bitcoin/logger.rb +3 -12
- data/lib/bitcoin/protocol/block.rb +3 -9
- data/lib/bitcoin/protocol/parser.rb +6 -2
- data/lib/bitcoin/protocol/tx.rb +44 -13
- data/lib/bitcoin/protocol/txin.rb +4 -2
- data/lib/bitcoin/protocol/txout.rb +2 -2
- data/lib/bitcoin/script.rb +212 -37
- data/lib/bitcoin/trezor/mnemonic.rb +130 -0
- data/lib/bitcoin/version.rb +1 -1
- data/spec/bitcoin/bitcoin_spec.rb +32 -3
- data/spec/bitcoin/builder_spec.rb +18 -0
- data/spec/bitcoin/contracthash_spec.rb +45 -0
- data/spec/bitcoin/dogecoin_spec.rb +176 -0
- data/spec/bitcoin/ffi_openssl.rb +45 -0
- data/spec/bitcoin/fixtures/156e6e1b84c5c3bd3a0927b25e4119fadce6e6d5186f363317511d1d680fae9a.json +24 -0
- data/spec/bitcoin/fixtures/8d0b238a06b5a70be75d543902d02d7a514d68d3252a949a513865ac3538874c.json +24 -0
- data/spec/bitcoin/fixtures/coinbase-toshi.json +33 -0
- data/spec/bitcoin/fixtures/coinbase.json +24 -0
- data/spec/bitcoin/fixtures/dogecoin-block-60323982f9c5ff1b5a954eac9dc1269352835f47c2c5222691d80f0d50dcf053.bin +0 -0
- data/spec/bitcoin/fixtures/rawtx-01-toshi.json +46 -0
- data/spec/bitcoin/fixtures/rawtx-02-toshi.json +46 -0
- data/spec/bitcoin/fixtures/rawtx-03-toshi.json +73 -0
- data/spec/bitcoin/fixtures/rawtx-testnet-04fdc38d6722ab4b12d79113fc4b2896bdcc5169710690ee4e78541b98e467b4.bin +0 -0
- data/spec/bitcoin/fixtures/rawtx-testnet-0b294c7d11dd21bcccb8393e6744fed7d4d1981a08c00e3e88838cc421f33c9f.bin +0 -0
- data/spec/bitcoin/fixtures/rawtx-testnet-3bc52ac063291ad92d95ddda5fd776a342083b95607ad32ed8bc6f8f7d30449e.bin +0 -0
- data/spec/bitcoin/fixtures/rawtx-testnet-6f0bbdd4e71a8af4305018d738184df32dbb6f27284fdebd5b56d16947f7c181.bin +0 -0
- data/spec/bitcoin/fixtures/rawtx-testnet-a7c9b06e275e8674cc19a5f7d3e557c72c6d93576e635b33212dbe08ab7cdb60.bin +0 -0
- data/spec/bitcoin/fixtures/rawtx-testnet-f80acbd2f594d04ddb0e1cacba662132104909157dff526935a3c88abe9201a5.bin +0 -0
- data/spec/bitcoin/protocol/block_spec.rb +0 -22
- data/spec/bitcoin/protocol/tx_spec.rb +145 -2
- data/spec/bitcoin/script/script_spec.rb +282 -0
- data/spec/bitcoin/secp256k1_spec.rb +48 -0
- data/spec/bitcoin/spec_helper.rb +0 -51
- data/spec/bitcoin/trezor/mnemonic_spec.rb +161 -0
- metadata +48 -98
- data/bin/bitcoin_dns_seed +0 -130
- data/bin/bitcoin_gui +0 -80
- data/bin/bitcoin_node +0 -153
- data/bin/bitcoin_node_cli +0 -81
- data/bin/bitcoin_wallet +0 -402
- data/doc/CONFIG.rdoc +0 -66
- data/doc/EXAMPLES.rdoc +0 -13
- data/doc/NAMECOIN.rdoc +0 -34
- data/doc/NODE.rdoc +0 -225
- data/doc/STORAGE.rdoc +0 -33
- data/doc/WALLET.rdoc +0 -102
- data/examples/balance.rb +0 -66
- data/examples/forwarder.rb +0 -73
- data/examples/index_nhash.rb +0 -24
- data/examples/reindex_p2sh_addrs.rb +0 -44
- data/examples/relay_tx.rb +0 -22
- data/examples/verify_tx.rb +0 -57
- data/lib/bitcoin/config.rb +0 -58
- data/lib/bitcoin/gui/addr_view.rb +0 -44
- data/lib/bitcoin/gui/bitcoin-ruby.png +0 -0
- data/lib/bitcoin/gui/bitcoin-ruby.svg +0 -80
- data/lib/bitcoin/gui/conn_view.rb +0 -38
- data/lib/bitcoin/gui/connection.rb +0 -70
- data/lib/bitcoin/gui/em_gtk.rb +0 -30
- data/lib/bitcoin/gui/gui.builder +0 -1643
- data/lib/bitcoin/gui/gui.rb +0 -292
- data/lib/bitcoin/gui/helpers.rb +0 -115
- data/lib/bitcoin/gui/tree_view.rb +0 -84
- data/lib/bitcoin/gui/tx_view.rb +0 -69
- data/lib/bitcoin/namecoin.rb +0 -280
- data/lib/bitcoin/network/command_client.rb +0 -104
- data/lib/bitcoin/network/command_handler.rb +0 -570
- data/lib/bitcoin/network/connection_handler.rb +0 -387
- data/lib/bitcoin/network/node.rb +0 -565
- data/lib/bitcoin/storage/dummy/dummy_store.rb +0 -179
- data/lib/bitcoin/storage/models.rb +0 -171
- data/lib/bitcoin/storage/sequel/migrations.rb +0 -99
- data/lib/bitcoin/storage/sequel/migrations/001_base_schema.rb +0 -52
- data/lib/bitcoin/storage/sequel/migrations/002_tx.rb +0 -45
- data/lib/bitcoin/storage/sequel/migrations/003_change_txin_script_sig_to_blob.rb +0 -18
- data/lib/bitcoin/storage/sequel/migrations/004_change_txin_prev_out_to_blob.rb +0 -18
- data/lib/bitcoin/storage/sequel/migrations/005_change_tx_hash_to_bytea.rb +0 -14
- data/lib/bitcoin/storage/sequel/migrations/006_add_tx_nhash.rb +0 -31
- data/lib/bitcoin/storage/sequel/migrations/007_add_prev_out_index_index.rb +0 -16
- data/lib/bitcoin/storage/sequel/migrations/008_add_txin_p2sh_type.rb +0 -31
- data/lib/bitcoin/storage/sequel/migrations/009_add_addrs_type.rb +0 -56
- data/lib/bitcoin/storage/sequel/sequel_store.rb +0 -551
- data/lib/bitcoin/storage/storage.rb +0 -517
- data/lib/bitcoin/storage/utxo/migrations/001_base_schema.rb +0 -52
- data/lib/bitcoin/storage/utxo/migrations/002_utxo.rb +0 -18
- data/lib/bitcoin/storage/utxo/migrations/003_update_indices.rb +0 -14
- data/lib/bitcoin/storage/utxo/migrations/004_add_addrs_type.rb +0 -14
- data/lib/bitcoin/storage/utxo/utxo_store.rb +0 -374
- data/lib/bitcoin/validation.rb +0 -400
- data/lib/bitcoin/wallet/coinselector.rb +0 -33
- data/lib/bitcoin/wallet/keygenerator.rb +0 -77
- data/lib/bitcoin/wallet/keystore.rb +0 -207
- data/lib/bitcoin/wallet/txdp.rb +0 -118
- data/lib/bitcoin/wallet/wallet.rb +0 -281
- data/spec/bitcoin/fixtures/freicoin-block-000000005d231b285e63af83edae2d8f5e50e70d396468643092b9239fd3be3c.bin +0 -0
- data/spec/bitcoin/fixtures/freicoin-block-000000005d231b285e63af83edae2d8f5e50e70d396468643092b9239fd3be3c.json +0 -43
- data/spec/bitcoin/fixtures/freicoin-genesis-block-000000005b1e3d23ecfd2dd4a6e1a35238aa0392c0a8528c40df52376d7efe2c.bin +0 -0
- data/spec/bitcoin/fixtures/freicoin-genesis-block-000000005b1e3d23ecfd2dd4a6e1a35238aa0392c0a8528c40df52376d7efe2c.json +0 -67
- data/spec/bitcoin/namecoin_spec.rb +0 -182
- data/spec/bitcoin/node/command_api_spec.rb +0 -663
- data/spec/bitcoin/storage/models_spec.rb +0 -104
- data/spec/bitcoin/storage/reorg_spec.rb +0 -236
- data/spec/bitcoin/storage/storage_spec.rb +0 -387
- data/spec/bitcoin/storage/validation_spec.rb +0 -300
- data/spec/bitcoin/wallet/coinselector_spec.rb +0 -38
- data/spec/bitcoin/wallet/keygenerator_spec.rb +0 -69
- data/spec/bitcoin/wallet/keystore_spec.rb +0 -190
- data/spec/bitcoin/wallet/txdp_spec.rb +0 -76
- data/spec/bitcoin/wallet/wallet_spec.rb +0 -238
data/doc/CONFIG.rdoc
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
= Config
|
2
|
-
|
3
|
-
All commands accept configuration, either via config file, or at the command line.
|
4
|
-
|
5
|
-
== Locations
|
6
|
-
|
7
|
-
There are 3 default locations where configfiles are loaded from:
|
8
|
-
|
9
|
-
* /etc/bitcoin-ruby.yml
|
10
|
-
* ~/.bitcoin-ruby.yml
|
11
|
-
* ./bitcoin-ruby.yml
|
12
|
-
|
13
|
-
Files are loaded in order (if they exist) and override each others settings.
|
14
|
-
|
15
|
-
To specify a different config file use the +--config+ option.
|
16
|
-
|
17
|
-
== Files
|
18
|
-
|
19
|
-
Inside a config file, you can put options for the different commands, separated
|
20
|
-
into categories.
|
21
|
-
|
22
|
-
all:
|
23
|
-
network: bitcoin
|
24
|
-
storage: sequel::postgres:/bitcoin
|
25
|
-
command: 127.0.0.1:1234
|
26
|
-
blockchain:
|
27
|
-
max:
|
28
|
-
connect: 30
|
29
|
-
wallet:
|
30
|
-
keystore: "simple::file=keys.json"
|
31
|
-
|
32
|
-
Options in the +all+ category are loaded by every command, and are loaded first
|
33
|
-
(so command-specific options will override them).
|
34
|
-
|
35
|
-
Other categories are loaded by the corresponding command and may override options
|
36
|
-
from the +all+ category (ie. +bitcoin_wallet+ loads +all+ and +wallet+).
|
37
|
-
|
38
|
-
== Default Values
|
39
|
-
|
40
|
-
all:
|
41
|
-
network: bitcoin # network identifier ("bitcoin", "testnet3", "namecoin")
|
42
|
-
command: "127.0.0.1:9999" # IP:Port to listen for incomming command connections
|
43
|
-
listen: "0.0.0.0:8332" # IP:Port to listen for incoming peer connections
|
44
|
-
connect: "" # List of IP:Port,IP:Port of nodes to connect to
|
45
|
-
storage: "sequel::sqlite://~/.bitcoin-ruby/<network>/blocks.db" # storage backend to use (see STORAGE)
|
46
|
-
node:
|
47
|
-
headers_only: false # download/store only block headers (experimental)
|
48
|
-
dns: true # query peers from dns server
|
49
|
-
epoll: false
|
50
|
-
epoll_limit: 10000
|
51
|
-
epoll_user: nil
|
52
|
-
log: # log levels (debug, info, warn, error, fatal)
|
53
|
-
network: info
|
54
|
-
storage: info
|
55
|
-
max:
|
56
|
-
connections: 32 # number of peer connections
|
57
|
-
addr: 1024 # peer-address store size
|
58
|
-
queue: 500 # storage-queue size
|
59
|
-
inv: 500 # inventory-queue size
|
60
|
-
intervals:
|
61
|
-
queue: 5 # work storage queue
|
62
|
-
inv_queue: 5 # work inventory queue
|
63
|
-
addrs: 15 # collect new peer addrs
|
64
|
-
connect: 30 # connect to new peers
|
65
|
-
wallet:
|
66
|
-
keystore: "simple::file=~/.bitcoin-ruby/<network>/keys.json" # keystore to use
|
data/doc/EXAMPLES.rdoc
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
= Examples
|
2
|
-
|
3
|
-
There are a few demo scripts in `examples/` that might give you an idea where to start.
|
4
|
-
|
5
|
-
connect.rb:: Connect to a network node and chat a little.
|
6
|
-
verify_tx.rb:: Fetch a transaction from local storage and verify signatures.
|
7
|
-
bbe_verify_tx.rb:: Fetch transaction from blockexplorer.com and verify signatures.
|
8
|
-
balance.rb:: Display balance/transactions for given address.
|
9
|
-
relay_tx.rb:: Relay transaction to the network.
|
10
|
-
generate_tx.rb:: Create a transaction.
|
11
|
-
validate_tx.rb:: Verify transaction signatures.
|
12
|
-
simple_network_monitor_and_util:: Connects to the network and lets you monitor and query blocks/txs.
|
13
|
-
forwarder.rb:: Waits for tx sent to your address and forwards them to another address.
|
data/doc/NAMECOIN.rdoc
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
= Namecoin
|
2
|
-
|
3
|
-
Namecoin is almost fully supported.
|
4
|
-
* connect to the network,
|
5
|
-
* store and query the blockchain
|
6
|
-
* transact NMC
|
7
|
-
* create/handle name_new/first/update transaction types
|
8
|
-
|
9
|
-
The AuxPow is parsed from the block header, the only thing missing is actually verifying it.
|
10
|
-
|
11
|
-
== Usage
|
12
|
-
|
13
|
-
It should suffice to just set the network to :namecoin when running the node/wallet.
|
14
|
-
|
15
|
-
bitcoin_node -n namecoin
|
16
|
-
|
17
|
-
bitcoin_wallet -n namecoin list
|
18
|
-
bitcoin_wallet -n namecoin send address:NCme95FewQEjTeBhBfXTyqjz1GTxw4bo56:1.0 0.1
|
19
|
-
|
20
|
-
bitcoin_wallet -n namecoin name_show d/bitcoin
|
21
|
-
bitcoin_wallet -n namecoin name_history d/bitcoin
|
22
|
-
|
23
|
-
bitcoin_wallet -n namecoin name_new d/bitcoin
|
24
|
-
bitcoin_wallet -n namecoin name_firstupdate d/bitcoin abcdef '{"foo": "bar"}'
|
25
|
-
bitcoin_wallet -n namecoin name_update d/bitcoin '{"bar": "baz"}'
|
26
|
-
bitcoin_wallet -n namecoin name_update d/bitcoin 'transferring...' NCme95FewQEjTeBhBfXTyqjz1GTxw4bo56
|
27
|
-
|
28
|
-
== Implementation Details
|
29
|
-
|
30
|
-
All the differences from regular bitcoin behaviour should be in separate modules inside
|
31
|
-
Bitcoin::Namecoin. (this is still a work in progress)
|
32
|
-
|
33
|
-
The AuxPow parsing is implemented in the Bitcoin::Protocol/::Block, because there might
|
34
|
-
be other altchains using it one day.
|
data/doc/NODE.rdoc
DELETED
@@ -1,225 +0,0 @@
|
|
1
|
-
= NODE
|
2
|
-
|
3
|
-
Bitcoin Node. Connects to the network and downloads the blockchain into local storage.
|
4
|
-
|
5
|
-
== Usage
|
6
|
-
|
7
|
-
To run the node with the default options (download the blockchain into ./bitcoin.db
|
8
|
-
using the sequel::sqlite3 STORAGE backend):
|
9
|
-
|
10
|
-
bitcoin_node
|
11
|
-
|
12
|
-
You can specify options (see +--help+) or pass a config file with +--config+ (see CONFIG).
|
13
|
-
|
14
|
-
Some common options you might want to use:
|
15
|
-
|
16
|
-
<tt>-n --network</tt> <i><name></i>::
|
17
|
-
Network to use. Usually +bitcoin+. Support for +namecoin+ is also quite good.
|
18
|
-
Use +testnet+ for development.
|
19
|
-
|
20
|
-
<tt>-c --config</tt> <i><file></i>::
|
21
|
-
Read options from config file. See also CONFIG.
|
22
|
-
|
23
|
-
<tt>--connect</tt> <i><ip:port></i>::
|
24
|
-
List of peers to connect to.
|
25
|
-
|
26
|
-
<tt>-s --storage</tt> <i><backend-string></i>::
|
27
|
-
Storage backend to use. See also STORAGE.
|
28
|
-
|
29
|
-
<tt>--import</tt> <i><blockchain dir></i>::
|
30
|
-
Import blockchain in bitcoind/qt format from given directory.
|
31
|
-
|
32
|
-
<tt>--skip-validation</tt>::
|
33
|
-
Skip validation of received blockchain data. Can be used to speed up import/sync when
|
34
|
-
blockchain data is received from a trusted source.
|
35
|
-
|
36
|
-
<tt>--check-blocks <i><count></i></tt>::
|
37
|
-
Check consistency of the +count+ most recent blocks. Pass -1 to check all blocks.
|
38
|
-
|
39
|
-
<tt>-v --verbose</tt>::
|
40
|
-
Display debug output.
|
41
|
-
|
42
|
-
<tt>-h --help</tt>::
|
43
|
-
Display all available options.
|
44
|
-
|
45
|
-
It will take a long time to download/store the entire blockchain at first, so be patient ;)
|
46
|
-
|
47
|
-
|
48
|
-
== Command socket
|
49
|
-
|
50
|
-
The node opens a separate command socket which you can connect to and query statistics
|
51
|
-
or get notified about new blocks/tx, etc. See below for a list of available commands.
|
52
|
-
For more details, see Bitcoin::Network::CommandHandler.
|
53
|
-
|
54
|
-
=== CLI interface
|
55
|
-
|
56
|
-
The `bitcoin_node_cli` command can be used to interface with a running node, send it commands
|
57
|
-
and subscribe to notifications about new blocks/txs, etc.
|
58
|
-
The easiest way is to just call `bitcoin_node_cli` in the same way you started
|
59
|
-
`bitcoin_node`, but with extra command arguments:
|
60
|
-
|
61
|
-
bitcoin_node_cli info
|
62
|
-
bitcoin_node_cli -c config.yml info
|
63
|
-
bitcoin_node_cli monitor "block tx"
|
64
|
-
|
65
|
-
|
66
|
-
=== CommandClient
|
67
|
-
|
68
|
-
If you are programming in an EventMachine context, you might find the
|
69
|
-
Bitcoin::Network::CommandClient convenient.
|
70
|
-
|
71
|
-
=== Raw socket
|
72
|
-
|
73
|
-
Of course you can also connect to the socket by any other means you like, just
|
74
|
-
your commands as valid JSON, like:
|
75
|
-
|
76
|
-
{"id": 0, "method": <command>, "params": <params>}
|
77
|
-
|
78
|
-
and you'll receive responses in the form:
|
79
|
-
|
80
|
-
{"id": <id>, "method": <method>, "result": <result>}
|
81
|
-
|
82
|
-
For example:
|
83
|
-
|
84
|
-
$ echo -e '{"id": 1, "method": "tslb", "params": {}}\0' | nc 127.0.0.1 9999
|
85
|
-
{"id":1,"method":"tslb","result":{"tslb":10}}
|
86
|
-
|
87
|
-
|
88
|
-
=== Commands
|
89
|
-
|
90
|
-
==== info
|
91
|
-
|
92
|
-
Get various statistics.
|
93
|
-
|
94
|
-
bitcoin_node_cli info
|
95
|
-
|
96
|
-
==== config
|
97
|
-
|
98
|
-
Get the currently active configuration.
|
99
|
-
|
100
|
-
bitcoin_node_cli config
|
101
|
-
|
102
|
-
==== connections
|
103
|
-
|
104
|
-
Get currently connected peers.
|
105
|
-
|
106
|
-
bitcoin_node_cli connections
|
107
|
-
|
108
|
-
==== connect
|
109
|
-
|
110
|
-
Connect to given peer(s).
|
111
|
-
|
112
|
-
bitcoin_node_cli connect <ip>:<port>[,<ip>:<port>]
|
113
|
-
|
114
|
-
==== disconnect
|
115
|
-
|
116
|
-
Disconnect given peer(s).
|
117
|
-
|
118
|
-
bitcoin_node_cli disconnect <ip>:<port>[,<ip>,<port>]
|
119
|
-
|
120
|
-
==== getblocks
|
121
|
-
|
122
|
-
Trigger the node to ask its peers for new blocks.
|
123
|
-
|
124
|
-
bitcoin_node_cli getblocks
|
125
|
-
|
126
|
-
==== getaddr
|
127
|
-
|
128
|
-
Trigger the node to ask its for new peer addresses.
|
129
|
-
|
130
|
-
bitcoin_node_cli getaddr
|
131
|
-
|
132
|
-
==== addrs
|
133
|
-
|
134
|
-
Get known peer addresses (used by bin/bitcoin_dns_seed)
|
135
|
-
|
136
|
-
bitcoin_node_cli addrs [count]
|
137
|
-
|
138
|
-
==== tslb
|
139
|
-
|
140
|
-
Get Time Since Last Block.
|
141
|
-
|
142
|
-
bitcoin_node_cli tslb
|
143
|
-
|
144
|
-
==== create_tx
|
145
|
-
|
146
|
-
Create a transaction, collecting outputs from given +keys+, spending to +recipients+
|
147
|
-
with an optional +fee+.
|
148
|
-
Keys is an array that can contain either privkeys, pubkeys or addresses.
|
149
|
-
When a privkey is given, the corresponding inputs are signed. If not, the
|
150
|
-
signature_hash is computed and passed along with the response.
|
151
|
-
After creating an unsigned transaction, one just needs to sign the sig_hashes
|
152
|
-
and send everything to #assemble_tx, to receive the complete transaction that
|
153
|
-
can be relayed to the network.
|
154
|
-
|
155
|
-
bitcoin_node_cli create_tx 'keys=[<addr|pub|priv>, <...>]' 'recipients=[[<addr>, <amount>], ...]'
|
156
|
-
|
157
|
-
==== assemble_tx
|
158
|
-
|
159
|
-
Assemble an unsigned transaction from the +tx+ and +sig_pubkeys+ params and return
|
160
|
-
a valid transaction that can be relayed to the network.
|
161
|
-
The +tx+ is the regular transaction structure, with empty input scripts
|
162
|
-
(as returned by #create_tx when called without privkeys).
|
163
|
-
+sig_pubkeys+ is an array of [signature, pubkey] pairs used to build the input scripts.
|
164
|
-
|
165
|
-
bitcoin_node_cli assemble_tx tx=<hex> 'sig_pubkeys=[[<sig>, <pub>], ...]'
|
166
|
-
|
167
|
-
==== relay_tx
|
168
|
-
|
169
|
-
Relay given transaction (in hex).
|
170
|
-
|
171
|
-
bitcoin_node_cli relay_tx <tx in hex>
|
172
|
-
|
173
|
-
==== store_block
|
174
|
-
|
175
|
-
Validate and store given block (in hex) as if it was received by a peer.
|
176
|
-
|
177
|
-
bitcoin_node_cli store_block <block in hex>
|
178
|
-
|
179
|
-
==== store_tx
|
180
|
-
|
181
|
-
Store given transaction (in hex) as if it was received by a peer.
|
182
|
-
|
183
|
-
bitcoin_node_cli store_tx <tx in hex>
|
184
|
-
|
185
|
-
==== stop
|
186
|
-
|
187
|
-
Stop the bitcoin node.
|
188
|
-
|
189
|
-
bitcoin_node_cli stop
|
190
|
-
|
191
|
-
==== help
|
192
|
-
|
193
|
-
List all available commands.
|
194
|
-
|
195
|
-
bitcoin_node_cli help
|
196
|
-
|
197
|
-
|
198
|
-
=== Monitors
|
199
|
-
|
200
|
-
==== block
|
201
|
-
|
202
|
-
Monitor new blocks that are accepted into the main chain.
|
203
|
-
If +last+ parameter is given, it will send all blocks since then.
|
204
|
-
|
205
|
-
bitcoin_node_cli monitor channel=block
|
206
|
-
bitcoin_node_cli monitor channel=block last=1234
|
207
|
-
|
208
|
-
==== tx
|
209
|
-
|
210
|
-
Monitor new transactions.
|
211
|
-
If +conf+ parameter is given, it will only send txs with at least that many confirmations.
|
212
|
-
If +last+ parameter is given, it will send all txs since then.
|
213
|
-
|
214
|
-
bitcoin_node_cli monitor channel=tx
|
215
|
-
bitcoin_node_cli monitor channel=tx conf=1 last=b187505ce2acbafcb02948657c0cadb855fbcbf0491f12670f9ff8d271de1983
|
216
|
-
|
217
|
-
==== output
|
218
|
-
|
219
|
-
Monitor transaction outputs.
|
220
|
-
If +conf+ parameter is given, it will only send outputs with at least that many confirmations.
|
221
|
-
If +last+ parameter is given, it will send all outputs since then.
|
222
|
-
If +addresses+ parameter is given, it will only send outputs related to those addresses.
|
223
|
-
|
224
|
-
bitcoin_node_cli monitor channel=output
|
225
|
-
bitcoin_node_cli monitor channel=output conf=1 last=b187505ce2acbafcb02948657c0cadb855fbcbf0491f12670f9ff8d271de1983:0
|
data/doc/STORAGE.rdoc
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
= Storage
|
2
|
-
|
3
|
-
There is support for different storage backends, currently there are two. Each backend can be used with sqlite, postgres or mysql.
|
4
|
-
|
5
|
-
== Backends
|
6
|
-
|
7
|
-
=== UTXO
|
8
|
-
|
9
|
-
The `utxo` backend stores only the minimum amount of information needed to validate new blocks, namely the `Unspent TX Outputs`. So it can be used to independently validate the whole blockchain as it goes, but it cannot query old data or serve blocks to peers. There is however a way to tell it specific addresses for which it will keep the history (the ones in your wallet).
|
10
|
-
|
11
|
-
=== Sequel
|
12
|
-
|
13
|
-
The `sequel` backend stores the whole blockchain into a fully normalized SQL DB. It can be used to run arbitrary queries on the blockchain data, but the database gets huge and it takes a very long time to do an initial sync.
|
14
|
-
|
15
|
-
It is used to run http://webbtc.com and there are also postgres dumps to get you started faster on http://dumps.webbtc.com.
|
16
|
-
|
17
|
-
|
18
|
-
== Config
|
19
|
-
|
20
|
-
For examples that require storage backends, you can specify them using
|
21
|
-
a string containing the backend name and a configuration string.
|
22
|
-
The default backend is +utxo::sqlite:~/.bitcoin-ruby/<network>blocks.db+, which is a sqlite database called +blocks.db+ in a directory named after the network you're using, inside your homedir.
|
23
|
-
|
24
|
-
sequel::sqlite:/ # in-memory
|
25
|
-
sequel::sqlite://bitcoin.db
|
26
|
-
sequel::sqlite:///tmp/bitcoin.db
|
27
|
-
sequel::postgres:/bitcoin
|
28
|
-
sequel::postgres://<user>:<pass>@<host>:<port>/<database>
|
29
|
-
|
30
|
-
== Custom Backends
|
31
|
-
|
32
|
-
To implement a custom backend you need to inherit from Bitcoin::Storage::Backends::StoreBase
|
33
|
-
and implement the methods defined there. When returning blocks/tx, you should wrap them in Bitcoin::Storage::Models objects. See the `dummy` backend for a simple example.
|
data/doc/WALLET.rdoc
DELETED
@@ -1,102 +0,0 @@
|
|
1
|
-
= WALLET
|
2
|
-
|
3
|
-
The wallet stores your keys/addresses, knows which transactions belong to them,
|
4
|
-
can create transactions, etc.
|
5
|
-
|
6
|
-
== Keystores
|
7
|
-
|
8
|
-
A keystore is responsible for storing/accessing your keys/addresses.
|
9
|
-
|
10
|
-
The +simple+ keystore (Bitcoin::Wallet::SimpleKeyStore) will create one key
|
11
|
-
and put it into the given file. You can later ask it to generate more keys
|
12
|
-
or add labels to the keys.
|
13
|
-
|
14
|
-
The +deterministic+ keystore (Bitcoin::Wallet::KeyGenerator) uses the seed
|
15
|
-
(which should be a large, unique, random string!) and generates the given number
|
16
|
-
of keys. The nonce is optional, it just speeds up finding the first key.
|
17
|
-
Note: Currently this keystore is not usable because it doesn't support labels yet.
|
18
|
-
|
19
|
-
|
20
|
-
== Config
|
21
|
-
|
22
|
-
To use the wallet you should create a configfile. It's not required but more convenient.
|
23
|
-
See CONFIG for details.
|
24
|
-
|
25
|
-
wallet:
|
26
|
-
keystore: "simple::file=keys.json"
|
27
|
-
# keystore: "deterministic::seed=foo,nonce=2116,keys=7"
|
28
|
-
|
29
|
-
|
30
|
-
== Usage
|
31
|
-
|
32
|
-
Then you can list all addresses in the wallet:
|
33
|
-
|
34
|
-
bitcoin_wallet list
|
35
|
-
|
36
|
-
Display transaction history for a specific address:
|
37
|
-
|
38
|
-
bitcoin_wallet list <address>
|
39
|
-
|
40
|
-
Create new keys/addresses:
|
41
|
-
|
42
|
-
bitcoin_wallet new
|
43
|
-
|
44
|
-
Import keys from base58 format:
|
45
|
-
|
46
|
-
bitcoin_wallet import <base58>
|
47
|
-
|
48
|
-
Export keys to base58 format:
|
49
|
-
|
50
|
-
bitcoin_wallet export <address>
|
51
|
-
|
52
|
-
== Transactions
|
53
|
-
|
54
|
-
Transactions consist of multiple inputs and outputs. Inputs are selected
|
55
|
-
automatically, and you can define outputs of different types.
|
56
|
-
Each output has a +value+ (specified in base units/"satoshis"), and script represented by
|
57
|
-
the script type (see below) and one or more recipients (addresses or public keys).
|
58
|
-
|
59
|
-
Outputs can be specified as a combination of type, recipient(s) and value.
|
60
|
-
|
61
|
-
bitcoin_wallet send <type>:<recipients>:<value> [<fee>]
|
62
|
-
|
63
|
-
This will create and sign a transaction and display it, asking for confirmation.
|
64
|
-
If you accept, it will be sent to your node and relayed to the rest of the network.
|
65
|
-
|
66
|
-
|
67
|
-
There are different script types:
|
68
|
-
|
69
|
-
|
70
|
-
=== Address
|
71
|
-
|
72
|
-
Specify address/hash160 of the public key needed to spend the output again.
|
73
|
-
This is the most commonly used transaction type at the moment.
|
74
|
-
|
75
|
-
bitcoin_wallet send address:1GQkkFvAFW2ts3YLnEvMnu76WyCB6yDb4d:0.1 0.005
|
76
|
-
|
77
|
-
|
78
|
-
=== Pubkey
|
79
|
-
|
80
|
-
Specify public key needed to spend the output.
|
81
|
-
Somewhat deprecated (because of the higher long-term storage requirements compared
|
82
|
-
to address-transactions).
|
83
|
-
|
84
|
-
bitcoin_wallet send pubkey:<pubkey in hex>:1.0 0.005
|
85
|
-
|
86
|
-
|
87
|
-
=== Multisig
|
88
|
-
|
89
|
-
Specify multiple addresses needed to spend the output.
|
90
|
-
|
91
|
-
bitcoin_wallet send <type>:<m>:<key>:<key>:<amount> [<fee>]
|
92
|
-
bitcoin_wallet send multisig:1:1GQkkFvAFW2ts3YLnEvMnu76WyCB6yDb4d:1C5uWeXorS46ZubciCLN4zyR7sAqeNJfLD:1.0 0.005
|
93
|
-
|
94
|
-
You can give up to 3 addresses/keys and +m+ specifies how many of them are required to spend
|
95
|
-
the output.
|
96
|
-
|
97
|
-
Note: Currently you need to have all keys in the same wallet for this to work.
|
98
|
-
|
99
|
-
|
100
|
-
=== P2SH
|
101
|
-
|
102
|
-
# TODO
|