# Path: blockchain.py
# MAIN_CHAIN = 1
# SIDE_CHAIN = 2
# ORPHAN_CHAIN = 3
# INVALID_CHAIN = 4
# class BlockError(Exception):
# class InvalidBlock(BlockError):
# class Block(js.Entity, bs.Entity):
#     def hash(self): return self.block.hash
#     def hexhash(self): return h2h(self.hash)
#     def prev(self): return self.block.prev
#     def iter_blocks():
#     def get_by_hash(h):
#     def get_by_number(num):
#     def exist_by_hash(h):
#     def exist_by_number(num):
#     def get_or_make(blkmsg):
#     def put(self):
#     def get_tx(self, idx):
#     def iter_tx(self, from_idx=0, to_idx=None, reverse=False, enum=False):
#     def get_prev(self):
#     def get_next_bits(self):
#     def verify(self):
#     def confirm(self):
#     def revert(self):
#     def invalidate(self):
#     def link(self):
#     def get_all_fees(self):
#     def changes_since(self):
#     def __repr__(self):
#     def make(self, blockmsg):
#     def tonetwork(self):
# def add_genesis(blkmsg, txn=None):
# def get_bestblock(txn=None, raw=False):
# def set_bestblock(blk, check=True):
# def reorganize(old, new):
# def find_split(old, new):
# def process_blockmsg(blkmsg):
# def read_blocks(f):


import web
from blockchain import Block, Tx, _chains, get_bestblock
from utils import *

def tx_link(tx_h):
    return """<a href="/tx/%s">%s</a>""" % (h2h(tx_h), h2h(tx_h))
def blk_link(blk_h):
    return """<a href="/blockhash/%s">%s</a>""" % (h2h(blk_h), h2h(blk_h))
def chain_name(ch):

# Path: blockchain.py
# MAIN_CHAIN = 1
# SIDE_CHAIN = 2
# ORPHAN_CHAIN = 3
# INVALID_CHAIN = 4
# class BlockError(Exception):
# class InvalidBlock(BlockError):
# class Block(js.Entity, bs.Entity):
#     def hash(self): return self.block.hash
#     def hexhash(self): return h2h(self.hash)
#     def prev(self): return self.block.prev
#     def iter_blocks():
#     def get_by_hash(h):
#     def get_by_number(num):
#     def exist_by_hash(h):
#     def exist_by_number(num):
#     def get_or_make(blkmsg):
#     def put(self):
#     def get_tx(self, idx):
#     def iter_tx(self, from_idx=0, to_idx=None, reverse=False, enum=False):
#     def get_prev(self):
#     def get_next_bits(self):
#     def verify(self):
#     def confirm(self):
#     def revert(self):
#     def invalidate(self):
#     def link(self):
#     def get_all_fees(self):
#     def changes_since(self):
#     def __repr__(self):
#     def make(self, blockmsg):
#     def tonetwork(self):
# def add_genesis(blkmsg, txn=None):
# def get_bestblock(txn=None, raw=False):
# def set_bestblock(blk, check=True):
# def reorganize(old, new):
# def find_split(old, new):
# def process_blockmsg(blkmsg):
# def read_blocks(f):


# Path: webinterface.py
import web
from blockchain import Block, Tx, _chains, get_bestblock
from utils import *


def tx_link(tx_h):
    return """<a href="/tx/%s">%s</a>""" % (h2h(tx_h), h2h(tx_h))
def blk_link(blk_h):
    return """<a href="/blockhash/%s">%s</a>""" % (h2h(blk_h), h2h(blk_h))
def chain_name(ch):

    return _chains.get(ch, "unknown")