I am not able to understand what is wrong with my code.
public void GetLatestBlock() throws Exception{
List<EthBlock.TransactionResult> txs = Web3j.ethGetBlockByNumber(DefaultBlockParameterName.LATEST,
true).send().getBlock().getTransactions();
//Ttxs =TestGet();
txs.forEach(tx -> {
EthBlock.TransactionObject transaction = (EthBlock.TransactionObject) tx.get();
System.out.println(transaction.getFrom());
});
It shows error : Cannot make a static reference to the non-static method ethGetBlockByNumber(DefaultBlockParameter, boolean) from the type Ethereum
I want to get lastblock's receipt for calculate the hashrate.
please give me some advice. Thanks a lot.