Module: BlockchainInfo::BlockChain

Included in:
BlockchainInfo
Defined in:
lib/blockchain_info/block_chain.rb

Instance Method Summary collapse

Instance Method Details

#getreceivedbyaddress(address, minconf = 0) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/blockchain_info/block_chain.rb', line 13

def getreceivedbyaddress(address, minconf = 0)
  if minconf > 0 
    url = "#{getreceivedbyaddress_url}/#{address}?confirmations=#{minconf}"
  else
    url = "#{getreceivedbyaddress_url}/#{address}"
  end
  
  satoshi_to_bitcoins BigDecimal(open(url).read)
end

#longest_block_countObject



23
24
25
# File 'lib/blockchain_info/block_chain.rb', line 23

def longest_block_count
  BigDecimal(open("#{domain}/q/getblockcount").read).to_i
end

#multiaddr(addresses) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/blockchain_info/block_chain.rb', line 4

def multiaddr(addresses)
  if addresses.is_a?(String)
    addresses = [addresses]
  end
  
  url = "#{multiaddr_url}?active=#{addresses.join('|')}"
  JSON.parse(open(URI.encode(url)).read)
end