mastercoin-wallet 0.0.2 → 0.0.3
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.
- data/Gemfile +4 -2
- data/Gemfile.lock +38 -15
- data/Makefile +13 -1
- data/README.rdoc +7 -2
- data/Rakefile +19 -0
- data/VERSION +1 -1
- data/bin/mastercoin-wallet +1 -1
- data/lib/mastercoin-wallet/builder.rb +254 -0
- data/lib/mastercoin-wallet/gui/bitcoin_offer_window.rb +50 -0
- data/lib/mastercoin-wallet/gui/bitcoin_offer_window.ui +121 -0
- data/lib/mastercoin-wallet/gui/main_window.rb +160 -34
- data/lib/mastercoin-wallet/gui/main_window.ui +356 -0
- data/lib/mastercoin-wallet/gui/purchase_offer_window.rb +60 -0
- data/lib/mastercoin-wallet/gui/purchase_offer_window.ui +142 -0
- data/lib/mastercoin-wallet/gui/selling_offer_window.rb +60 -0
- data/lib/mastercoin-wallet/gui/selling_offer_window.ui +154 -0
- data/lib/mastercoin-wallet/gui/simple_send_window.rb +6 -120
- data/lib/mastercoin-wallet/gui/simple_send_window.ui +7 -0
- data/lib/mastercoin-wallet/gui/ui_bitcoin_offer.rb +113 -0
- data/lib/mastercoin-wallet/gui/ui_main.rb +167 -0
- data/lib/mastercoin-wallet/gui/ui_purchase_offer.rb +140 -0
- data/lib/mastercoin-wallet/gui/ui_selling_offer.rb +155 -0
- data/lib/mastercoin-wallet/gui/ui_simple_send.rb +5 -1
- data/lib/mastercoin-wallet/models/selling_offer.rb +18 -0
- data/lib/mastercoin-wallet/network/selling_offer.rb +15 -0
- data/lib/mastercoin-wallet/network/wallet.rb +32 -0
- data/lib/mastercoin-wallet.rb +27 -4
- data/mastercoin-wallet.gemspec +30 -9
- data/resources/logo.icns +0 -0
- metadata +55 -8
- data/lib/mastercoin-wallet/network.rb +0 -34
data/Gemfile
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
|
+
gem 'mastercoin-ruby',git: "https://github.com/maran/mastercoin-ruby.git", branch: "develop"
|
2
3
|
gem 'qtbindings'
|
3
4
|
gem 'httparty'
|
4
5
|
gem 'active_support'
|
5
6
|
gem 'bitcoin-ruby', '~> 0.0.1', git: "https://github.com/maran/bitcoin-ruby.git"
|
6
|
-
gem 'mastercoin-ruby'
|
7
7
|
gem 'ffi'
|
8
|
+
gem 'i18n'
|
8
9
|
|
9
10
|
group :development do
|
11
|
+
gem 'releasy', git: "https://github.com/Spooner/releasy.git"
|
10
12
|
gem "bundler", "~> 1.0"
|
11
|
-
gem "jeweler", "~> 1.8.
|
13
|
+
gem "jeweler", "~> 1.8.8"
|
12
14
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,31 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/Spooner/releasy.git
|
3
|
+
revision: 1386fc1b439de45994919ddad5633b4ad1745817
|
4
|
+
specs:
|
5
|
+
releasy (0.2.3)
|
6
|
+
bundler (>= 1.2.1)
|
7
|
+
cri (~> 2.1.0)
|
8
|
+
ocra (~> 1.3.0)
|
9
|
+
rake (>= 0.9.2.2)
|
10
|
+
thor (~> 0.14.6)
|
11
|
+
|
1
12
|
GIT
|
2
13
|
remote: https://github.com/maran/bitcoin-ruby.git
|
3
14
|
revision: b9baf584a509e89cca0a9e5dc879f225dd9aa529
|
4
15
|
specs:
|
5
16
|
bitcoin-ruby (0.0.1)
|
6
17
|
|
18
|
+
GIT
|
19
|
+
remote: https://github.com/maran/mastercoin-ruby.git
|
20
|
+
revision: 07437c33dba284e0e638dbd24245219e93b2462f
|
21
|
+
branch: develop
|
22
|
+
specs:
|
23
|
+
mastercoin-ruby (0.0.4)
|
24
|
+
activesupport (>= 3.0.0)
|
25
|
+
bitcoin-ruby (~> 0.0.1)
|
26
|
+
sequel (~> 4.1.1)
|
27
|
+
thor
|
28
|
+
|
7
29
|
GEM
|
8
30
|
remote: http://rubygems.org/
|
9
31
|
specs:
|
@@ -12,9 +34,10 @@ GEM
|
|
12
34
|
activesupport (3.0.0)
|
13
35
|
addressable (2.3.5)
|
14
36
|
builder (3.2.2)
|
37
|
+
cri (2.1.0)
|
15
38
|
faraday (0.8.8)
|
16
39
|
multipart-post (~> 1.2.0)
|
17
|
-
ffi (1.9.
|
40
|
+
ffi (1.9.3)
|
18
41
|
git (1.2.6)
|
19
42
|
github_api (0.10.1)
|
20
43
|
addressable
|
@@ -24,12 +47,13 @@ GEM
|
|
24
47
|
nokogiri (~> 1.5.2)
|
25
48
|
oauth2
|
26
49
|
hashie (2.0.5)
|
27
|
-
highline (1.6.
|
28
|
-
httparty (0.
|
29
|
-
|
50
|
+
highline (1.6.20)
|
51
|
+
httparty (0.12.0)
|
52
|
+
json (~> 1.8)
|
30
53
|
multi_xml (>= 0.5.2)
|
31
54
|
httpauth (0.2.0)
|
32
|
-
|
55
|
+
i18n (0.6.5)
|
56
|
+
jeweler (1.8.8)
|
33
57
|
builder
|
34
58
|
bundler (~> 1.0)
|
35
59
|
git (>= 1.2.5)
|
@@ -38,14 +62,10 @@ GEM
|
|
38
62
|
nokogiri (= 1.5.10)
|
39
63
|
rake
|
40
64
|
rdoc
|
41
|
-
json (1.8.
|
65
|
+
json (1.8.1)
|
42
66
|
jwt (0.1.8)
|
43
67
|
multi_json (>= 1.5)
|
44
|
-
|
45
|
-
bitcoin-ruby (~> 0.0.1)
|
46
|
-
sequel (~> 4.1.1)
|
47
|
-
thor
|
48
|
-
multi_json (1.8.0)
|
68
|
+
multi_json (1.8.2)
|
49
69
|
multi_xml (0.5.5)
|
50
70
|
multipart-post (1.2.0)
|
51
71
|
nokogiri (1.5.10)
|
@@ -56,13 +76,14 @@ GEM
|
|
56
76
|
multi_json (~> 1.0)
|
57
77
|
multi_xml (~> 0.5)
|
58
78
|
rack (~> 1.2)
|
79
|
+
ocra (1.3.1)
|
59
80
|
qtbindings (4.8.3.0)
|
60
81
|
rack (1.5.2)
|
61
|
-
rake (
|
82
|
+
rake (0.9.2.2)
|
62
83
|
rdoc (4.0.1)
|
63
84
|
json (~> 1.4)
|
64
85
|
sequel (4.1.1)
|
65
|
-
thor (0.
|
86
|
+
thor (0.14.6)
|
66
87
|
|
67
88
|
PLATFORMS
|
68
89
|
ruby
|
@@ -73,6 +94,8 @@ DEPENDENCIES
|
|
73
94
|
bundler (~> 1.0)
|
74
95
|
ffi
|
75
96
|
httparty
|
76
|
-
|
77
|
-
|
97
|
+
i18n
|
98
|
+
jeweler (~> 1.8.8)
|
99
|
+
mastercoin-ruby!
|
78
100
|
qtbindings
|
101
|
+
releasy!
|
data/Makefile
CHANGED
@@ -1,11 +1,23 @@
|
|
1
|
-
all: lib/mastercoin-wallet/gui/ui_simple_send.rb lib/mastercoin-wallet/gui/ui_first_run.rb lib/mastercoin-wallet/gui/images.rb
|
1
|
+
all: lib/mastercoin-wallet/gui/ui_main.rb lib/mastercoin-wallet/gui/ui_bitcoin_offer.rb lib/mastercoin-wallet/gui/ui_purchase_offer.rb lib/mastercoin-wallet/gui/ui_selling_offer.rb lib/mastercoin-wallet/gui/ui_simple_send.rb lib/mastercoin-wallet/gui/ui_first_run.rb lib/mastercoin-wallet/gui/images.rb
|
2
2
|
|
3
3
|
lib/mastercoin-wallet/gui/ui_simple_send.rb: lib/mastercoin-wallet/gui/simple_send_window.ui
|
4
4
|
rbuic4 lib/mastercoin-wallet/gui/simple_send_window.ui -o lib/mastercoin-wallet/gui/ui_simple_send.rb
|
5
5
|
|
6
|
+
lib/mastercoin-wallet/gui/ui_selling_offer.rb: lib/mastercoin-wallet/gui/selling_offer_window.ui
|
7
|
+
rbuic4 lib/mastercoin-wallet/gui/selling_offer_window.ui -o lib/mastercoin-wallet/gui/ui_selling_offer.rb
|
8
|
+
|
9
|
+
lib/mastercoin-wallet/gui/ui_purchase_offer.rb: lib/mastercoin-wallet/gui/purchase_offer_window.ui
|
10
|
+
rbuic4 lib/mastercoin-wallet/gui/purchase_offer_window.ui -o lib/mastercoin-wallet/gui/ui_purchase_offer.rb
|
11
|
+
|
12
|
+
lib/mastercoin-wallet/gui/ui_bitcoin_offer.rb: lib/mastercoin-wallet/gui/bitcoin_offer_window.ui
|
13
|
+
rbuic4 lib/mastercoin-wallet/gui/bitcoin_offer_window.ui -o lib/mastercoin-wallet/gui/ui_bitcoin_offer.rb
|
14
|
+
|
6
15
|
lib/mastercoin-wallet/gui/ui_first_run.rb: lib/mastercoin-wallet/gui/first_run_window.ui
|
7
16
|
rbuic4 first_run_window.ui -o ui_first_run.rb
|
8
17
|
|
18
|
+
lib/mastercoin-wallet/gui/ui_main.rb: lib/mastercoin-wallet/gui/main_window.ui
|
19
|
+
rbuic4 lib/mastercoin-wallet/gui/main_window.ui -o lib/mastercoin-wallet/gui/ui_main.rb
|
20
|
+
|
9
21
|
lib/mastercoin-wallet/gui/images.rb: resources/images.qrc
|
10
22
|
rbrcc -name images resources/images.qrc -o lib/mastercoin-wallet/gui/images.rb
|
11
23
|
|
data/README.rdoc
CHANGED
@@ -7,6 +7,8 @@ Mastercoin wallet implementation in Ruby using QT bindings.
|
|
7
7
|
* Rubygems
|
8
8
|
* QT 4
|
9
9
|
|
10
|
+
Check your ruby version using ruby -v. If the version is lower then 1.9.2 or not installed yet, install {rvm}[http://rvm.io/] and ruby 1.9.3.
|
11
|
+
|
10
12
|
Dependencies will differ based on your operating system.
|
11
13
|
|
12
14
|
=== OS X
|
@@ -14,9 +16,12 @@ Install {homebrew}[http://brew.sh/] if you haven't got it yet.
|
|
14
16
|
|
15
17
|
* brew install qt
|
16
18
|
|
17
|
-
|
19
|
+
=== Debian/Ubuntu
|
20
|
+
These instructions might not be complete. Additional instructions welcome.
|
21
|
+
|
22
|
+
* apt-get install libqt4-gui libqt4-dev cake
|
18
23
|
|
19
|
-
== Installation
|
24
|
+
== Installation
|
20
25
|
Once the depencies are installed you can just do gem install mastercoin-wallet to install the wallet. Start it by issuing mastercoin-wallet from a terminal.
|
21
26
|
|
22
27
|
== First run configuration
|
data/Rakefile
CHANGED
@@ -34,3 +34,22 @@ Rake::RDocTask.new do |rdoc|
|
|
34
34
|
rdoc.rdoc_files.include('README*')
|
35
35
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
36
36
|
end
|
37
|
+
|
38
|
+
require 'releasy'
|
39
|
+
Releasy::Project.new do
|
40
|
+
name "Mastercoin Wallet"
|
41
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
42
|
+
verbose # Can be removed if you don't want to see all build messages.
|
43
|
+
executable "bin/mastercoin-wallet"
|
44
|
+
files ["lib/**/*.*", "bin/*.*", "resources/*.*"]
|
45
|
+
|
46
|
+
exclude_encoding
|
47
|
+
# Create a variety of releases, for all platforms.
|
48
|
+
add_build :osx_app do
|
49
|
+
url "com.maran.mastercoin_wallet"
|
50
|
+
wrapper "../wrappers/gosu-mac-wrapper-0.7.47.tar.gz"
|
51
|
+
icon "resources/logo.icns"
|
52
|
+
end
|
53
|
+
|
54
|
+
add_deploy :local # Only deploy locally.
|
55
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/bin/mastercoin-wallet
CHANGED
@@ -8,7 +8,7 @@ app.setWindowIcon(Qt::Icon.new(":/logo.svg"))
|
|
8
8
|
|
9
9
|
if MastercoinWallet.config.has_key?(:private_key)
|
10
10
|
dialog = MastercoinWallet::MainWindow.new
|
11
|
-
dialog.setMinimumSize(
|
11
|
+
dialog.setMinimumSize(746,469)
|
12
12
|
dialog.exec
|
13
13
|
else
|
14
14
|
dialog = MastercoinWallet::FirstRunWindow.new
|
@@ -0,0 +1,254 @@
|
|
1
|
+
module MastercoinWallet
|
2
|
+
module Builder
|
3
|
+
attr_accessor :fee, :tx_amount, :mastercoin_tx, :btc_amount
|
4
|
+
|
5
|
+
def set_fee(force_fee = nil)
|
6
|
+
self.fee = force_fee || BigDecimal.new("0.0001")
|
7
|
+
|
8
|
+
if self.fee < 0.0001
|
9
|
+
self.fee = BigDecimal.new("0.0001")
|
10
|
+
end
|
11
|
+
|
12
|
+
self.tx_amount = BigDecimal.new("0.00006")
|
13
|
+
if @receiving_address
|
14
|
+
output_counter = 4
|
15
|
+
else
|
16
|
+
output_counter = 3
|
17
|
+
end
|
18
|
+
self.mastercoin_tx = (output_counter * tx_amount)
|
19
|
+
end
|
20
|
+
|
21
|
+
def create_bitcoin_transaction_for(amount)
|
22
|
+
self.btc_amount = BigDecimal.new(amount)
|
23
|
+
self.fee = BigDecimal.new("0.0001")
|
24
|
+
self.tx_amount = BigDecimal.new("0.00006")
|
25
|
+
|
26
|
+
# TODO REFACTOR AND DRY IT
|
27
|
+
valid_output = MastercoinWallet.config.spendable_outputs.find{|x| BigDecimal.new(x[:value]) > (self.fee + self.tx_amount + self.btc_amount)}
|
28
|
+
|
29
|
+
if valid_output.is_a?(Array)
|
30
|
+
ouput = valid_output[0]
|
31
|
+
else
|
32
|
+
output = valid_output
|
33
|
+
end
|
34
|
+
|
35
|
+
unless output
|
36
|
+
Qt::MessageBox.critical(self, tr("Could not send transaction"),
|
37
|
+
tr("It appears there are no spendable outputs for this address that are big enough to transmit this transaction. Please consolidate some coins and send them to your Mastercoin address."))
|
38
|
+
return
|
39
|
+
end
|
40
|
+
|
41
|
+
change_amount = BigDecimal.new(output["value"]) - self.fee - self.btc_amount - self.tx_amount
|
42
|
+
|
43
|
+
tx = MastercoinWallet.config.bitcoin_transactions.find{|x| x["hash"] == output["prev_out"]["hash"]}
|
44
|
+
if tx.is_a?(Array)
|
45
|
+
tx = tx[0]
|
46
|
+
end
|
47
|
+
|
48
|
+
# DRY THIS AS WELL SHOULD BE IS OWN METHOD
|
49
|
+
begin
|
50
|
+
priv_key = MastercoinWallet.config.get_encrypted_key(:private_key, @password)
|
51
|
+
rescue ArgumentError
|
52
|
+
Qt::MessageBox.information(self, tr("Could not send payment."),
|
53
|
+
tr("Could not send payment, wrong password."))
|
54
|
+
return
|
55
|
+
end
|
56
|
+
begin
|
57
|
+
key = Bitcoin::Key.from_base58(priv_key)
|
58
|
+
rescue ArgumentError
|
59
|
+
begin
|
60
|
+
key = Bitcoin::Key.new(priv_key)
|
61
|
+
rescue ArgumentError, OpenSSL::BNError
|
62
|
+
Qt::MessageBox.information(self, tr("Could not send payment."),
|
63
|
+
tr("Could not send payment, wrong password."))
|
64
|
+
return
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
tx = build_tx do |t|
|
69
|
+
t.input do |i|
|
70
|
+
i.prev_out Bitcoin::Protocol::Tx.from_hash(tx)
|
71
|
+
i.prev_out_index output["prev_out"]["n"]
|
72
|
+
i.signature_key key
|
73
|
+
end
|
74
|
+
|
75
|
+
# Change address
|
76
|
+
t.output do |o|
|
77
|
+
o.value change_amount * 1e8
|
78
|
+
|
79
|
+
o.script do |s|
|
80
|
+
s.type :address
|
81
|
+
s.recipient MastercoinWallet.config.address
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# Receiving address
|
86
|
+
t.output do |o|
|
87
|
+
o.value self.btc_amount * 1e8
|
88
|
+
|
89
|
+
o.script do |s|
|
90
|
+
s.type :address
|
91
|
+
s.recipient @receiving_address
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# Exodus address
|
96
|
+
t.output do |o|
|
97
|
+
o.value self.tx_amount * 1e8
|
98
|
+
|
99
|
+
o.script do |s|
|
100
|
+
s.type :address
|
101
|
+
s.recipient Mastercoin::EXODUS_ADDRESS
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
tx = Bitcoin::Protocol::Tx.new( tx.to_payload )
|
107
|
+
|
108
|
+
MastercoinWallet.log.debug("TX Made: #{tx.to_hash}")
|
109
|
+
|
110
|
+
transaction_hash = tx.to_payload.unpack("H*").first
|
111
|
+
|
112
|
+
MastercoinWallet.log.debug("If you want to send it by Bitcoind use this")
|
113
|
+
MastercoinWallet.log.debug(transaction_hash)
|
114
|
+
MastercoinWallet.log.debug("Required fee: #{tx.calculate_minimum_fee} - Multisig size: #{tx.outputs.last.script.bytesize}")
|
115
|
+
|
116
|
+
remote_transaction = Transaction.new(tx.to_hash["hash"], tx.to_json)
|
117
|
+
response = remote_transaction.create!
|
118
|
+
if response.parsed_response.keys.include?("error")
|
119
|
+
Qt::MessageBox.critical(self, tr("Could not relay transaction"),
|
120
|
+
tr("The remote server could not transmit your transaction at this moment. #{response.parsed_response}"))
|
121
|
+
return
|
122
|
+
else
|
123
|
+
Qt::MessageBox.information(self, tr("Transaction send"),
|
124
|
+
tr("Your transaction with hash #{tx.to_hash["hash"]} has been offered to the relay server, it should show up within 10 minutes."))
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def create_transaction_with_keys(data_keys, options = {})
|
129
|
+
public_keys = []
|
130
|
+
public_keys << data_keys
|
131
|
+
public_keys.flatten!
|
132
|
+
|
133
|
+
if options.has_key?(:force_fee)
|
134
|
+
self.set_fee(BigDecimal.new(options[:force_fee]))
|
135
|
+
else
|
136
|
+
self.set_fee
|
137
|
+
end
|
138
|
+
|
139
|
+
valid_output = MastercoinWallet.config.spendable_outputs.find{|x| BigDecimal.new(x[:value]) > (self.fee + self.mastercoin_tx)}
|
140
|
+
|
141
|
+
if valid_output.is_a?(Array)
|
142
|
+
ouput = valid_output[0]
|
143
|
+
else
|
144
|
+
output = valid_output
|
145
|
+
end
|
146
|
+
|
147
|
+
unless output
|
148
|
+
Qt::MessageBox.critical(self, tr("Could not send transaction"),
|
149
|
+
tr("It appears there are no spendable outputs for this address that are big enough to transmit this transaction. Please consolidate some coins and send them to your Mastercoin address."))
|
150
|
+
return
|
151
|
+
end
|
152
|
+
|
153
|
+
change_amount = BigDecimal.new(output["value"]) - fee - mastercoin_tx
|
154
|
+
|
155
|
+
tx = MastercoinWallet.config.bitcoin_transactions.find{|x| x["hash"] == output["prev_out"]["hash"]}
|
156
|
+
if tx.is_a?(Array)
|
157
|
+
tx = tx[0]
|
158
|
+
end
|
159
|
+
|
160
|
+
begin
|
161
|
+
priv_key = MastercoinWallet.config.get_encrypted_key(:private_key, @password)
|
162
|
+
rescue ArgumentError
|
163
|
+
Qt::MessageBox.information(self, tr("Could not send payment."),
|
164
|
+
tr("Could not send payment, wrong password."))
|
165
|
+
return
|
166
|
+
end
|
167
|
+
begin
|
168
|
+
key = Bitcoin::Key.from_base58(priv_key)
|
169
|
+
rescue ArgumentError
|
170
|
+
begin
|
171
|
+
key = Bitcoin::Key.new(priv_key)
|
172
|
+
rescue ArgumentError, OpenSSL::BNError
|
173
|
+
Qt::MessageBox.information(self, tr("Could not send payment."),
|
174
|
+
tr("Could not send payment, wrong password."))
|
175
|
+
return
|
176
|
+
end
|
177
|
+
end
|
178
|
+
public_keys.insert(0, key.pub_compressed)
|
179
|
+
|
180
|
+
|
181
|
+
tx = build_tx do |t|
|
182
|
+
t.input do |i|
|
183
|
+
i.prev_out Bitcoin::Protocol::Tx.from_hash(tx)
|
184
|
+
i.prev_out_index output["prev_out"]["n"]
|
185
|
+
i.signature_key key
|
186
|
+
end
|
187
|
+
|
188
|
+
# Change address
|
189
|
+
t.output do |o|
|
190
|
+
o.value change_amount * 1e8
|
191
|
+
|
192
|
+
o.script do |s|
|
193
|
+
s.type :address
|
194
|
+
s.recipient MastercoinWallet.config.address
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
if @receiving_address
|
199
|
+
# Receiving address
|
200
|
+
t.output do |o|
|
201
|
+
o.value tx_amount * 1e8
|
202
|
+
|
203
|
+
o.script do |s|
|
204
|
+
s.type :address
|
205
|
+
s.recipient @receiving_address
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
# Exodus address
|
211
|
+
t.output do |o|
|
212
|
+
o.value tx_amount * 1e8
|
213
|
+
|
214
|
+
o.script do |s|
|
215
|
+
s.type :address
|
216
|
+
s.recipient Mastercoin::EXODUS_ADDRESS
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
# Data address
|
221
|
+
t.output do |o|
|
222
|
+
o.value (tx_amount) * 1e8 * 2
|
223
|
+
|
224
|
+
o.script do |s|
|
225
|
+
s.type :multisig
|
226
|
+
s.recipient 1, *public_keys
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
tx = Bitcoin::Protocol::Tx.new( tx.to_payload )
|
232
|
+
|
233
|
+
MastercoinWallet.log.debug("TX Made: #{tx.to_hash}")
|
234
|
+
|
235
|
+
transaction_hash = tx.to_payload.unpack("H*").first
|
236
|
+
|
237
|
+
MastercoinWallet.log.debug("If you want to send it by Bitcoind use this")
|
238
|
+
MastercoinWallet.log.debug(transaction_hash)
|
239
|
+
MastercoinWallet.log.debug("Required fee: #{tx.calculate_minimum_fee} - Multisig size: #{tx.outputs.last.script.bytesize}")
|
240
|
+
|
241
|
+
remote_transaction = Transaction.new(tx.to_hash["hash"], tx.to_json)
|
242
|
+
response = remote_transaction.create!
|
243
|
+
if response.parsed_response.keys.include?("error")
|
244
|
+
Qt::MessageBox.critical(self, tr("Could not relay transaction"),
|
245
|
+
tr("The remote server could not transmit your transaction at this moment. #{response.parsed_response}"))
|
246
|
+
return
|
247
|
+
else
|
248
|
+
Qt::MessageBox.information(self, tr("Transaction send"),
|
249
|
+
tr("Your transaction with hash #{tx.to_hash["hash"]} has been offered to the relay server, it should show up within 10 minutes."))
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
end
|
254
|
+
end
|