Class: BlockchainLite::Bitcoin::Block

Inherits:
Object
  • Object
show all
Defined in:
lib/blockchain-lite/bitcoin/block.rb

Overview

bitcoin-compatible block

note: work-in-progress

Defined Under Namespace

Classes: Header

Class Method Summary collapse

Class Method Details

.first(data = 'Genesis') ⇒ Object

create genesis (big bang! first) block



44
45
46
47
# File 'lib/blockchain-lite/bitcoin/block.rb', line 44

def self.first( data='Genesis' )    # create genesis (big bang! first) block
    ## uses index zero (0) and arbitrary previous_hash ('0')
    Block.new( 0, data, '0' )
end

.next(previous, data = 'Transaction Data...') ⇒ Object



49
50
51
# File 'lib/blockchain-lite/bitcoin/block.rb', line 49

def self.next( previous, data='Transaction Data...' )
  Block.new( previous.index+1, data, previous.hash )
end