sibit 0.25.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +18 -28
- data/Gemfile.lock +187 -0
- data/LICENSE.txt +1 -1
- data/LICENSES/MIT.txt +21 -0
- data/README.md +82 -60
- data/REUSE.toml +35 -0
- data/Rakefile +3 -29
- data/bin/sibit +7 -23
- data/cucumber.yml +3 -0
- data/features/cli.feature +2 -0
- data/features/gem_package.feature +4 -1
- data/features/step_definitions/steps.rb +2 -19
- data/features/support/env.rb +2 -19
- data/lib/sibit/bestof.rb +5 -22
- data/lib/sibit/bitcoin/base58.rb +50 -0
- data/lib/sibit/bitcoin/key.rb +87 -0
- data/lib/sibit/bitcoin/script.rb +58 -0
- data/lib/sibit/bitcoin/tx.rb +212 -0
- data/lib/sibit/bitcoin/txbuilder.rb +120 -0
- data/lib/sibit/bitcoinchain.rb +5 -22
- data/lib/sibit/blockchain.rb +5 -22
- data/lib/sibit/blockchair.rb +5 -22
- data/lib/sibit/btc.rb +6 -23
- data/lib/sibit/cex.rb +5 -22
- data/lib/sibit/cryptoapis.rb +5 -22
- data/lib/sibit/earn.rb +5 -21
- data/lib/sibit/error.rb +3 -20
- data/lib/sibit/fake.rb +3 -20
- data/lib/sibit/firstof.rb +5 -22
- data/lib/sibit/http.rb +3 -20
- data/lib/sibit/json.rb +6 -23
- data/lib/sibit/version.rb +4 -21
- data/lib/sibit.rb +31 -40
- data/logo.svg +1 -1
- data/sibit.gemspec +16 -33
- metadata +27 -49
- data/.0pdd.yml +0 -9
- data/.gitattributes +0 -7
- data/.github/workflows/codecov.yml +0 -21
- data/.github/workflows/pdd.yml +0 -15
- data/.github/workflows/rake.yml +0 -24
- data/.github/workflows/xcop.yml +0 -17
- data/.gitignore +0 -8
- data/.pdd +0 -7
- data/.rubocop.yml +0 -38
- data/.rultor.yml +0 -21
- data/.simplecov +0 -40
- data/lib/sibit/log.rb +0 -49
- data/renovate.json +0 -6
- data/test/test__helper.rb +0 -29
- data/test/test_bestof.rb +0 -62
- data/test/test_bitcoinchain.rb +0 -73
- data/test/test_blockchain.rb +0 -58
- data/test/test_blockchair.rb +0 -43
- data/test/test_btc.rb +0 -117
- data/test/test_cex.rb +0 -43
- data/test/test_cryptoapis.rb +0 -51
- data/test/test_fake.rb +0 -55
- data/test/test_firstof.rb +0 -62
- data/test/test_json.rb +0 -40
- data/test/test_live.rb +0 -138
- data/test/test_sibit.rb +0 -209
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 26f4c44fb885107624430b74d7569225066671183ed74dc594f3b3485baf19d3
|
|
4
|
+
data.tar.gz: 56bb0d2f75bf2356535feaaf14d94cc8080360189618a63324bacba2e5716170
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 39193cad324c8574b4a42f043b4f6c6b4eba0f948dfe2fc3185f5f49316b24859a7df0807864e0a858a2574eadb0c41bc181b133adda0d7a3292d9980eae059c
|
|
7
|
+
data.tar.gz: 164fa4a3b6627ac4b0dedb3513aa332bc06aa627320ed1dd44007f001b74d48694165893d6345095b7a79ab3cdd271bab7a1bbd9a87ef3a0135112c7e8eadb0b
|
data/Gemfile
CHANGED
|
@@ -1,35 +1,25 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2019-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
6
|
source 'https://rubygems.org'
|
|
24
7
|
gemspec
|
|
25
8
|
|
|
26
|
-
gem 'aruba', '2.2.0', require: false
|
|
27
|
-
gem 'cucumber', '9.1.0', require: false
|
|
28
9
|
# gem 'debase', '0.2.4.1', require: false
|
|
29
|
-
|
|
30
|
-
gem '
|
|
31
|
-
gem '
|
|
32
|
-
gem '
|
|
33
|
-
gem '
|
|
34
|
-
gem '
|
|
35
|
-
gem '
|
|
10
|
+
|
|
11
|
+
gem 'aruba', '~>2.2', require: false
|
|
12
|
+
gem 'cucumber', '~>9.1', require: false
|
|
13
|
+
gem 'logger', '~>1.7', require: false
|
|
14
|
+
gem 'minitest', '~>6.0', require: false
|
|
15
|
+
gem 'minitest-reporters', '~>1.7', require: false
|
|
16
|
+
gem 'nokogiri', '~>1.18', require: false
|
|
17
|
+
gem 'rake', '~>13.2', require: false
|
|
18
|
+
gem 'rdoc', '~>7.0', require: false
|
|
19
|
+
gem 'rubocop', '~>1.62', require: false
|
|
20
|
+
gem 'rubocop-minitest', '~>0.38', require: false
|
|
21
|
+
gem 'rubocop-performance', '~>1.25', require: false
|
|
22
|
+
gem 'rubocop-rake', '~>0.7', require: false
|
|
23
|
+
gem 'simplecov', '~>0.22', require: false
|
|
24
|
+
gem 'simplecov-cobertura', '~>3.0', require: false
|
|
25
|
+
gem 'webmock', '~>3.23', require: false
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
sibit (0.0.0)
|
|
5
|
+
backtrace (~> 0.3)
|
|
6
|
+
iri (~> 0.5)
|
|
7
|
+
json (~> 2)
|
|
8
|
+
loog (~> 0.6)
|
|
9
|
+
openssl (>= 2.0)
|
|
10
|
+
retriable_proxy (~> 1.0)
|
|
11
|
+
slop (~> 4.6)
|
|
12
|
+
|
|
13
|
+
GEM
|
|
14
|
+
remote: https://rubygems.org/
|
|
15
|
+
specs:
|
|
16
|
+
addressable (2.8.8)
|
|
17
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
18
|
+
ansi (1.5.0)
|
|
19
|
+
aruba (2.3.3)
|
|
20
|
+
bundler (>= 1.17)
|
|
21
|
+
contracts (>= 0.16.0, < 0.18.0)
|
|
22
|
+
cucumber (>= 8.0, < 11.0)
|
|
23
|
+
rspec-expectations (>= 3.4, < 5.0)
|
|
24
|
+
thor (~> 1.0)
|
|
25
|
+
ast (2.4.3)
|
|
26
|
+
backtrace (0.4.1)
|
|
27
|
+
bigdecimal (4.0.1)
|
|
28
|
+
builder (3.3.0)
|
|
29
|
+
contracts (0.17.3)
|
|
30
|
+
crack (1.0.1)
|
|
31
|
+
bigdecimal
|
|
32
|
+
rexml
|
|
33
|
+
cucumber (9.2.1)
|
|
34
|
+
builder (~> 3.2)
|
|
35
|
+
cucumber-ci-environment (> 9, < 11)
|
|
36
|
+
cucumber-core (> 13, < 14)
|
|
37
|
+
cucumber-cucumber-expressions (~> 17.0)
|
|
38
|
+
cucumber-gherkin (> 24, < 28)
|
|
39
|
+
cucumber-html-formatter (> 20.3, < 22)
|
|
40
|
+
cucumber-messages (> 19, < 25)
|
|
41
|
+
diff-lcs (~> 1.5)
|
|
42
|
+
mini_mime (~> 1.1)
|
|
43
|
+
multi_test (~> 1.1)
|
|
44
|
+
sys-uname (~> 1.2)
|
|
45
|
+
cucumber-ci-environment (10.0.1)
|
|
46
|
+
cucumber-core (13.0.3)
|
|
47
|
+
cucumber-gherkin (>= 27, < 28)
|
|
48
|
+
cucumber-messages (>= 20, < 23)
|
|
49
|
+
cucumber-tag-expressions (> 5, < 7)
|
|
50
|
+
cucumber-cucumber-expressions (17.1.0)
|
|
51
|
+
bigdecimal
|
|
52
|
+
cucumber-gherkin (27.0.0)
|
|
53
|
+
cucumber-messages (>= 19.1.4, < 23)
|
|
54
|
+
cucumber-html-formatter (21.15.1)
|
|
55
|
+
cucumber-messages (> 19, < 28)
|
|
56
|
+
cucumber-messages (22.0.0)
|
|
57
|
+
cucumber-tag-expressions (6.1.2)
|
|
58
|
+
date (3.5.1)
|
|
59
|
+
diff-lcs (1.6.2)
|
|
60
|
+
docile (1.4.1)
|
|
61
|
+
erb (6.0.1)
|
|
62
|
+
ffi (1.17.2-arm64-darwin)
|
|
63
|
+
ffi (1.17.2-x86_64-linux-gnu)
|
|
64
|
+
hashdiff (1.2.1)
|
|
65
|
+
iri (0.11.3)
|
|
66
|
+
json (2.18.0)
|
|
67
|
+
language_server-protocol (3.17.0.5)
|
|
68
|
+
lint_roller (1.1.0)
|
|
69
|
+
logger (1.7.0)
|
|
70
|
+
loog (0.6.1)
|
|
71
|
+
logger (~> 1.0)
|
|
72
|
+
memoist3 (1.0.0)
|
|
73
|
+
mini_mime (1.1.5)
|
|
74
|
+
minitest (6.0.0)
|
|
75
|
+
prism (~> 1.5)
|
|
76
|
+
minitest-reporters (1.7.1)
|
|
77
|
+
ansi
|
|
78
|
+
builder
|
|
79
|
+
minitest (>= 5.0)
|
|
80
|
+
ruby-progressbar
|
|
81
|
+
multi_test (1.1.0)
|
|
82
|
+
nokogiri (1.18.10-arm64-darwin)
|
|
83
|
+
racc (~> 1.4)
|
|
84
|
+
nokogiri (1.18.10-x86_64-linux-gnu)
|
|
85
|
+
racc (~> 1.4)
|
|
86
|
+
openssl (4.0.0)
|
|
87
|
+
parallel (1.27.0)
|
|
88
|
+
parser (3.3.10.0)
|
|
89
|
+
ast (~> 2.4.1)
|
|
90
|
+
racc
|
|
91
|
+
prism (1.7.0)
|
|
92
|
+
psych (5.3.1)
|
|
93
|
+
date
|
|
94
|
+
stringio
|
|
95
|
+
public_suffix (7.0.0)
|
|
96
|
+
racc (1.8.1)
|
|
97
|
+
rainbow (3.1.1)
|
|
98
|
+
rake (13.3.1)
|
|
99
|
+
rdoc (7.0.2)
|
|
100
|
+
erb
|
|
101
|
+
psych (>= 4.0.0)
|
|
102
|
+
tsort
|
|
103
|
+
regexp_parser (2.11.3)
|
|
104
|
+
retriable (3.1.2)
|
|
105
|
+
retriable_proxy (1.0.2)
|
|
106
|
+
retriable (>= 2.0, < 4.0)
|
|
107
|
+
rexml (3.4.4)
|
|
108
|
+
rspec-expectations (3.13.5)
|
|
109
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
110
|
+
rspec-support (~> 3.13.0)
|
|
111
|
+
rspec-support (3.13.6)
|
|
112
|
+
rubocop (1.82.0)
|
|
113
|
+
json (~> 2.3)
|
|
114
|
+
language_server-protocol (~> 3.17.0.2)
|
|
115
|
+
lint_roller (~> 1.1.0)
|
|
116
|
+
parallel (~> 1.10)
|
|
117
|
+
parser (>= 3.3.0.2)
|
|
118
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
119
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
120
|
+
rubocop-ast (>= 1.48.0, < 2.0)
|
|
121
|
+
ruby-progressbar (~> 1.7)
|
|
122
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
123
|
+
rubocop-ast (1.48.0)
|
|
124
|
+
parser (>= 3.3.7.2)
|
|
125
|
+
prism (~> 1.4)
|
|
126
|
+
rubocop-minitest (0.38.2)
|
|
127
|
+
lint_roller (~> 1.1)
|
|
128
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
129
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
|
130
|
+
rubocop-performance (1.26.1)
|
|
131
|
+
lint_roller (~> 1.1)
|
|
132
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
133
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
134
|
+
rubocop-rake (0.7.1)
|
|
135
|
+
lint_roller (~> 1.1)
|
|
136
|
+
rubocop (>= 1.72.1)
|
|
137
|
+
ruby-progressbar (1.13.0)
|
|
138
|
+
simplecov (0.22.0)
|
|
139
|
+
docile (~> 1.1)
|
|
140
|
+
simplecov-html (~> 0.11)
|
|
141
|
+
simplecov_json_formatter (~> 0.1)
|
|
142
|
+
simplecov-cobertura (3.1.0)
|
|
143
|
+
rexml
|
|
144
|
+
simplecov (~> 0.19)
|
|
145
|
+
simplecov-html (0.13.2)
|
|
146
|
+
simplecov_json_formatter (0.1.4)
|
|
147
|
+
slop (4.10.1)
|
|
148
|
+
stringio (3.2.0)
|
|
149
|
+
sys-uname (1.4.1)
|
|
150
|
+
ffi (~> 1.1)
|
|
151
|
+
memoist3 (~> 1.0.0)
|
|
152
|
+
thor (1.4.0)
|
|
153
|
+
tsort (0.2.0)
|
|
154
|
+
unicode-display_width (3.2.0)
|
|
155
|
+
unicode-emoji (~> 4.1)
|
|
156
|
+
unicode-emoji (4.2.0)
|
|
157
|
+
webmock (3.26.1)
|
|
158
|
+
addressable (>= 2.8.0)
|
|
159
|
+
crack (>= 0.3.2)
|
|
160
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
|
161
|
+
|
|
162
|
+
PLATFORMS
|
|
163
|
+
arm64-darwin-22
|
|
164
|
+
arm64-darwin-23
|
|
165
|
+
arm64-darwin-24
|
|
166
|
+
x86_64-linux
|
|
167
|
+
|
|
168
|
+
DEPENDENCIES
|
|
169
|
+
aruba (~> 2.2)
|
|
170
|
+
cucumber (~> 9.1)
|
|
171
|
+
logger (~> 1.7)
|
|
172
|
+
minitest (~> 6.0)
|
|
173
|
+
minitest-reporters (~> 1.7)
|
|
174
|
+
nokogiri (~> 1.18)
|
|
175
|
+
rake (~> 13.2)
|
|
176
|
+
rdoc (~> 7.0)
|
|
177
|
+
rubocop (~> 1.62)
|
|
178
|
+
rubocop-minitest (~> 0.38)
|
|
179
|
+
rubocop-performance (~> 1.25)
|
|
180
|
+
rubocop-rake (~> 0.7)
|
|
181
|
+
sibit!
|
|
182
|
+
simplecov (~> 0.22)
|
|
183
|
+
simplecov-cobertura (~> 3.0)
|
|
184
|
+
webmock (~> 3.23)
|
|
185
|
+
|
|
186
|
+
BUNDLED WITH
|
|
187
|
+
2.5.16
|
data/LICENSE.txt
CHANGED
data/LICENSES/MIT.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
(The MIT License)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019-2025 Yegor Bugayenko
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
|
@@ -1,81 +1,82 @@
|
|
|
1
|
-
|
|
1
|
+
# Send Bitcoin via Command Line, in Ruby
|
|
2
2
|
|
|
3
3
|
[](https://www.elegantobjects.org)
|
|
4
|
-
[](https://www.rultor.com/p/yegor256/sibit)
|
|
5
5
|
[](https://www.jetbrains.com/ruby/)
|
|
6
6
|
|
|
7
7
|
[](https://github.com/yegor256/sibit/actions/workflows/rake.yml)
|
|
8
|
-
[](
|
|
8
|
+
[](https://www.0pdd.com/p?name=yegor256/sibit)
|
|
9
|
+
[](https://badge.fury.io/rb/sibit)
|
|
10
10
|
[](https://codeclimate.com/github/yegor256/sibit/maintainability)
|
|
11
11
|
[](https://github.com/yegor256/takes/sibit/master/LICENSE.txt)
|
|
12
12
|
[](https://codecov.io/github/yegor256/sibit?branch=master)
|
|
13
13
|
[](https://hitsofcode.com/view/github/yegor256/sibit)
|
|
14
14
|
|
|
15
|
-
To understand how Bitcoin protocol works,
|
|
16
|
-
this [short video]
|
|
15
|
+
To understand how the Bitcoin protocol works,
|
|
16
|
+
I recommend you watching this [short video] and
|
|
17
17
|
then reading this blog post of mine:
|
|
18
|
-
[_Sibit Demonstrates How Bitcoin Works_]
|
|
19
|
-
|
|
20
|
-
This is a simple Bitcoin client
|
|
21
|
-
or from your Ruby app.
|
|
22
|
-
|
|
23
|
-
and [Ruby]
|
|
24
|
-
client is to simplify most typical operations with Bitcoin.
|
|
25
|
-
something more complex, I would recommend using
|
|
26
|
-
[bitcoin-ruby]
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
You may want to discuss this tool at [Bitcointalk](https://bitcointalk.org/index.php?topic=5130324)
|
|
18
|
+
[_Sibit Demonstrates How Bitcoin Works_][blog].
|
|
19
|
+
|
|
20
|
+
This is a simple Bitcoin client for use from the command line
|
|
21
|
+
or from your Ruby app.
|
|
22
|
+
You don't need to run any Bitcoin software or install anything.
|
|
23
|
+
All you need is just a command line and [Ruby] 2.3+.
|
|
24
|
+
The purpose of this client is to simplify most typical operations with Bitcoin.
|
|
25
|
+
If you need something more complex, I would recommend using
|
|
26
|
+
[bitcoin-ruby] for Ruby and [Electrum] as a GUI client.
|
|
27
|
+
|
|
28
|
+
You may want to discuss this tool at [Bitcointalk]
|
|
30
29
|
and give the thread a few merits.
|
|
31
30
|
|
|
32
|
-
This is a Ruby gem, install it first (if doesn't work, there are
|
|
31
|
+
This is a Ruby gem, install it first (if it doesn't work, there are
|
|
33
32
|
some hints at the bottom of this page):
|
|
34
33
|
|
|
35
34
|
```bash
|
|
36
|
-
|
|
35
|
+
gem install sibit
|
|
37
36
|
```
|
|
38
37
|
|
|
39
|
-
Then, you generate a [private key]
|
|
38
|
+
Then, you generate a [private key]:
|
|
40
39
|
|
|
41
40
|
```bash
|
|
42
|
-
|
|
41
|
+
sibit generate
|
|
43
42
|
E9873D79C6D87FC233AA332626A3A3FE
|
|
44
43
|
```
|
|
45
44
|
|
|
46
|
-
Next, you create a new [address]
|
|
45
|
+
Next, you create a new [address],
|
|
47
46
|
using your private key:
|
|
48
47
|
|
|
49
|
-
```
|
|
50
|
-
|
|
48
|
+
```bash
|
|
49
|
+
sibit create E9873D79C6D87FC233AA332626A3A3FE
|
|
51
50
|
1CC3X2gu58d6wXUWMffpuzN9JAfTUWu4Kj
|
|
52
51
|
```
|
|
53
52
|
|
|
54
53
|
To check the balance at the address (the result is in
|
|
55
|
-
[satoshi]
|
|
54
|
+
[satoshi]):
|
|
56
55
|
|
|
57
|
-
```
|
|
58
|
-
|
|
56
|
+
```bash
|
|
57
|
+
sibit balance 1CC3X2gu58d6wXUWMffpuzN9JAfTUWu4Kj
|
|
59
58
|
80988977
|
|
60
59
|
```
|
|
61
60
|
|
|
62
61
|
To send a payment from a few addresses to a new address:
|
|
63
62
|
|
|
64
|
-
```
|
|
65
|
-
|
|
63
|
+
```bash
|
|
64
|
+
sibit pay AMOUNT FEE A1:P1,A2:P2,... TARGET CHANGE
|
|
66
65
|
e87f138c9ebf5986151667719825c28458a28cc66f69fed4f1032a93b399fdf8
|
|
67
66
|
```
|
|
68
67
|
|
|
69
68
|
Here,
|
|
70
|
-
`AMOUNT` is the amount of [satoshi]
|
|
71
|
-
`FEE` is the [miner fee]
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
`AMOUNT` is the amount of [satoshi] you are sending,
|
|
70
|
+
`FEE` is the [miner fee] you are ready to spend to get
|
|
71
|
+
this transaction delivered
|
|
72
|
+
(you can say `S`, `M`, `L`, or `XL` if you want it
|
|
73
|
+
to be calculated automatically),
|
|
74
|
+
`A1:P1,A2:P2,...` is a comma-separated list
|
|
75
|
+
of addresses `A` and private keys `P` you are sending your coins from,
|
|
74
76
|
`TARGET` is the address you are sending to,
|
|
75
77
|
`CHANGE` is the address where the change will be sent to.
|
|
76
78
|
The transaction hash will be returned.
|
|
77
|
-
Not all [UTXOs]
|
|
78
|
-
will be used, but only the necessary amount of them.
|
|
79
|
+
Not all [UTXOs] will be used, but only the necessary amount of them.
|
|
79
80
|
|
|
80
81
|
By default, the fee will be paid on top of the payment amount you are sending.
|
|
81
82
|
Say, you are sending 0.5 BTC and the fee is 0.0001 BTC. Totally, you will
|
|
@@ -89,9 +90,9 @@ what's going to be sent to the network. If everything looks correct, remove
|
|
|
89
90
|
the `--dry` and run again, the transaction will be pushed to the network.
|
|
90
91
|
|
|
91
92
|
All operations are performed through the
|
|
92
|
-
[Blockchain API]
|
|
93
|
+
[Blockchain API].
|
|
93
94
|
Transactions are pushed to the Bitcoin network via
|
|
94
|
-
[this relay]
|
|
95
|
+
[this relay].
|
|
95
96
|
|
|
96
97
|
## Ruby SDK
|
|
97
98
|
|
|
@@ -108,7 +109,7 @@ change = sibit.create(pkey) # where the change will be sent to
|
|
|
108
109
|
tx = sibit.pay(10_000_000, 'XL', { address => pkey }, target, change)
|
|
109
110
|
```
|
|
110
111
|
|
|
111
|
-
|
|
112
|
+
It should work.
|
|
112
113
|
|
|
113
114
|
## APIs
|
|
114
115
|
|
|
@@ -116,13 +117,13 @@ The library works through one (or a few) public APIs for fetching
|
|
|
116
117
|
Bitcoin data and pushing transactions to the network. At the moment we
|
|
117
118
|
work with the following APIs:
|
|
118
119
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
* [Blockchain.com] - `Sibit::Blockchain`
|
|
121
|
+
* [BTC.com] - `Sibit::Btc`
|
|
122
|
+
* [Cryptoapis.io] - `Sibit::Cryptoapis`
|
|
123
|
+
* [Bitcoinchain.com] - `Sibit::Bitcoinchain`
|
|
124
|
+
* [Blockchair.com] - `Sibit::Blockchair`
|
|
125
|
+
* [Cex.io] - `Sibit::Cex`
|
|
126
|
+
* [Earn.com] - `Sibit::Earn`
|
|
126
127
|
|
|
127
128
|
The first one in this list is used by default. If you want to use a different
|
|
128
129
|
one, you just specify it in the constructor of `Sibit` object:
|
|
@@ -159,28 +160,49 @@ or implement it yourself and submit a pull request.
|
|
|
159
160
|
|
|
160
161
|
To install on a fresh Ubuntu 18:
|
|
161
162
|
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
163
|
+
```bash
|
|
164
|
+
sudo apt-get update
|
|
165
|
+
sudo apt-get install -y ruby ruby-dev autoconf automake build-essential
|
|
166
|
+
sudo gem update --system
|
|
167
|
+
gem install rake --no-document
|
|
168
|
+
gem install sibit
|
|
168
169
|
```
|
|
169
170
|
|
|
170
|
-
|
|
171
|
+
It should work. If it doesn't, submit an issue and I will try to help.
|
|
171
172
|
|
|
172
173
|
## How to contribute
|
|
173
174
|
|
|
174
|
-
Read [these guidelines]
|
|
175
|
+
Read [these guidelines].
|
|
175
176
|
Make sure your build is green before you contribute
|
|
176
|
-
your pull request. You will need to have [Ruby]
|
|
177
|
-
[Bundler]
|
|
177
|
+
your pull request. You will need to have [Ruby] 2.3+ and
|
|
178
|
+
[Bundler] installed. Then:
|
|
178
179
|
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
```bash
|
|
181
|
+
bundle update
|
|
182
|
+
bundle exec rake
|
|
182
183
|
```
|
|
183
184
|
|
|
184
185
|
If it's clean and you don't see any error messages, submit your pull request.
|
|
185
186
|
|
|
186
|
-
|
|
187
|
+
[address]: https://en.bitcoin.it/wiki/Address
|
|
188
|
+
[bitcoin-ruby]: https://github.com/lian/bitcoin-ruby
|
|
189
|
+
[Bitcoinchain.com]: https://bitcoinchain.com/api
|
|
190
|
+
[Bitcointalk]: https://bitcointalk.org/index.php?topic=5130324
|
|
191
|
+
[Blockchain API]: https://www.blockchain.com/api/blockchain_api
|
|
192
|
+
[Blockchain.com]: https://www.blockchain.com/explorer
|
|
193
|
+
[Blockchair.com]: https://blockchair.com/api/docs
|
|
194
|
+
[blog]: https://www.yegor256.com/2019/05/07/sibit-bitcoin-command-line-client.html
|
|
195
|
+
[BTC.com]: https://btc.com/api-doc
|
|
196
|
+
[Bundler]: https://bundler.io/
|
|
197
|
+
[Cex.io]: https://cex.io/rest-api
|
|
198
|
+
[Cryptoapis.io]: https://docs.cryptoapis.io/rest-apis/blockchain-as-a-service-apis/btc/index
|
|
199
|
+
[Earn.com]: https://bitcoinfees.earn.com/api
|
|
200
|
+
[Electrum]: https://electrum.org/
|
|
201
|
+
[miner fee]: https://en.bitcoin.it/wiki/Miner_fees
|
|
202
|
+
[private key]: https://en.bitcoin.it/wiki/Private_key
|
|
203
|
+
[Ruby]: https://www.ruby-lang.org/en/
|
|
204
|
+
[satoshi]: https://en.bitcoin.it/wiki/Satoshi_%28unit%29
|
|
205
|
+
[short video]: https://www.youtube.com/watch?v=IV9pRBq5A4g
|
|
206
|
+
[these guidelines]: https://www.yegor256.com/2014/04/15/github-guidelines.html
|
|
207
|
+
[this relay]: https://www.blockchain.com/btc/pushtx
|
|
208
|
+
[UTXOs]: https://en.wikipedia.org/wiki/Unspent_transaction_output
|
data/REUSE.toml
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
version = 1
|
|
5
|
+
[[annotations]]
|
|
6
|
+
path = [
|
|
7
|
+
".DS_Store",
|
|
8
|
+
".gitattributes",
|
|
9
|
+
".gitignore",
|
|
10
|
+
".pdd",
|
|
11
|
+
"**.json",
|
|
12
|
+
"**.md",
|
|
13
|
+
"**.svg",
|
|
14
|
+
"**.txt",
|
|
15
|
+
"**/.DS_Store",
|
|
16
|
+
"**/.gitignore",
|
|
17
|
+
"**/.pdd",
|
|
18
|
+
"**/*.csv",
|
|
19
|
+
"**/*.jpg",
|
|
20
|
+
"**/*.json",
|
|
21
|
+
"**/*.md",
|
|
22
|
+
"**/*.pdf",
|
|
23
|
+
"**/*.png",
|
|
24
|
+
"**/*.svg",
|
|
25
|
+
"**/*.txt",
|
|
26
|
+
"**/*.vm",
|
|
27
|
+
"**/CNAME",
|
|
28
|
+
"**/Gemfile.lock",
|
|
29
|
+
"Gemfile.lock",
|
|
30
|
+
"README.md",
|
|
31
|
+
"renovate.json",
|
|
32
|
+
]
|
|
33
|
+
precedence = "override"
|
|
34
|
+
SPDX-FileCopyrightText = "Copyright (c) 2025 Yegor Bugayenko"
|
|
35
|
+
SPDX-License-Identifier = "MIT"
|
data/Rakefile
CHANGED
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2019-
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
# copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
# SOFTWARE.
|
|
3
|
+
# SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
22
5
|
|
|
23
6
|
require 'rubygems'
|
|
24
7
|
require 'rake'
|
|
@@ -33,7 +16,7 @@ def version
|
|
|
33
16
|
Gem::Specification.load(Dir['*.gemspec'].first).version
|
|
34
17
|
end
|
|
35
18
|
|
|
36
|
-
task default: %i[clean test features rubocop
|
|
19
|
+
task default: %i[clean test features rubocop]
|
|
37
20
|
|
|
38
21
|
require 'rake/testtask'
|
|
39
22
|
Rake::TestTask.new(:test) do |test|
|
|
@@ -55,7 +38,6 @@ end
|
|
|
55
38
|
require 'rubocop/rake_task'
|
|
56
39
|
RuboCop::RakeTask.new(:rubocop) do |task|
|
|
57
40
|
task.fail_on_error = true
|
|
58
|
-
task.requires << 'rubocop-rspec'
|
|
59
41
|
end
|
|
60
42
|
|
|
61
43
|
require 'cucumber/rake/task'
|
|
@@ -65,11 +47,3 @@ end
|
|
|
65
47
|
Cucumber::Rake::Task.new(:'features:html') do |t|
|
|
66
48
|
t.profile = 'html_report'
|
|
67
49
|
end
|
|
68
|
-
|
|
69
|
-
task :copyright do
|
|
70
|
-
sh "grep -q -r '2019-#{Date.today.strftime('%Y')}' \
|
|
71
|
-
--include '*.rb' \
|
|
72
|
-
--include '*.txt' \
|
|
73
|
-
--include 'Rakefile' \
|
|
74
|
-
."
|
|
75
|
-
end
|
data/bin/sibit
CHANGED
|
@@ -1,25 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
-
# Copyright (c) 2019-
|
|
5
|
-
#
|
|
6
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
# of this software and associated documentation files (the 'Software'), to deal
|
|
8
|
-
# in the Software without restriction, including without limitation the rights
|
|
9
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
# furnished to do so, subject to the following conditions:
|
|
12
|
-
#
|
|
13
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
# copies or substantial portions of the Software.
|
|
15
|
-
#
|
|
16
|
-
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
# SOFTWARE.
|
|
4
|
+
# SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
|
|
5
|
+
# SPDX-License-Identifier: MIT
|
|
23
6
|
|
|
24
7
|
$stdout.sync = true
|
|
25
8
|
|
|
@@ -28,19 +11,20 @@ require 'openssl'
|
|
|
28
11
|
OpenSSL::SSL::VERIFY_PEER ||= OpenSSL::SSL::VERIFY_NONE
|
|
29
12
|
puts OpenSSL::X509::DEFAULT_CERT_FILE
|
|
30
13
|
|
|
31
|
-
require 'slop'
|
|
32
14
|
require 'backtrace'
|
|
15
|
+
require 'loog'
|
|
33
16
|
require 'retriable_proxy'
|
|
17
|
+
require 'slop'
|
|
34
18
|
require_relative '../lib/sibit'
|
|
35
|
-
require_relative '../lib/sibit/
|
|
19
|
+
require_relative '../lib/sibit/bitcoinchain'
|
|
36
20
|
require_relative '../lib/sibit/blockchain'
|
|
37
21
|
require_relative '../lib/sibit/blockchair'
|
|
38
22
|
require_relative '../lib/sibit/btc'
|
|
39
|
-
require_relative '../lib/sibit/bitcoinchain'
|
|
40
23
|
require_relative '../lib/sibit/cex'
|
|
41
24
|
require_relative '../lib/sibit/earn'
|
|
42
25
|
require_relative '../lib/sibit/fake'
|
|
43
26
|
require_relative '../lib/sibit/firstof'
|
|
27
|
+
require_relative '../lib/sibit/version'
|
|
44
28
|
|
|
45
29
|
begin
|
|
46
30
|
begin
|
|
@@ -82,7 +66,7 @@ Options are:"
|
|
|
82
66
|
raise e.message
|
|
83
67
|
end
|
|
84
68
|
raise 'Try --help' if opts.arguments.empty?
|
|
85
|
-
log =
|
|
69
|
+
log = opts[:verbose] ? Loog::VERBOSE : Loog::NULL
|
|
86
70
|
http = opts[:proxy] ? Sibit::HttpProxy.new(opts[:proxy]) : Sibit::Http.new
|
|
87
71
|
apis = opts[:api].map(&:downcase).map do |a|
|
|
88
72
|
api = nil
|