class Blockchain::Block

Attributes

bits[R]
block_index[R]
fee[R]
hash[R]
height[R]
main_chain[R]
merkle_root[R]
n_tx[R]
nonce[R]
previous_block[R]
received_time[R]
relayed_by[R]
size[R]
time[R]
transactions[R]
version[R]

Public Class Methods

new(b) click to toggle source
# File lib/blockchain/blockexplorer.rb, line 370
def initialize(b)
        @hash = b['hash']
        @version = b['ver']
        @previous_block = b['prev_block']
        @merkle_root = b['mrkl_root']
        @time = b['time']
        @bits = b['bits']
        @fee = b['fee']
        @nonce = b['nonce']
        @n_tx = b['n_tx']
        @size = b['size']
        @block_index = b['block_index']
        @main_chain = b['main_chain']
        @height = b['height']
        @received_time = b['received_time']
        @relayed_by = b['relayed_by']
        @transactions = b['tx'].map{ |tx| Transaction.new(tx) }
        @transactions.each do |tx|
                tx.adjust_block_height(@height)
        end

        if @received_time.nil?
                @received_time = @time
        end
end