bitcoin_testnet 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.gitmodules ADDED
@@ -0,0 +1,9 @@
1
+ [submodule "git:/github.com/freewil/bitcoin-testnet-box.git"]
2
+ path = git:/github.com/freewil/bitcoin-testnet-box.git
3
+ url = ./testnet
4
+ [submodule "git@github.com:freewil/bitcoin-testnet-box.git"]
5
+ path = git@github.com:freewil/bitcoin-testnet-box.git
6
+ url = ./testnet
7
+ [submodule "testnet"]
8
+ path = testnet
9
+ url = git://github.com/freewil/bitcoin-testnet-box.git
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bitcoin_testnet.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Ramon Tayag
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # BitcoinTestnet
2
+
3
+ Makes development with Bitcoin a little easier. It has helpers that can be used to start, stop, clean the testnet.
4
+
5
+ ## Usage
6
+
7
+ First, require the library in your `test_helper`/`spec_helper`:
8
+
9
+ require 'bitcoin_testnet'
10
+
11
+ Now, you have access to `BitcoinTestnet`.
12
+
13
+ Second, you have to tell BitcoinTestnet where the testnet in a box directory is. I prefer to keep it in the test folder of my project. For example, with RSpec:
14
+
15
+ git submodule add https://github.com/freewil/bitcoin-testnet-box testnet
16
+
17
+ Then, in your `test_helper`/`spec_helper`:
18
+
19
+ BitcoinTestnet.dir = "spec/testnet"
20
+
21
+ Third, tell `BitcoinTestnet` when to do its work:
22
+
23
+ - Before the test suite starts, call `BitcoinTestnet.start`. This will start the Testnet and clean it. If you have already started the Testnet yourself manually, it will just clean it.
24
+ - Before each spec, call `BitcoinTestnet.clean`. This will reset the Testnet, so it looks like it did the first time you started the Testnet.
25
+ - After the test suite is finished, call `BitcoinTestnet.stop`. This turns off the Testnet and cleans if. If you started the Testnet manually, then it just cleans it.
26
+
27
+ Sample with RSpec:
28
+
29
+ RSpec.configure do |config|
30
+ config.before(:suite) { BitcoinTestnet.start }
31
+ config.before(:each) { BitcoinTestnet.clean }
32
+ config.after(:suite) { BitcoinTestnet.stop }
33
+ end
34
+
35
+
36
+ **Tip**: If you'll just use the above, you can configure it automatically by calling `BitcoinTestnet.configure_rspec!`.
37
+
38
+ ## TL;DR
39
+
40
+ require 'bitcoin_testnet'
41
+
42
+ BitcoinTestnet.dir = "path/to/testnet"
43
+ BitcoinTestnet.configure_rspec!
44
+
45
+ ## Installation
46
+
47
+ Add this line to your application's Gemfile:
48
+
49
+ gem 'bitcoin_testnet'
50
+
51
+ And then execute:
52
+
53
+ $ bundle
54
+
55
+ Or install it yourself as:
56
+
57
+ $ gem install bitcoin_testnet
58
+
59
+ ## Tip
60
+
61
+ To make integration tests faster, use something like [VCR](https://github.com/vcr/vcr) to record the communication between your project and the Testnet.
62
+
63
+ ## Contributing
64
+
65
+ 1. Fork it
66
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
67
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
68
+ 4. Push to the branch (`git push origin my-new-feature`)
69
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bitcoin_testnet/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "bitcoin_testnet"
8
+ gem.version = BitcoinTestnet::VERSION
9
+ gem.authors = ["Ramon Tayag"]
10
+ gem.email = ["ramon.tayag@gmail.com"]
11
+ gem.description = %q{A gem of helpers for making integration tests with the Bitcoin testnet a little easier.}
12
+ gem.summary = %q{A gem of helpers for making integration tests with the Bitcoin testnet a little easier.}
13
+ gem.homepage = ""
14
+
15
+ testnet_files = `cd #{File.join(File.dirname(__FILE__), 'testnet')} && git ls-files`.split($/).map {|file| File.join('testnet', file)}
16
+ gem.files = `git ls-files`.split($/) + testnet_files
17
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
+ gem.require_paths = ["lib"]
20
+
21
+ gem.add_dependency 'activesupport', '~> 3.0'
22
+ end
@@ -0,0 +1,36 @@
1
+ require "bitcoin_testnet/version"
2
+ require 'active_support/core_ext/module'
3
+
4
+ require 'bitcoin_testnet/detector'
5
+ require 'bitcoin_testnet/booter'
6
+ require 'bitcoin_testnet/cleaner'
7
+ require 'bitcoin_testnet/executor'
8
+ require 'bitcoin_testnet/janitor'
9
+
10
+ module BitcoinTestnet
11
+ mattr_accessor :started_manually
12
+ @@started_manually = false
13
+
14
+ mattr_accessor :dir
15
+ @@dir = nil
16
+
17
+ def self.start
18
+ Booter.boot
19
+ end
20
+
21
+ def self.clean
22
+ Cleaner.clean
23
+ end
24
+
25
+ def self.stop
26
+ Janitor.sweep
27
+ end
28
+
29
+ def self.configure_rspec!
30
+ RSpec.configure do |c|
31
+ c.before(:suite) { BitcoinTestnet.start }
32
+ c.before(:each) { BitcoinTestnet.clean }
33
+ c.after(:suite) { BitcoinTestnet.stop }
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,40 @@
1
+ module BitcoinTestnet
2
+ class Booter
3
+
4
+ def self.boot(*args)
5
+ self.new(*args).boot
6
+ end
7
+
8
+ def boot
9
+ if Detector.exists?
10
+ puts "***** Testnet started manually; cleaning only"
11
+ BitcoinTestnet.started_manually = true
12
+ Cleaner.clean
13
+ else
14
+ puts "***** Starting Testnet. To make boot up faster, start the Testnet manually: `cd #{BitcoinTestnet.dir} && make start`"
15
+ thread = Thread.new do
16
+ Cleaner.clean
17
+ Executor.execute "make start > /dev/null"
18
+ end
19
+
20
+ # Wait until the bitcoind servers have started and ready to accept. I've
21
+ # found that the sweet spot was 2 seconds after the thread's status is
22
+ # false
23
+ wait_time = 0
24
+ until wait_time == 5
25
+ if thread.status == false
26
+ sleep 2
27
+ return
28
+ end
29
+ sleep 0.1
30
+ wait_time += 0.1
31
+ end
32
+
33
+ unless Detector.exists?
34
+ fail "The bitcoin processes didn't seem to start. Please ensure that the bitcoin testnet servers started at `#{BitcoinTestnet.dir}`"
35
+ end
36
+ end
37
+ end
38
+
39
+ end
40
+ end
@@ -0,0 +1,14 @@
1
+ module BitcoinTestnet
2
+ class Cleaner
3
+
4
+ def self.clean(*args)
5
+ self.new(*args).clean
6
+ end
7
+
8
+ def clean
9
+ commands = ["cd #{BitcoinTestnet.dir}", "make clean > /dev/null"]
10
+ system commands.join(' && ')
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,21 @@
1
+ module BitcoinTestnet
2
+ class Detector
3
+
4
+ def self.processes
5
+ self.new.processes
6
+ end
7
+
8
+ def self.exists?
9
+ self.new.exists?
10
+ end
11
+
12
+ def processes
13
+ `ps -ef | grep bitcoin | grep -v grep`.split("\n")
14
+ end
15
+
16
+ def exists?
17
+ processes.size == 2
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,18 @@
1
+ module BitcoinTestnet
2
+ class Executor
3
+
4
+ def self.execute(*args)
5
+ self.new(*args).execute
6
+ end
7
+
8
+ def initialize(*commands)
9
+ @commands = commands
10
+ end
11
+
12
+ def execute
13
+ commands = ["cd #{BitcoinTestnet.dir}"] + @commands
14
+ system commands.join(' && ')
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,20 @@
1
+ module BitcoinTestnet
2
+ class Janitor
3
+
4
+ def self.sweep(*args)
5
+ self.new(*args).sweep
6
+ end
7
+
8
+ def sweep
9
+ if BitcoinTestnet.started_manually
10
+ puts "\n***** Since Testnet started manually; cleaning only. If you want to stop it, run: `cd #{BitcoinTestnet.dir} && make stop`"
11
+ Cleaner.clean
12
+ else
13
+ puts "\n***** Since the BitcoinTestnet started the Testnet, stop and clean"
14
+ Executor.execute "make stop > /dev/null"
15
+ Cleaner.clean
16
+ end
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,3 @@
1
+ module BitcoinTestnet
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,11 @@
1
+ # testnet-box functionality
2
+ testnet=1
3
+ irc=0
4
+ upnp=0
5
+
6
+ # listen on different ports than default testnet
7
+ port=19000
8
+ rpcport=19001
9
+
10
+ rpcuser=admin1
11
+ rpcpassword=123
Binary file
Binary file
@@ -0,0 +1,21 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDdzCCAl+gA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CFi3et0d1yKndQ6o4vnxiBMe30zhapWmElZ8LTKpLBPqG
14
+ EmLGYG6CfzNcrvR/Hd5Ro4X7z5yt3iJ4ofuYMeVtiytZa9Mec+7y45PgDgVhGc14
15
+ IZkAiYe2kct5+gRLlp+Ro9fW1uSnfKI0+LAI4E80h7GcqS3+V9xnRAUdAoGBAOFY
16
+ AIr/C9x2lZl7kqQykjum7+3Y0eqyHQVI8s/02+lakvCkJcu0T6c52gd+MTwYE/0t
17
+ tKWK5wu0I21Pn/n23hWQ4So3kw5MASc2IWed6DSpnyTCsuNMRUw+nPzbFj2JF1jp
18
+ eB/456XY5wshx41wFWwLZvct1PcmfJQl4PeRzt/DAoGBAJ2wokbFhyOVSShhfZmg
19
+ aRUAfnSg/GMxfADaWpsScXCbrYUtJ72pF/EXP27KrOZXXWl341F2IVoqTdiAcAnI
20
+ bg3BRH+N1866ZB2hEsZHPo5/jyjWkZusBipi5arZH4tkVTeUx8MbTCsxDJLTpDtL
21
+ 8L2zEra9o3zeqE9QDeFY6PqtAoGAUzvdH3orWGhYw5NYS9v+FZiIwNK4XrchbwVN
22
+ 4rAv1lbFNat75m0Yis0ckm3zI55FK9wJAKh4xOLpvwONNJgR2edks+JJKBu8xU4C
23
+ MrKpxWHtzXc4+in+4rWx6NfHtD0B6a5611xpu+GNHZiBi+WdlAX2J1C/e/a0R0hi
24
+ ey9ZOV8CgYEA1IL9inDBzA+UKfjA5MaufL8JpBQX1u/8y7TigHxRujURVRTuAMyR
25
+ tL+YFJ6heMzUpleJnasSnfu7zN/15aPOYZnyr0qoRn/PUTRBw7Foe+2VWu73IMYx
26
+ A8f7RvrpmPmdVco8CSJWPjGIvsWJm44DJwwDS3DPikWvvBJ7BH8Quhw=
27
+ -----END RSA PRIVATE KEY-----
Binary file
@@ -0,0 +1,13 @@
1
+ # testnet-box functionality
2
+ testnet=1
3
+ irc=0
4
+ upnp=0
5
+ listen=0
6
+ connect=127.0.0.1:19000
7
+
8
+ # listen on different ports than default testnet
9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ADDED
@@ -0,0 +1,29 @@
1
+ BITCOIND=bitcoind
2
+ B1_FLAGS=
3
+ B2_FLAGS=
4
+ B1=$(BITCOIND) -datadir=1 $(B1_FLAGS)
5
+ B2=$(BITCOIND) -datadir=2 $(B2_FLAGS)
6
+
7
+ start:
8
+ $(B1) -daemon
9
+ $(B2) -daemon
10
+
11
+ generate-true:
12
+ $(B1) setgenerate true
13
+
14
+ generate-false:
15
+ $(B1) setgenerate false
16
+
17
+ getinfo:
18
+ $(B1) getinfo
19
+ $(B2) getinfo
20
+
21
+ stop:
22
+ $(B1) stop
23
+ $(B2) stop
24
+
25
+ clean:
26
+ git clean -fd 1/testnet3
27
+ git clean -fd 2/testnet3
28
+ git checkout -- 1/testnet3
29
+ git checkout -- 2/testnet3
@@ -0,0 +1,63 @@
1
+ This is a private, difficulty 1 testnet in a box.
2
+
3
+ You must have bitcoind installed on your system and in the path. This has only been tested against version 0.7.2.
4
+
5
+ Use it as follows:
6
+
7
+ $ make start
8
+
9
+ This will start two nodes. You need two because otherwise the node won't
10
+ generate blocks. You now have a private testnet:
11
+
12
+ $ make getinfo
13
+ bitcoind -datadir=1 getinfo
14
+ {
15
+ "version" : 60006,
16
+ "protocolversion" : 60000,
17
+ "walletversion" : 60000,
18
+ "balance" : 550.00000000,
19
+ "blocks" : 130,
20
+ "connections" : 1,
21
+ "proxy" : "",
22
+ "difficulty" : 0.12500000,
23
+ "testnet" : true,
24
+ "keypoololdest" : 1335827404,
25
+ "keypoolsize" : 101,
26
+ "paytxfee" : 0.00000000,
27
+ "errors" : ""
28
+ }
29
+ bitcoind -datadir=2 getinfo
30
+ {
31
+ "version" : 60006,
32
+ "protocolversion" : 60000,
33
+ "walletversion" : 60000,
34
+ "balance" : 0.00000000,
35
+ "blocks" : 130,
36
+ "connections" : 1,
37
+ "proxy" : "",
38
+ "difficulty" : 0.12500000,
39
+ "testnet" : true,
40
+ "keypoololdest" : 1335826149,
41
+ "keypoolsize" : 101,
42
+ "paytxfee" : 0.00000000,
43
+ "errors" : ""
44
+ }
45
+
46
+ To start generating blocks:
47
+
48
+ $ make generate-true
49
+
50
+ To stop generating blocks:
51
+
52
+ $ make generate-false
53
+
54
+ To stop the two nodes:
55
+
56
+ $ make stop
57
+
58
+ To clean up any files created while running the testnet
59
+ (and restore to the original state of 130 blocks)
60
+
61
+ $ make clean
62
+
63
+ Like all testnet nodes, it is listening on port 18333.
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bitcoin_testnet
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ramon Tayag
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-03-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activesupport
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3.0'
30
+ description: A gem of helpers for making integration tests with the Bitcoin testnet
31
+ a little easier.
32
+ email:
33
+ - ramon.tayag@gmail.com
34
+ executables: []
35
+ extensions: []
36
+ extra_rdoc_files: []
37
+ files:
38
+ - .gitignore
39
+ - .gitmodules
40
+ - Gemfile
41
+ - LICENSE.txt
42
+ - README.md
43
+ - Rakefile
44
+ - bitcoin_testnet.gemspec
45
+ - lib/bitcoin_testnet.rb
46
+ - lib/bitcoin_testnet/booter.rb
47
+ - lib/bitcoin_testnet/cleaner.rb
48
+ - lib/bitcoin_testnet/detector.rb
49
+ - lib/bitcoin_testnet/executor.rb
50
+ - lib/bitcoin_testnet/janitor.rb
51
+ - lib/bitcoin_testnet/version.rb
52
+ - testnet/1/bitcoin.conf
53
+ - testnet/1/testnet3/blk0001.dat
54
+ - testnet/1/testnet3/blkindex.dat
55
+ - testnet/1/testnet3/server.cert
56
+ - testnet/1/testnet3/server.pem
57
+ - testnet/1/testnet3/wallet.dat
58
+ - testnet/2/bitcoin.conf
59
+ - testnet/2/testnet3/blk0001.dat
60
+ - testnet/2/testnet3/blkindex.dat
61
+ - testnet/2/testnet3/server.cert
62
+ - testnet/2/testnet3/server.pem
63
+ - testnet/2/testnet3/wallet.dat
64
+ - testnet/Makefile
65
+ - testnet/README.txt
66
+ homepage: ''
67
+ licenses: []
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ requirements: []
85
+ rubyforge_project:
86
+ rubygems_version: 1.8.25
87
+ signing_key:
88
+ specification_version: 3
89
+ summary: A gem of helpers for making integration tests with the Bitcoin testnet a
90
+ little easier.
91
+ test_files: []