/* * Copyright (c) [2016] [ <ether.camp> ] * This file is part of the ethereumJ library. * * The ethereumJ library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The ethereumJ library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with the ethereumJ library. If not, see <http://www.gnu.org/licenses/>. */ package org.ethereum.facade; import org.ethereum.core.Block; import org.ethereum.core.Transaction; import org.ethereum.db.BlockStore; import java.math.BigInteger; import java.util.List; import java.util.Set; public interface Blockchain { /** * Get block by number from the best chain * @param number - number of the block * @return block by that number */ Block getBlockByNumber(long number); /** * Get block by hash * @param hash - hash of the block * @return - bloc by that hash */ Block getBlockByHash(byte[] hash); /** * Get total difficulty from the start * and until the head of the chain * * @return - total difficulty */ BigInteger getTotalDifficulty(); /** * Get the underlying BlockStore * @return Blockstore */ BlockStore getBlockStore(); /** * @return - last added block from blockchain */ Block getBestBlock(); /** * Flush the content of local storage objects to disk */ void flush(); }