pybit/Examples/Py3_BlockchainInfoAPI.py
def block_validate(block,
                   pr=True,
                   **kwargs):
    """
    Query a block hash from Blockchain.info's api. Check it matches the block
    on size, merkle root, number of transactions, previous block hash

    Respects apis request limting queries to 1 every 10s.
    """
    # Wait if last query was less than 10s ago
    jr = get_resp(block.hash,
                  url="https://blockchain.info/rawblock/",
                  **kwargs)

    if jr is not None:
        # Check size
        t1 = jr['size'] == block.blockSize
        if pr:
            print(t1)

        # Check merkle root
        t2 = jr['mrkl_root'] == block.merkleRootHash
        if pr:
            print(t2)

        # Check number of transactions
        t3 = jr['n_tx'] == block.nTransactions
        if pr:
            print(t3)

        # Check previous block hash
        t4 = jr['prev_block'] == block.prevHash
        if pr:
            print(t4)

    else:
        t1 = t2 = t3 = t4 = False
   
    # The the overall result
    result = t1 & t2 & t3 & t4

    # Report
    if pr:
        if result:
            print("Pass")
        else:
            print("Fail")

    return lastTime, result

    Query a block hash from Blockchain.info's api. Check it matches the block
    on size, merkle root, number of transactions, previous block hash

    Respects apis request limting queries to 1 every 10s.
    
Query a block hash from Blockchain.info's api. Check it matches the block
on size, merkle root, number of transactions, previous block hash

Respects apis request limting queries to 1 every 10s.
Query a block hash from Blockchain . info ' s api . Check it matches the block on size merkle root number of transactions previous block hash Respects apis request limting queries to 1 every 10s .
def block_validate(block,
                   pr=True,
                   **kwargs):
    jr = get_resp(block.hash,
                  url="https://blockchain.info/rawblock/",
                  **kwargs)
    if jr is not None:
        t1 = jr['size'] == block.blockSize
        if pr:
            print(t1)
        t2 = jr['mrkl_root'] == block.merkleRootHash
        if pr:
            print(t2)
        t3 = jr['n_tx'] == block.nTransactions
        if pr:
            print(t3)
        t4 = jr['prev_block'] == block.prevHash
        if pr:
            print(t4)
    else:
        t1 = t2 = t3 = t4 = False
    result = t1 & t2 & t3 & t4
    if pr:
        if result:
            print("Pass")
        else:
            print("Fail")
    return lastTime, result
def block_validate ( block , pr = True , ** kwargs ) : jr = get_resp ( block . hash , url = "https://blockchain.info/rawblock/" , ** kwargs ) if jr is not None : t1 = jr [ 'size' ] == block . blockSize if pr : print ( t1 ) t2 = jr [ 'mrkl_root' ] == block . merkleRootHash if pr : print ( t2 ) t3 = jr [ 'n_tx' ] == block . nTransactions if pr : print ( t3 ) t4 = jr [ 'prev_block' ] == block . prevHash if pr : print ( t4 ) else : t1 = t2 = t3 = t4 = False result = t1 & t2 & t3 & t4 if pr : if result : print ( "Pass" ) else : print ( "Fail" ) return lastTime , result
Query a block hash from Blockchain.info's api.
Query a block hash from Blockchain . info ' s api .
"""
    Query a block hash from Blockchain.info's api. Check it matches the block
    on size, merkle root, number of transactions, previous block hash

    Respects apis request limting queries to 1 every 10s.
    """ # Wait if last query was less than 10s ago # Check size # Check merkle root # Check number of transactions # Check previous block hash # The the overall result # Report
block
pr