startcoin-client 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.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.travis.yml +18 -0
- data/Gemfile +13 -0
- data/README.rdoc +78 -0
- data/Rakefile +8 -0
- data/lib/startcoin_client/api.rb +33 -0
- data/lib/startcoin_client/client.rb +340 -0
- data/lib/startcoin_client/dsl.rb +307 -0
- data/lib/startcoin_client/errors.rb +4 -0
- data/lib/startcoin_client/request.rb +35 -0
- data/lib/startcoin_client/rpc.rb +51 -0
- data/lib/startcoin_client/version.rb +12 -0
- data/lib/startcoin_client.rb +19 -0
- data/spec/fixtures/backupwallet_without_params.json +8 -0
- data/spec/fixtures/build_fixture.rb +19 -0
- data/spec/fixtures/getbalance.json +8 -0
- data/spec/fixtures/getbestblockhash.json +8 -0
- data/spec/fixtures/getblock.json +8 -0
- data/spec/fixtures/getblockcount.json +8 -0
- data/spec/fixtures/getblocknumber.json +8 -0
- data/spec/fixtures/getconnectioncount.json +8 -0
- data/spec/fixtures/getdifficulty.json +8 -0
- data/spec/fixtures/getgenerate.json +8 -0
- data/spec/fixtures/gethashespersec.json +8 -0
- data/spec/fixtures/getinfo.json +8 -0
- data/spec/fixtures/getmininginfo.json +8 -0
- data/spec/fixtures/help.json +8 -0
- data/spec/fixtures/listreceivedbyaddress_with_minconf_0.json +8 -0
- data/spec/fixtures/listreceivedbyaddress_with_minconf_0_and_includeempty_true.json +7 -0
- data/spec/fixtures/listreceivedbyaddress_without_params.json +7 -0
- data/spec/fixtures/setaccount.json +8 -0
- data/spec/fixtures/signmessage_invalid_address.json +8 -0
- data/spec/fixtures/signmessage_success.json +8 -0
- data/spec/fixtures/verifymessage_failure.json +8 -0
- data/spec/fixtures/verifymessage_success.json +8 -0
- data/spec/lib/startcoin_client/api_spec.rb +28 -0
- data/spec/lib/startcoin_client/client_spec.rb +184 -0
- data/spec/lib/startcoin_client/request_spec.rb +19 -0
- data/spec/lib/startcoin_client_spec.rb +34 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/support/fixtures_helper.rb +5 -0
- data/spec/support/rpc_service_helper.rb +34 -0
- data/startcoin-client.gemspec +32 -0
- metadata +205 -0
@@ -0,0 +1,307 @@
|
|
1
|
+
module StartcoinClient::DSL
|
2
|
+
def bitcoin
|
3
|
+
if self.class.respond_to?(:bitcoin)
|
4
|
+
@client ||= StartcoinClient::Client.new(self.class.bitcoin.user, self.class.bitcoin.pass, self.class.bitcoin.options)
|
5
|
+
else
|
6
|
+
@client ||= StartcoinClient::Client.new(nil, nil)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def username=(value)
|
11
|
+
bitcoin.user = value
|
12
|
+
end
|
13
|
+
|
14
|
+
def password=(value)
|
15
|
+
bitcoin.pass = value
|
16
|
+
end
|
17
|
+
|
18
|
+
def host=(value)
|
19
|
+
bitcoin.host = value
|
20
|
+
end
|
21
|
+
|
22
|
+
def port=(value)
|
23
|
+
bitcoin.port = value
|
24
|
+
end
|
25
|
+
|
26
|
+
def ssl=(value)
|
27
|
+
bitcoin.ssl = value
|
28
|
+
end
|
29
|
+
|
30
|
+
def username(value = nil)
|
31
|
+
value ? bitcoin.user = value : bitcoin.user
|
32
|
+
end
|
33
|
+
|
34
|
+
def password(value = nil)
|
35
|
+
value ? bitcoin.pass = value : bitcoin.pass
|
36
|
+
end
|
37
|
+
|
38
|
+
def host(value = nil)
|
39
|
+
value ? bitcoin.host = value : bitcoin.host
|
40
|
+
end
|
41
|
+
|
42
|
+
def port(value = nil)
|
43
|
+
value ? bitcoin.port = value : bitcoin.port
|
44
|
+
end
|
45
|
+
|
46
|
+
def ssl(value = nil)
|
47
|
+
value.nil? ? bitcoin.ssl : bitcoin.ssl = value
|
48
|
+
end
|
49
|
+
|
50
|
+
def ssl?
|
51
|
+
bitcoin.ssl?
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
# Safely copies wallet.dat to destination, which can be a directory or a path with filename.
|
56
|
+
def backupwallet(destination)
|
57
|
+
bitcoin.backupwallet destination
|
58
|
+
end
|
59
|
+
|
60
|
+
# Returns the account associated with the given address.
|
61
|
+
def getaccount(bitcoinaddress)
|
62
|
+
bitcoin.getaccount bitcoinaddress
|
63
|
+
end
|
64
|
+
|
65
|
+
# Returns the current bitcoin address for receiving payments to this account.
|
66
|
+
def getaccountaddress(account)
|
67
|
+
bitcoin.getaccountaddress account
|
68
|
+
end
|
69
|
+
|
70
|
+
# Returns the list of addresses for the given account.
|
71
|
+
def getaddressesbyaccount(account)
|
72
|
+
bitcoin.getaddressesbyaccount account
|
73
|
+
end
|
74
|
+
|
75
|
+
# If +account+ is not specified, returns the server's total available balance.
|
76
|
+
# If +account+ is specified, returns the balance in the account.
|
77
|
+
def getbalance(account = nil, minconf = 1)
|
78
|
+
bitcoin.getbalance account, minconf
|
79
|
+
end
|
80
|
+
|
81
|
+
# Returns the hash of the best (tip) block in the longest block chain.
|
82
|
+
def getbestblockhash
|
83
|
+
bitcoin.getbestblockhash
|
84
|
+
end
|
85
|
+
|
86
|
+
# Dumps the block existing at specified height.
|
87
|
+
# Note: this is not available in the official release
|
88
|
+
def getblockbycount(height)
|
89
|
+
bitcoin.getblockbycount height
|
90
|
+
end
|
91
|
+
|
92
|
+
# Dumps the block existing with specified hash.
|
93
|
+
def getblock(hash)
|
94
|
+
bitcoin.getblock hash
|
95
|
+
end
|
96
|
+
|
97
|
+
# Returns the number of blocks in the longest block chain.
|
98
|
+
def getblockcount
|
99
|
+
bitcoin.getblockcount
|
100
|
+
end
|
101
|
+
|
102
|
+
# Returns the block number of the latest block in the longest block chain.
|
103
|
+
def getblocknumber
|
104
|
+
bitcoin.getblocknumber
|
105
|
+
end
|
106
|
+
|
107
|
+
# Returns hash of block in best-block-chain at <index>; index 0 is the genesis block
|
108
|
+
def getblockhash(index)
|
109
|
+
bitcoin.getblockhash index
|
110
|
+
end
|
111
|
+
|
112
|
+
# Returns the number of connections to other nodes.
|
113
|
+
def getconnectioncount
|
114
|
+
bitcoin.getconnectioncount
|
115
|
+
end
|
116
|
+
|
117
|
+
# Returns the proof-of-work difficulty as a multiple of the minimum difficulty.
|
118
|
+
def getdifficulty
|
119
|
+
bitcoin.getdifficulty
|
120
|
+
end
|
121
|
+
|
122
|
+
# Returns true or false whether bitcoind is currently generating hashes
|
123
|
+
def getgenerate
|
124
|
+
bitcoin.getgenerate
|
125
|
+
end
|
126
|
+
|
127
|
+
# Returns a recent hashes per second performance measurement while generating.
|
128
|
+
def gethashespersec
|
129
|
+
bitcoin.gethashespersec
|
130
|
+
end
|
131
|
+
|
132
|
+
# Returns an object containing various state info.
|
133
|
+
def getinfo
|
134
|
+
bitcoin.getinfo
|
135
|
+
end
|
136
|
+
|
137
|
+
# Returns data about each connected network node.
|
138
|
+
def getpeerinfo
|
139
|
+
bitcoin.getpeerinfo
|
140
|
+
end
|
141
|
+
|
142
|
+
# Returns an object containing various mining info.
|
143
|
+
def getmininginfo
|
144
|
+
bitcoin.getmininginfo
|
145
|
+
end
|
146
|
+
|
147
|
+
# Returns a new bitcoin address for receiving payments. If +account+ is specified (recommended),
|
148
|
+
# it is added to the address book so payments received with the address will be credited to +account+.
|
149
|
+
def getnewaddress(account = nil)
|
150
|
+
bitcoin.getnewaddress account
|
151
|
+
end
|
152
|
+
|
153
|
+
# Returns the total amount received by addresses with +account+ in transactions
|
154
|
+
# with at least +minconf+ confirmations.
|
155
|
+
def getreceivedbyaccount(account, minconf = 1)
|
156
|
+
bitcoin.getreceivedbyaccount account, minconf
|
157
|
+
end
|
158
|
+
|
159
|
+
# Returns the total amount received by +bitcoinaddress+ in transactions with at least +minconf+ confirmations.
|
160
|
+
def getreceivedbyaddress(bitcoinaddress, minconf = 1)
|
161
|
+
bitcoin.getreceivedbyaddress bitcoinaddress, minconf
|
162
|
+
end
|
163
|
+
|
164
|
+
# Get detailed information about +txid+
|
165
|
+
def gettransaction(txid)
|
166
|
+
bitcoin.gettransaction txid
|
167
|
+
end
|
168
|
+
|
169
|
+
|
170
|
+
# Get raw transaction bout +txid+. It outputs the whole transaction chain by default in HEX. If you want JSON, set verbose to 1.
|
171
|
+
# When in the bitcoind config is set txindex=1, after reindexing, you can ask about any transaction (not included in your wallet), with this command.
|
172
|
+
def getrawtransaction(txid, verbose = 0)
|
173
|
+
bitcoin.getrawtransaction txid verbose
|
174
|
+
end
|
175
|
+
|
176
|
+
# Gets all mempool txs (pedning/waiting to be added in a block)
|
177
|
+
def getrawmempool
|
178
|
+
bitcoin.getrawmempool
|
179
|
+
end
|
180
|
+
|
181
|
+
# If +data+ is not specified, returns formatted hash data to work on:
|
182
|
+
#
|
183
|
+
# :midstate => precomputed hash state after hashing the first half of the data
|
184
|
+
# :data => block data
|
185
|
+
# :hash1 => formatted hash buffer for second hash
|
186
|
+
# :target => little endian hash target
|
187
|
+
#
|
188
|
+
# If +data+ is specified, tries to solve the block and returns true if it was successful.
|
189
|
+
def getwork(data = nil)
|
190
|
+
bitcoin.getwork data
|
191
|
+
end
|
192
|
+
|
193
|
+
# List commands, or get help for a command.
|
194
|
+
def help(command = nil)
|
195
|
+
bitcoin.help command
|
196
|
+
end
|
197
|
+
|
198
|
+
# Returns Object that has account names as keys, account balances as values.
|
199
|
+
def listaccounts(minconf = 1)
|
200
|
+
bitcoin.listaccounts minconf
|
201
|
+
end
|
202
|
+
|
203
|
+
# Returns an array of objects containing:
|
204
|
+
#
|
205
|
+
# :account => the account of the receiving addresses
|
206
|
+
# :amount => total amount received by addresses with this account
|
207
|
+
# :confirmations => number of confirmations of the most recent transaction included
|
208
|
+
#
|
209
|
+
def listreceivedbyaccount(minconf = 1, includeempty = false)
|
210
|
+
bitcoin.listreceivedbyaccount minconf, includeempty
|
211
|
+
end
|
212
|
+
|
213
|
+
# Returns an array of objects containing:
|
214
|
+
#
|
215
|
+
# :address => receiving address
|
216
|
+
# :account => the account of the receiving address
|
217
|
+
# :amount => total amount received by the address
|
218
|
+
# :confirmations => number of confirmations of the most recent transaction included
|
219
|
+
#
|
220
|
+
# To get a list of accounts on the system, execute bitcoind listreceivedbyaddress 0 true
|
221
|
+
def listreceivedbyaddress(minconf = 1, includeempty = false)
|
222
|
+
bitcoin.listreceivedbyaddress minconf, includeempty
|
223
|
+
end
|
224
|
+
|
225
|
+
# Returns up to +count+ most recent transactions for account +account+.
|
226
|
+
def listtransactions(account = '', count = 10, from = 0)
|
227
|
+
bitcoin.listtransactions account, count, from
|
228
|
+
end
|
229
|
+
|
230
|
+
# Move from one account in your wallet to another.
|
231
|
+
def move(fromaccount, toaccount, amount, minconf = 1, comment = nil)
|
232
|
+
bitcoin.move fromaccount, toaccount, amount, minconf, comment
|
233
|
+
end
|
234
|
+
|
235
|
+
# Return count transactions with <address> present in their scriptSig, skipping skip at the beginning. The ordering is oldest transaction first; if skip is negative the order returned is newest transaction first and skip+1 transactions are skipped. If verbose=0 only txids are returned rather than the full transactions.
|
236
|
+
def searchrawtransactions(bitcoinaddress, verbose=1)
|
237
|
+
bitcoin.searchrawtransactions bitcoinaddress, verbose
|
238
|
+
end
|
239
|
+
|
240
|
+
# +amount+ is a real and is rounded to 8 decimal places. Returns the transaction ID if successful.
|
241
|
+
def sendfrom(fromaccount, tobitcoinaddress, amount, minconf = 1, comment = nil, comment_to = nil)
|
242
|
+
bitcoin.sendfrom fromaccount, tobitcoinaddress, amount, minconf, comment, comment_to
|
243
|
+
end
|
244
|
+
|
245
|
+
# +amount+ is a real and is rounded to 8 decimal places
|
246
|
+
def sendtoaddress(bitcoinaddress, amount, comment = nil, comment_to = nil)
|
247
|
+
bitcoin.sendtoaddress bitcoinaddress, amount, comment, comment_to
|
248
|
+
end
|
249
|
+
|
250
|
+
# Sets the account associated with the given address.
|
251
|
+
def setaccount(bitcoinaddress, account)
|
252
|
+
bitcoin.setaccount bitcoinaddress, account
|
253
|
+
end
|
254
|
+
|
255
|
+
# +generate+ is true or false to turn generation on or off.
|
256
|
+
# Generation is limited to +genproclimit+ processors, -1 is unlimited.
|
257
|
+
def setgenerate(generate, genproclimit = -1)
|
258
|
+
bitcoin.setgenerate generate, genproclimit
|
259
|
+
end
|
260
|
+
|
261
|
+
# Stop bitcoin server.
|
262
|
+
def stop
|
263
|
+
bitcoin.stop
|
264
|
+
end
|
265
|
+
|
266
|
+
# Return information about +bitcoinaddress+.
|
267
|
+
def validateaddress(bitcoinaddress)
|
268
|
+
bitcoin.validateaddress
|
269
|
+
end
|
270
|
+
|
271
|
+
alias account getaccount
|
272
|
+
alias account_address getaccountaddress
|
273
|
+
alias addresses_by_account getaddressesbyaccount
|
274
|
+
alias balance getbalance
|
275
|
+
alias block_by_count getblockbycount
|
276
|
+
alias block_count getblockcount
|
277
|
+
alias block_number getblocknumber
|
278
|
+
alias block_hash getblockhash
|
279
|
+
alias connection_count getconnectioncount
|
280
|
+
alias difficulty getdifficulty
|
281
|
+
alias generate? getgenerate
|
282
|
+
alias hashes_per_sec gethashespersec
|
283
|
+
alias info getinfo
|
284
|
+
alias peerinfo getpeerinfo
|
285
|
+
alias mininginfo getmininginfo
|
286
|
+
alias new_address getnewaddress
|
287
|
+
alias received_by_account getreceivedbyaccount
|
288
|
+
alias received_by_address getreceivedbyaddress
|
289
|
+
alias transaction gettransaction
|
290
|
+
alias rawtransaction getrawtransaction
|
291
|
+
alias work getwork
|
292
|
+
alias get_work getwork
|
293
|
+
alias accounts listaccounts
|
294
|
+
alias list_received_by_account listreceivedbyaccount
|
295
|
+
alias list_received_by_address listreceivedbyaddress
|
296
|
+
alias transactions listtransactions
|
297
|
+
alias list_transactions listtransactions
|
298
|
+
alias send_from sendfrom
|
299
|
+
alias send_to_address sendtoaddress
|
300
|
+
alias account= setaccount
|
301
|
+
alias set_account setaccount
|
302
|
+
alias generate= setgenerate
|
303
|
+
alias set_generate setgenerate
|
304
|
+
alias validate_address validateaddress
|
305
|
+
alias search_raw_transactions searchrawtransactions
|
306
|
+
alias raw_mempool getrawmempool
|
307
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
class StartcoinClient::Request
|
4
|
+
attr_reader :service_name, :params
|
5
|
+
|
6
|
+
def initialize(service_name, params = [])
|
7
|
+
@service_name = service_name
|
8
|
+
@params = params.dup
|
9
|
+
|
10
|
+
# bitcoin rejects null values even for optional params. Since
|
11
|
+
# even params following those may have default non-nil values,
|
12
|
+
# we'll assume the first non-nil value marks a set of optional
|
13
|
+
# params, and drop it and everything following it.
|
14
|
+
#
|
15
|
+
# ex:
|
16
|
+
# [nil] => []
|
17
|
+
# [1,nil,nil] => [1]
|
18
|
+
# [1,nil,nil,1] => [1]
|
19
|
+
if index = @params.index(nil)
|
20
|
+
@params = @params[0...index]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_hash
|
25
|
+
{
|
26
|
+
:method => service_name,
|
27
|
+
:params => params,
|
28
|
+
:id => "jsonrpc"
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def to_post_data
|
33
|
+
to_hash.to_json
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'rest_client'
|
2
|
+
|
3
|
+
class StartcoinClient::RPC
|
4
|
+
def initialize(options)
|
5
|
+
@user, @pass = options[:user], options[:pass]
|
6
|
+
@host, @port = options[:host], options[:port]
|
7
|
+
@ssl = options[:ssl]
|
8
|
+
end
|
9
|
+
|
10
|
+
def credentials
|
11
|
+
if @user
|
12
|
+
"#{@user}:#{@pass}"
|
13
|
+
else
|
14
|
+
nil
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def service_url
|
19
|
+
url = @ssl ? "https://" : "http://"
|
20
|
+
url.concat "#{credentials}@" if c = credentials
|
21
|
+
url.concat "#{@host}:#{@port}"
|
22
|
+
url
|
23
|
+
end
|
24
|
+
|
25
|
+
def dispatch(request)
|
26
|
+
RestClient.post(service_url, request.to_post_data, content_type: :json) do |respdata, request, result|
|
27
|
+
response = JSON.parse(respdata)
|
28
|
+
raise StartcoinClient::Errors::RPCError, response['error'] if response['error']
|
29
|
+
response['result']
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
def symbolize_keys(hash)
|
35
|
+
case hash
|
36
|
+
when Hash
|
37
|
+
hash.inject({}) do |result, (key, value)|
|
38
|
+
key = key.to_sym if key.kind_of?(String)
|
39
|
+
value = symbolize_keys(value)
|
40
|
+
result[key] = value
|
41
|
+
result
|
42
|
+
end
|
43
|
+
when Array
|
44
|
+
hash.collect do |ele|
|
45
|
+
symbolize_keys(ele)
|
46
|
+
end
|
47
|
+
else
|
48
|
+
hash
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module StartcoinClient
|
2
|
+
autoload :Client, 'startcoin_client/client'
|
3
|
+
autoload :API, 'startcoin_client/api'
|
4
|
+
autoload :Request, 'startcoin_client/request'
|
5
|
+
autoload :RPC, 'startcoin_client/rpc'
|
6
|
+
autoload :Errors, 'startcoin_client/errors'
|
7
|
+
autoload :Version, 'startcoin_client/version'
|
8
|
+
autoload :VERSION, 'startcoin_client/version'
|
9
|
+
autoload :DSL, 'startcoin_client/dsl'
|
10
|
+
|
11
|
+
def self.included(base)
|
12
|
+
base.send(:include, StartcoinClient::DSL)
|
13
|
+
base.send(:extend, StartcoinClient::DSL)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def StartcoinClient(user, pass, options = {})
|
18
|
+
::StartcoinClient::Client.new(user, pass, options)
|
19
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
HTTP/1.1 500 Internal Server Error
|
2
|
+
Date: Sun, 21 Aug 2011 22:53:05 +0000
|
3
|
+
Connection: close
|
4
|
+
Content-Length: 183
|
5
|
+
Content-Type: application/json
|
6
|
+
Server: bitcoin-json-rpc/0.3.24-beta
|
7
|
+
|
8
|
+
{"result":null,"error":{"code":-1,"message":"backupwallet <destination>\nSafely copies wallet.dat to destination, which can be a directory or a path with filename."},"id":"curltest"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
service_name = ARGV[0]
|
7
|
+
file_name = (ARGV[1] || service_name).dup
|
8
|
+
params = ARGV[2..-1].collect { |y| y == '_nil' ? nil : YAML::load(y) }
|
9
|
+
|
10
|
+
file_name << ".json" unless file_name =~ /\.json$/
|
11
|
+
|
12
|
+
data = { 'jsonrpc' => '1.0', 'id' => 'curltest', 'method' => service_name, 'params' => params }
|
13
|
+
command = "curl --user LovleOdnu:NajOij6DriWokEjEinaw --data-binary '#{data.to_json}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ -i"
|
14
|
+
|
15
|
+
puts command, nil
|
16
|
+
result = %x[#{command}]
|
17
|
+
puts result, nil
|
18
|
+
File.open(file_name, "w") { |f| f.print result }
|
19
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Date: Sat, 31 May 2014 17:57:47 +0000
|
3
|
+
Connection: keep-alive
|
4
|
+
Content-Length: 107
|
5
|
+
Content-Type: application/json
|
6
|
+
Server: bitcoin-json-rpc/v0.9.0.0-g92d25e4-beta
|
7
|
+
|
8
|
+
{"result":"00000000fca1180c1a3cb0c14a88a8feda089c62f57778beb241aaabcd512309","error":null,"id":"curltest"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Date: Mon, 10 Jun 2013 08:36:04 +0000
|
3
|
+
Connection: keep-alive
|
4
|
+
Content-Length: 1657
|
5
|
+
Content-Type: application/json
|
6
|
+
Server: bitcoin-json-rpc/v0.8.1-beta
|
7
|
+
|
8
|
+
{"result":{"hash":"0000000000000002e004985f39f929d001448623b312185bf5e4ab50e5a8e60a","confirmations":19,"size":5227,"height":240707,"version":2,"merkleroot":"18b914e2d6bd4c3118a936af75afbd230611edb6929a607302c0d591ef49b24e","tx":["cutforsimplicity","27f99033bdcea87b07f8eea4279d7ce24e479fcb49e9f54e9ffb3721e29838ed"],"time":1370842803,"nonce":3937756309,"bits":"1a011337","difficulty":15605632.68128593,"previousblockhash":"000000000000003fa76b2abdd3036d183d7e24cfb6b543781d59cdca289f6053","nextblockhash":"0000000000000087a1e962f618f757393930e58a745165033fc9d281b7bb568a"},"error":null,"id":"curltest"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Date: Sun, 21 Aug 2011 20:24:03 +0000
|
3
|
+
Connection: close
|
4
|
+
Content-Length: 281
|
5
|
+
Content-Type: application/json
|
6
|
+
Server: bitcoin-json-rpc/0.3.24-beta
|
7
|
+
|
8
|
+
{"result":{"version":32400,"balance":0.00100000,"blocks":141957,"connections":8,"proxy":"","generate":false,"genproclimit":-1,"difficulty":1805700.83619367,"hashespersec":0,"testnet":false,"keypoololdest":1313766189,"paytxfee":0.00000000,"errors":""},"error":null,"id":"curltest"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Date: Mon, 10 Jun 2013 07:49:23 +0000
|
3
|
+
Connection: keep-alive
|
4
|
+
Content-Length: 222
|
5
|
+
Content-Type: application/json
|
6
|
+
Server: bitcoin-json-rpc/v0.8.1-beta
|
7
|
+
|
8
|
+
{"result":{"blocks":237338,"currentblocksize":0,"currentblocktx":0,"difficulty":11187257.46136079,"errors":"","generate":false,"genproclimit":-1,"hashespersec":0,"pooledtx":0,"testnet":false},"error":null,"id":"curltest"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Date: Sun, 21 Aug 2011 23:20:10 +0000
|
3
|
+
Connection: close
|
4
|
+
Content-Length: 1078
|
5
|
+
Content-Type: application/json
|
6
|
+
Server: bitcoin-json-rpc/0.3.24-beta
|
7
|
+
|
8
|
+
{"result":"backupwallet <destination>\ngetaccount <bitcoinaddress>\ngetaccountaddress <account>\ngetaddressesbyaccount <account>\ngetbalance [account] [minconf=1]\ngetblockcount\ngetblocknumber\ngetconnectioncount\ngetdifficulty\ngetgenerate\ngethashespersec\ngetinfo\ngetnewaddress [account]\ngetreceivedbyaccount <account> [minconf=1]\ngetreceivedbyaddress <bitcoinaddress> [minconf=1]\ngettransaction <txid>\ngetwork [data]\nhelp [command]\nlistaccounts [minconf=1]\nlistreceivedbyaccount [minconf=1] [includeempty=false]\nlistreceivedbyaddress [minconf=1] [includeempty=false]\nlisttransactions [account] [count=10] [from=0]\nmove <fromaccount> <toaccount> <amount> [minconf=1] [comment]\nsendfrom <fromaccount> <tobitcoinaddress> <amount> [minconf=1] [comment] [comment-to]\nsendmany <fromaccount> {address:amount,...} [minconf=1] [comment]\nsendtoaddress <bitcoinaddress> <amount> [comment] [comment-to]\nsetaccount <bitcoinaddress> <account>\nsetgenerate <generate> [genproclimit]\nsettxfee <amount>\nstop\nvalidateaddress <bitcoinaddress>","error":null,"id":"curltest"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Date: Sun, 21 Aug 2011 23:04:42 +0000
|
3
|
+
Connection: close
|
4
|
+
Content-Length: 155
|
5
|
+
Content-Type: application/json
|
6
|
+
Server: bitcoin-json-rpc/0.3.24-beta
|
7
|
+
|
8
|
+
{"result":[{"address":"1234","account":"","label":"","amount":0.00100000,"confirmations":180}],"error":null,"id":"curltest"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Date: Sun, 21 Aug 2011 23:15:11 +0000
|
3
|
+
Connection: close
|
4
|
+
Content-Type: application/json
|
5
|
+
Server: bitcoin-json-rpc/0.3.24-beta
|
6
|
+
|
7
|
+
{"result":[{"address":"1234","account":"","label":"","amount":0.00100000,"confirmations":180}],"error":null,"id":"curltest"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Date: Sun, 21 Aug 2011 22:54:36 +0000
|
3
|
+
Connection: close
|
4
|
+
Content-Type: application/json
|
5
|
+
Server: bitcoin-json-rpc/0.3.24-beta
|
6
|
+
|
7
|
+
{"result":[{"address":"1234","account":"","label":"","amount":0.00100000,"confirmations":180}],"error":null,"id":"curltest"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
HTTP/1.1 500 Internal Server Error
|
2
|
+
Date: Sun, 26 Aug 2012 23:58:59 +0000
|
3
|
+
Connection: close
|
4
|
+
Content-Length: 80
|
5
|
+
Content-Type: application/json
|
6
|
+
Server: bitcoin-json-rpc/v0.6.3-beta
|
7
|
+
|
8
|
+
{"result":null,"error":{"code":-3,"message":"Invalid address"},"id":"curltest"}
|