Blockchair Client is an interface to interact with Blockchair's API. Blockchair is a free blockchain explorer supporting a number of cryptos, including among others Bitcoin, BitcoinCash, BitcoinSV, Ethereum and Litecoin, even with Bech32 adresses.
- Clone the repository
- Install Ruby 2.5.0
- Execute
bundle install
You can pass multiple variables that will be used in the configuration.
BlockchairClient.configure do |config|
config.currency = 'LTC'
end
You can also pass any of those options inline when loading an instance of BlockchairClient.
client = BlockchairClient.new({currency: 'LTC'})
Address (docs)
client.address(CRYPTO_ADDRESS).query
client.address(CRYPTO_ADDRESS).transactions
client.address(CRYPTO_ADDRESS).type
client.address(CRYPTO_ADDRESS).script_hex
client.address(CRYPTO_ADDRESS).balance
client.address(CRYPTO_ADDRESS).balance_usd
client.address(CRYPTO_ADDRESS).received
client.address(CRYPTO_ADDRESS).received_usd
client.address(CRYPTO_ADDRESS).spent
client.address(CRYPTO_ADDRESS).spent_usd
client.address(CRYPTO_ADDRESS).output_count
client.address(CRYPTO_ADDRESS).unspent_output_count
client.address(CRYPTO_ADDRESS).first_seen_receiving
client.address(CRYPTO_ADDRESS).last_seen_receiving
client.address(CRYPTO_ADDRESS).first_seen_spending
client.address(CRYPTO_ADDRESS).last_seen_spending
client.address(CRYPTO_ADDRESS).transaction_count
Transaction (docs)
client.transaction(CRYPTO_TX).query
client.transaction(CRYPTO_TX).confirmations
client.transaction(CRYPTO_TX).inputs
client.transaction(CRYPTO_TX).outputs
client.transaction(CRYPTO_TX).block_id
client.transaction(CRYPTO_TX).id
client.transaction(CRYPTO_TX).hash
client.transaction(CRYPTO_TX).date
client.transaction(CRYPTO_TX).time
client.transaction(CRYPTO_TX).size
client.transaction(CRYPTO_TX).weight
client.transaction(CRYPTO_TX).version
client.transaction(CRYPTO_TX).lock_time
client.transaction(CRYPTO_TX).is_coinbase
client.transaction(CRYPTO_TX).has_witness
client.transaction(CRYPTO_TX).input_count
client.transaction(CRYPTO_TX).output_count
client.transaction(CRYPTO_TX).input_total
client.transaction(CRYPTO_TX).input_total_usd
client.transaction(CRYPTO_TX).output_total
client.transaction(CRYPTO_TX).output_total_usd
client.transaction(CRYPTO_TX).fee
client.transaction(CRYPTO_TX).fee_usd
client.transaction(CRYPTO_TX).fee_per_kb
client.transaction(CRYPTO_TX).fee_per_kb_usd
client.transaction(CRYPTO_TX).fee_per_kwu
client.transaction(CRYPTO_TX).fee_per_kwu_usd
client.transaction(CRYPTO_TX).cdd_total
Transactions (docs)
client.transactions(CRYPTO_TX1, CRYPTO_TX2).query
client.transactions(CRYPTO_TX1, CRYPTO_TX2)[CRYPTO_TX1].tx_hash
client.transactions(CRYPTO_TX, CRYPTO_TX2)[CRYPTO_TX2].tx_hash
The behaviour is the same as for Transaction
for the rest of the cases.
client.transactions(CRYPTO_TX1, CRYPTO_TX2).inputs[CRYPTO_TX1]
client.transactions(CRYPTO_TX1, CRYPTO_TX2).outputs[CRYPTO_TX1]
client.transactions(CRYPTO_TX1, CRYPTO_TX2).confirmations[CRYPTO_TX1]