Package org.ethereum.facade

Examples of org.ethereum.facade.Blockchain


    }

    private void fillBlock(final BlockChainTable blockchainTable) {
        if (blockNumberText.getText().length() == 0) return;

        Blockchain blockchain = UIEthereumManager.ethereum.getBlockchain();
        long blockNum = Long.parseLong(blockNumberText.getText());
        if (blockNum > blockchain.getSize() - 1) {
            blockNum = blockchain.getSize() - 1;
        }
        Block block = blockchain.getBlockByNumber(blockNum);
        blockN.setText("" + block.getNumber());
        highlightText(blockN);
        minGasPrice.setText("" + block.getMinGasPrice());
        highlightText(minGasPrice);
        gasLimit.setText("" + block.getGasLimit());
View Full Code Here


    }
   
    @Test
    public void testCalcDifficulty() {

        Blockchain blockchain = worldManager.getBlockchain();
        Block genesis = Genesis.getInstance();
        BigInteger difficulty = new BigInteger(1, genesis.calcDifficulty());
        logger.info("Genesis difficulty: [{}]", difficulty.toString());
        assertEquals(new BigInteger(1, Genesis.DIFFICULTY), difficulty);

        // Storing genesis because the parent needs to be in the DB for calculation.
        blockchain.add(genesis);

        Block block1 = new Block(Hex.decode(PoC7_GENESIS_HEX_RLP_ENCODED));
        BigInteger calcDifficulty = new BigInteger(1, block1.calcDifficulty());
        BigInteger actualDifficulty = new BigInteger(1, block1.getDifficulty());
        logger.info("Block#1 actual difficulty: [{}] ", actualDifficulty.toString());
View Full Code Here

TOP

Related Classes of org.ethereum.facade.Blockchain

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.