src/main/Block.java
public boolean mineBlock(int difficulty) {
        String target = new String(new char[difficulty]).replace('\0', '0');
        int nonce = 0; 
        String newHash = hash;
		while(!(newHash.substring( 0, difficulty).equals(target))) {
            nonce ++;
			newHash = calculateHash(nonce);
        }
        System.out.println("Block Mined: " + newHash);
        return true;
    }
// Done as a proof of work concept in order to select which node mines the block
Done as a proof of work concept in order to select which node mines the block
Done as a proof of work concept in order to select which node mines the block
public boolean mineBlock(int difficulty) {
        String target = new String(new char[difficulty]).replace('\0', '0');
        int nonce = 0; 
        String newHash = hash;
		while(!(newHash.substring( 0, difficulty).equals(target))) {
            nonce ++;
			newHash = calculateHash(nonce);
        }
        System.out.println("Block Mined: " + newHash);
        return true;
    }
public boolean mineBlock ( int difficulty ) { String target = new String ( new char [ difficulty ] ) . replace ( '\0' , '0' ) ; int nonce = 0 ; String newHash = hash ; while ( ! ( newHash . substring ( 0 , difficulty ) . equals ( target ) ) ) { nonce ++ ; newHash = calculateHash ( nonce ) ; } System . out . println ( "Block Mined: " + newHash ) ; return true ; }
Done as a proof of work concept in order to select which node mines the block
Done as a proof of work concept in order to select which node mines the block