Author

Topic: Looking for expert dev with extensive experience with Bitcoin Code [Bounty] (Read 137 times)

hero member
Activity: 595
Merit: 503
workingForBitcoins.com
Thanks guys for the feedback.

So what we are trying to do is trying to add merged mining (AuxPow) to a code base used by bitcoin/litecoin.


However, we are running into the following error:

Quote
LoadExternalBlockFile: Deserialize or I/O error - Read attempted past buffer limit: iostream error

This error comes from:

Code:
streams.h, near line 626 in the "read" method of CBufferedFile.  

When trying to read a block with AuxPow, the relevant local variables in "read" are:

Code:
nsize 32, nReadPos 755, nReadLimit 776


The code base where most of the changes happen related to this happen in block.h:

Code:
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#ifndef BITCOIN_PRIMITIVES_BLOCK_H
#define BITCOIN_PRIMITIVES_BLOCK_H

#include "primitives/transaction.h"
#include "serialize.h"
#include "uint256.h"

/** Nodes collect new transactions into a block, hash them into a hash tree,
 * and scan through nonce values to make the block's hash satisfy proof-of-work
 * requirements.  When they solve the proof-of-work, they broadcast the block
 * to everyone and the block is added to the block chain.  The first transaction
 * in the block is a special one that creates a new coin owned by the creator
 * of the block.
 */


class CAuxMerkleBranch : public CMutableTransaction
{

public:
    uint256 hashBlock;
    std::vector vMerkleBranch;
    int nIndex;

    // memory only
    mutable bool fMerkleVerified;


    CAuxMerkleBranch()
    {
        Init();
    }

    CAuxMerkleBranch(const CMutableTransaction& txIn) : CMutableTransaction(txIn)
    {
        Init();
    }

    void Init()
    {
        hashBlock = uint256();
        nIndex = -1;
        fMerkleVerified = false;
    }

    ADD_SERIALIZE_METHODS;

    template
    inline void SerializationOp(Stream& s, Operation ser_action)
    {
        READWRITE(*(CMutableTransaction*)this);
        READWRITE(hashBlock);
        READWRITE(vMerkleBranch);
        READWRITE(nIndex);
    }
};

class CPureBlockHeader
{
public:
    // header
    int32_t nVersion;
    uint256 hashPrevBlock;
    uint256 hashMerkleRoot;
    uint32_t nTime;
    uint32_t nBits;
    uint32_t nNonce;

    CPureBlockHeader()
    {
        SetNull();
    }

    ADD_SERIALIZE_METHODS;

    template
    inline void SerializationOp(Stream& s, Operation ser_action) {
        READWRITE(this->nVersion);
        READWRITE(hashPrevBlock);
        READWRITE(hashMerkleRoot);
        READWRITE(nTime);
        READWRITE(nBits);
        READWRITE(nNonce);
    }

    void SetNull()
    {
        nVersion = 0;
        hashPrevBlock.SetNull();
        hashMerkleRoot.SetNull();
        nTime = 0;
        nBits = 0;
        nNonce = 0;
    }
};


class CAuxPow: public CAuxMerkleBranch
{
public:
    CAuxMerkleBranch coinbase_branch;
    int nChainIndex;
    CPureBlockHeader parent_block;

public:
    inline explicit CAuxPow(const CMutableTransaction& txIn)
        : CAuxMerkleBranch(txIn)
    {
    }

    inline CAuxPow()
        : CAuxMerkleBranch()
    {
    }

    ADD_SERIALIZE_METHODS;

    template
    inline void SerializationOp(Stream& s, Operation ser_action) {
        READWRITE(*static_cast(this));

        READWRITE(coinbase_branch);
        READWRITE(nChainIndex);
        READWRITE(parent_block);
    }

};


class CBlockHeader
{
public:
    // header
    int32_t nVersion;
    uint256 hashPrevBlock;
    uint256 hashMerkleRoot;
    uint32_t nTime;
    uint32_t nBits;
    uint32_t nNonce;
    CAuxPow auxpow;

    CBlockHeader()
    {
        SetNull();
    }

    ADD_SERIALIZE_METHODS;

    template
    inline void SerializationOp(Stream& s, Operation ser_action) {
        READWRITE(this->nVersion);
        READWRITE(hashPrevBlock);
        READWRITE(hashMerkleRoot);
        READWRITE(nTime);
        READWRITE(nBits);
        READWRITE(nNonce);
        if (this->nVersion == 6422786) {
            READWRITE(auxpow);
        }
    }

    void SetNull()
    {
        nVersion = 0;
        hashPrevBlock.SetNull();
        hashMerkleRoot.SetNull();
        nTime = 0;
        nBits = 0;
        nNonce = 0;
    }

    bool IsNull() const
    {
        return (nBits == 0);
    }

    uint256 GetHash() const;

    uint256 GetPoWHash() const;

    int64_t GetBlockTime() const
    {
        return (int64_t)nTime;
    }
};


