Bitcoin Forum
June 24, 2024, 07:21:32 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Bitcoin / Development & Technical Discussion / Re: How to find the block header ? on: March 13, 2018, 06:25:35 PM
I already generated genesis hash and merkle root using this repository but after compiling and running the core it gave "assertion failed".

Then I used          printf("genesis.GetHash = %s\n", genesis.GetHash().ToString().c_str());

and hash generated from it was correct but it genrated a debug.log file which had error :-


    2018-03-13 16:48:44 ERROR: ReadBlockFromDisk: Errors in block header at CBlockDiskPos(nFile=0, nPos=8)
    2018-03-13 16:48:44 *** Failed to read block
    2018-03-13 16:48:44 Error: Error: A fatal internal error occurred, see debug.log for details

Tracing back to ReadBlockFromDisk I reached to file validation.h and found this function :-


bool ReadBlockFromDisk(CBlock& block, const CDiskBlockPos& pos, const Consensus::Params& consensusParams)
{
    block.SetNull();

    // Open history file to read
    CAutoFile filein(OpenBlockFile(pos, true), SER_DISK, CLIENT_VERSION);
    if (filein.IsNull())
        return error("ReadBlockFromDisk: OpenBlockFile failed for %s", pos.ToString());

    // Read block
    try {
        filein >> block;
    }
    catch (const std::exception& e) {
        return error("%s: Deserialize or I/O error - %s at %s", __func__, e.what(), pos.ToString());
    }

    // Check the header
    if (!CheckProofOfWork(block.GetPoWHash(), block.nBits, consensusParams))
        return error("ReadBlockFromDisk: Errors in block header at %s", pos.ToString());

    return true;
}

while tracing back to CBlockDiskPos I reached this funtion in chain.h file :-


struct CDiskBlockPos
{
    int nFile;
    unsigned int nPos;

    ADD_SERIALIZE_METHODS;

    template <typename Stream, typename Operation>
    inline void SerializationOp(Stream& s, Operation ser_action) {
        READWRITE(VARINT(nFile));
        READWRITE(VARINT(nPos));
    }

    CDiskBlockPos() {
        SetNull();
    }

    CDiskBlockPos(int nFileIn, unsigned int nPosIn) {
        nFile = nFileIn;
        nPos = nPosIn;
    }

    friend bool operator==(const CDiskBlockPos &a, const CDiskBlockPos &b) {
        return ([Suspicious link removed]ile == b.nFile && a.nPos == b.nPos);
    }

    friend bool operator!=(const CDiskBlockPos &a, const CDiskBlockPos &b) {
        return !(a == b);
    }

    void SetNull() { nFile = -1; nPos = 0; }
    bool IsNull() const { return (nFile == -1); }

    std::string ToString() const
    {
        return strprintf("CBlockDiskPos(nFile=%i, nPos=%i)", nFile, nPos);
    }

};

Now I am trying to figure out what to do next?
2  Bitcoin / Development & Technical Discussion / Re: How to find the block header ? on: March 13, 2018, 03:00:30 PM
I made some changes in chainparams.h of bitcoin core and I am trying to create genesis block. I have genesis block hash and merkel root but debug.log says hash too high

What I am actually trying to do is compare the target value with hash of genesis block header.

On running 'getblockheader' it says command not found.
3  Bitcoin / Development & Technical Discussion / How to find the block header ? on: March 13, 2018, 05:26:40 AM
I am using ubuntu and trying to get into blockchain development. I found a post on stackoverflow where a person performed the hashing of a block header and compared it with traget value. I know how to find target value from nBits but I cannot figure out how to find block header of any block so that I can also compare both to figure out whether the PoW is correct or not.

I am using Ubuntu.
4  Alternate cryptocurrencies / Altcoin Discussion / Where is debug.log file generated in litecoin or bitcoin in ubuntu? on: February 25, 2018, 11:46:54 PM
I am trying to create an altcoin by forking Litecoin.

I am following a very old thread (https://bitcointalk.org/index.php?topic=225690.0) and have made some necessary changes by my own.

I am at the step where genesis block is to be created by compiling the core and finding the original hash in debug file. But I can't find the file anywhere in ubuntu, not even in  "./altcoin" folder in home which is just empty. I also tried to find the hash by using :-

https://github.com/lhartikk/GenesisH0

but it doesn't help either.

Can anyone please tell me where the genesis block hash is generated?

Is the file name right or has it been changed recently and what is its location?
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!