Class: Bitcoin2Graphdb::Bitcoin::BlockchainProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/bitcoin2graphdb/bitcoin/blockchain_provider.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ BlockchainProvider

Returns a new instance of BlockchainProvider.



16
17
18
19
# File 'lib/bitcoin2graphdb/bitcoin/blockchain_provider.rb', line 16

def initialize(config)
  @api = OpenAssets::Api.new(config)
  @api
end

Instance Attribute Details

#apiObject (readonly)

Returns the value of attribute api.



14
15
16
# File 'lib/bitcoin2graphdb/bitcoin/blockchain_provider.rb', line 14

def api
  @api
end

Instance Method Details

#block(block_hash) ⇒ Object



21
22
23
# File 'lib/bitcoin2graphdb/bitcoin/blockchain_provider.rb', line 21

def block(block_hash)
  api.provider.getblock(block_hash)
end

#block_hash(block_height) ⇒ Object



25
26
27
# File 'lib/bitcoin2graphdb/bitcoin/blockchain_provider.rb', line 25

def block_hash(block_height)
  api.provider.getblockhash(block_height)
end

#oa_outputs(txid) ⇒ Object



33
34
35
# File 'lib/bitcoin2graphdb/bitcoin/blockchain_provider.rb', line 33

def oa_outputs(txid)
  api.get_outputs_from_txid(txid, true)
end

#tx(txid) ⇒ Object



29
30
31
# File 'lib/bitcoin2graphdb/bitcoin/blockchain_provider.rb', line 29

def tx(txid)
  api.provider.getrawtransaction(txid, 1)
end