An instance of the Wallet class needs to be initialized before it can be used.
str identifierstr passwordstr url(optional, defaults to http://localhost:3000)str second_password(optional)str api_code(optional)
require 'Blockchain'
wallet = Blockchain::Wallet.new('ada4e4b6-3c9f-11e4-baad-164230d1df67', 'password123')Send bitcoin from your wallet to a single address. Returns a PaymentResponse object.
str to- receiving addressint amount- amount to send (in satoshi)str from_address(optional, keyword) - specific address to send fromint fee(optional, keyword) - transaction fee in satoshi. Must be greater than default
payment = wallet.send('1NAF7GbdyRg3miHNrw2bGxrd63tfMEmJob', 1000000, from_address: '1A8JiWcwvpY7tAopUkSnGuEYHmzGYfZPiq')
puts payment.tx_hashSend bitcoin from your wallet to multiple addresses. Returns a PaymentResponse object.
dictionary recipients- hash with the structure ofstr address=>int amountin satoshistr from_address(optional, keyword) - specific address to send fromint fee(optional, keyword) - transaction fee in satoshi. Must be greater than default
recipients = { '1NAF7GbdyRg3miHNrw2bGxrd63tfMEmJob' => 1428300,
'1A8JiWcwvpY7tAopUkSnGuEYHmzGYfZPiq' => 234522117 }
payment = wallet.send_many(recipients)
puts payment.tx_hashFetch the wallet balance. Includes unconfirmed transactions and possibly double spends. Returns the wallet balance in satoshi.
puts wallet.get_balance()List all active addresses in the wallet. Returns an array of WalletAddress objects.
addresses = wallet.list_addresses()
addresses.each do |a|
puts a.balance
endRetrieve an address from the wallet. Returns an WalletAddress object.
str address- the address to retrieve
addr = wallet.get_address('1NAF7GbdyRg3miHNrw2bGxrd63tfMEmJob')
puts addr.balanceGenerate a new address and add it to the wallet. Returns an WalletAddress object.
str label(optional, keyword) - label to attach to the address
newaddr = wallet.new_address('test_label')Archive an address. Returns a string representation of the archived address.
str address- address to archive
wallet.archive_address('1NAF7GbdyRg3miHNrw2bGxrd63tfMEmJob')Unarchive an address. Returns a string representation of the unarchived address.
str address- address to unarchive
wallet.unarchive_address('1NAF7GbdyRg3miHNrw2bGxrd63tfMEmJob')balanceaddresslabeltotal_received
messagetx_hashnotice