Method: OnChain::BlockChain.insight_get_unspent_outs

Defined in:
lib/onchain/providers/insight_api.rb

.insight_get_unspent_outs(address, network = :bitcoin) ⇒ Object



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/onchain/providers/insight_api.rb', line 108

def insight_get_unspent_outs(address, network = :bitcoin)
    
  base_url = get_insight_url(network) + "addr/#{address}/utxo"
  json = fetch_response(base_url, true)
  
  unspent = []
  
  json.each do |data|
    line = []
    line << data['txid']
    line << data['vout']
    line << data['scriptPubKey']
    line << (data['amount'].to_f * 100000000).to_i
    unspent << line
  end
  
  return unspent
end