bitcoin-ruby 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +7 -7
- data/README.rdoc +1 -1
- data/examples/simple_network_monitor_and_util.rb +8 -0
- data/lib/bitcoin.rb +57 -17
- data/lib/bitcoin/builder.rb +15 -10
- data/lib/bitcoin/ffi/bitcoinconsensus.rb +3 -2
- data/lib/bitcoin/ffi/secp256k1.rb +143 -81
- data/lib/bitcoin/key.rb +4 -6
- data/lib/bitcoin/logger.rb +11 -0
- data/lib/bitcoin/protocol.rb +19 -6
- data/lib/bitcoin/protocol/aux_pow.rb +62 -62
- data/lib/bitcoin/protocol/block.rb +20 -15
- data/lib/bitcoin/protocol/handler.rb +4 -0
- data/lib/bitcoin/protocol/parser.rb +30 -29
- data/lib/bitcoin/protocol/reject.rb +38 -0
- data/lib/bitcoin/protocol/tx.rb +19 -3
- data/lib/bitcoin/protocol/txin.rb +14 -8
- data/lib/bitcoin/script.rb +6 -1
- data/lib/bitcoin/version.rb +1 -1
- data/spec/bitcoin/bitcoin_spec.rb +4 -0
- data/spec/bitcoin/builder_spec.rb +11 -0
- data/spec/bitcoin/dogecoin_spec.rb +6 -6
- data/spec/bitcoin/protocol/addr_spec.rb +11 -1
- data/spec/bitcoin/protocol/aux_pow_spec.rb +9 -9
- data/spec/bitcoin/protocol/block_spec.rb +1 -0
- data/spec/bitcoin/protocol/inv_spec.rb +10 -2
- data/spec/bitcoin/protocol/parser_spec.rb +50 -0
- data/spec/bitcoin/protocol/reject.rb +17 -0
- data/spec/bitcoin/protocol/tx_spec.rb +5 -1
- data/spec/bitcoin/script/script_spec.rb +1 -1
- data/spec/bitcoin/secp256k1_spec.rb +8 -0
- data/spec/bitcoin/spec_helper.rb +6 -0
- metadata +8 -3
@@ -172,7 +172,7 @@ describe 'Bitcoin::Script' do
|
|
172
172
|
|
173
173
|
# from tx 274f8be3b7b9b1a220285f5f71f61e2691dd04df9d69bb02a8b3b85f91fb1857, second pubkey has invalid encoding.
|
174
174
|
output = "1 0351efb6e91a31221652105d032a2508275f374cea63939ad72f1b1e02f477da78 00f2b7816db49d55d24df7bdffdbc1e203b424e8cd39f5651ab938e5e4a193569e 2 OP_CHECKMULTISIG"
|
175
|
-
Bitcoin::Script.from_string(output).get_multisig_addresses.should == ["1NdB761LmTmrJixxp93nz7pEiCx5cKPW44"]
|
175
|
+
Bitcoin::Script.from_string(output).get_multisig_addresses.should == ["1NdB761LmTmrJixxp93nz7pEiCx5cKPW44", nil]
|
176
176
|
end
|
177
177
|
|
178
178
|
it "#get_p2sh_address" do
|
@@ -15,6 +15,14 @@ describe 'libsecp256k1' do
|
|
15
15
|
["\x04"].include?(pub[0]).should == true
|
16
16
|
end
|
17
17
|
|
18
|
+
it 'generate key' do
|
19
|
+
key = Bitcoin::Secp256k1.generate_key(compressed = true)
|
20
|
+
key.compressed.should == true
|
21
|
+
|
22
|
+
key = Bitcoin::Secp256k1.generate_key(compressed = false)
|
23
|
+
key.compressed.should == false
|
24
|
+
end
|
25
|
+
|
18
26
|
it 'sign and verify' do
|
19
27
|
priv, pub = Bitcoin::Secp256k1.generate_key_pair
|
20
28
|
signature = Bitcoin::Secp256k1.sign("derp", priv)
|
data/spec/bitcoin/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bitcoin-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This is a ruby library for interacting with the bitcoin protocol/network
|
14
14
|
email:
|
@@ -51,6 +51,7 @@ files:
|
|
51
51
|
- lib/bitcoin/protocol/block.rb
|
52
52
|
- lib/bitcoin/protocol/handler.rb
|
53
53
|
- lib/bitcoin/protocol/parser.rb
|
54
|
+
- lib/bitcoin/protocol/reject.rb
|
54
55
|
- lib/bitcoin/protocol/tx.rb
|
55
56
|
- lib/bitcoin/protocol/txin.rb
|
56
57
|
- lib/bitcoin/protocol/txout.rb
|
@@ -213,7 +214,9 @@ files:
|
|
213
214
|
- spec/bitcoin/protocol/getblocks_spec.rb
|
214
215
|
- spec/bitcoin/protocol/inv_spec.rb
|
215
216
|
- spec/bitcoin/protocol/notfound_spec.rb
|
217
|
+
- spec/bitcoin/protocol/parser_spec.rb
|
216
218
|
- spec/bitcoin/protocol/ping_spec.rb
|
219
|
+
- spec/bitcoin/protocol/reject.rb
|
217
220
|
- spec/bitcoin/protocol/tx_spec.rb
|
218
221
|
- spec/bitcoin/protocol/txin_spec.rb
|
219
222
|
- spec/bitcoin/protocol/txout_spec.rb
|
@@ -242,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
242
245
|
version: 1.3.6
|
243
246
|
requirements: []
|
244
247
|
rubyforge_project: bitcoin-ruby
|
245
|
-
rubygems_version: 2.4.5
|
248
|
+
rubygems_version: 2.4.5.1
|
246
249
|
signing_key:
|
247
250
|
specification_version: 4
|
248
251
|
summary: bitcoin utils and protocol in ruby
|
@@ -402,7 +405,9 @@ test_files:
|
|
402
405
|
- spec/bitcoin/protocol/getblocks_spec.rb
|
403
406
|
- spec/bitcoin/protocol/inv_spec.rb
|
404
407
|
- spec/bitcoin/protocol/notfound_spec.rb
|
408
|
+
- spec/bitcoin/protocol/parser_spec.rb
|
405
409
|
- spec/bitcoin/protocol/ping_spec.rb
|
410
|
+
- spec/bitcoin/protocol/reject.rb
|
406
411
|
- spec/bitcoin/protocol/tx_spec.rb
|
407
412
|
- spec/bitcoin/protocol/txin_spec.rb
|
408
413
|
- spec/bitcoin/protocol/txout_spec.rb
|