class CBlock : public CBlockHeader
{
public:
    // network and disk
    std::vector vtx;

    // memory only
    mutable bool fChecked;

    CBlock()
    {
        SetNull();
    }

    CBlock(const CBlockHeader &header)
    {
        SetNull();
        *((CBlockHeader*)this) = header;
    }

    ADD_SERIALIZE_METHODS;

    template
    inline void SerializationOp(Stream& s, Operation ser_action) {
        READWRITE(*(CBlockHeader*)this);
        READWRITE(vtx);
    }

    void SetNull()
    {
        CBlockHeader::SetNull();
        vtx.clear();
        fChecked = false;
    }

    CBlockHeader GetBlockHeader() const
    {
        CBlockHeader block;
        block.nVersion       = nVersion;
        block.hashPrevBlock  = hashPrevBlock;
        block.hashMerkleRoot = hashMerkleRoot;
        block.nTime          = nTime;
        block.nBits          = nBits;
        block.nNonce         = nNonce;
        return block;
    }

    std::string ToString() const;
};

/** Describes a place in the block chain to another node such that if the
 * other node doesn't have the same branch, it can find a recent common trunk.
 * The further back it is, the further before the fork it may be.
 */
struct CBlockLocator
{
    std::vector vHave;

    CBlockLocator() {}

    CBlockLocator(const std::vector& vHaveIn)
    {
        vHave = vHaveIn;
    }

    ADD_SERIALIZE_METHODS;

    template
    inline void SerializationOp(Stream& s, Operation ser_action) {
        int nVersion = s.GetVersion();
        if (!(s.GetType() & SER_GETHASH))
            READWRITE(nVersion);
        READWRITE(vHave);
    }

    void SetNull()
    {
        vHave.clear();
    }

    bool IsNull() const
    {
        return vHave.empty();
    }
};

/** Compute the consensus-critical block weight (see BIP 141). */
int64_t GetBlockWeight(const CBlock& tx);

#endif // BITCOIN_PRIMITIVES_BLOCK_H

legendary
Activity: 1750
Merit: 1115
Providing AI/ChatGpt Services - PM!
Need some help resolving an issue with a code updated.

This is a very advanced technical issue, and I need an expert to help. You must have a pretty good understanding and grasp of the Bitcoin source could to be able to help.


0.01 BTC For dev who helps resolve the issue.


0.01 ? What  makes you think someone with advanced level knowledge in bitcoin source code will even give you their 10 minutes for 0.01 bitcoins ? Be little practical man!You are not hiring a html/css designer,you're hiring someone who's expert at Bitcoin Core and there are very few people who can do that.

I reckon it will take only 1-2 hours. I'm not asking for any development, just some explanation and guidance. Thats $140, and buying it from Coinbase I will likely pay $150. 
That sounds reasonable then.I'm not very acquainted with every part of the source code but since I'm coming from a software background,I can tell I will likely be able to help you understand what's going on.Maybe you should send me a message.And of-course I will not be expecting any payments to explain you a part of the source code.
member
Activity: 276
Merit: 48
Maybe if you explain the issue someone would be willing to jump in and share their knowledge at no cost at all. You can also try the "Technical" discussion board which may have more answers relevant to your inquiry.
hero member
Activity: 595
Merit: 503
workingForBitcoins.com
I'm willing to pay more, if it takes longer too, I'm not trying to be unreasonable.
hero member
Activity: 595
Merit: 503
workingForBitcoins.com
Need some help resolving an issue with a code updated.

This is a very advanced technical issue, and I need an expert to help. You must have a pretty good understanding and grasp of the Bitcoin source could to be able to help.


0.01 BTC For dev who helps resolve the issue.


0.01 ? What  makes you think someone with advanced level knowledge in bitcoin source code will even give you their 10 minutes for 0.01 bitcoins ? Be little practical man!You are not hiring a html/css designer,you're hiring someone who's expert at Bitcoin Core and there are very few people who can do that.

I reckon it will take only 1-2 hours. I'm not asking for any development, just some explanation and guidance. Thats $140, and buying it from Coinbase I will likely pay $150. 
legendary
Activity: 1750
Merit: 1115
Providing AI/ChatGpt Services - PM!
Need some help resolving an issue with a code updated.

This is a very advanced technical issue, and I need an expert to help. You must have a pretty good understanding and grasp of the Bitcoin source could to be able to help.


0.01 BTC For dev who helps resolve the issue.


0.01 ? What  makes you think someone with advanced level knowledge in bitcoin source code will even give you their 10 minutes for 0.01 bitcoins ? Be little practical man!You are not hiring a html/css designer,you're hiring someone who's expert at Bitcoin Core and there are very few people who can do that.
hero member
Activity: 595
Merit: 503
workingForBitcoins.com
Need some help resolving an issue with a code updated.

This is a very advanced technical issue, and I need an expert to help. You must have a pretty good understanding and grasp of the Bitcoin source could to be able to help.


0.01 BTC For dev who helps resolve the issue.

Jump to: