Search content
Sort by

Showing 20 of 31 results by liorko87
Post
Topic
Board Mining (Altcoins)
Topic OP
Block failed to accept after changing block header
by
liorko87
on 28/02/2022, 10:10:06 UTC
I'm creating an altcoin for research proposal based on bitcoin v0.21. I added two fields to the block header:

Address ID (bech32/base58)
Signature
Both fields are string type.

I'm creating new blocks by using cpuminer (solo mining). The mining is done by calling submitblock RPC call. During the mining I'm getting the exception: Block decode failed which means that the server cannot deserialize the block.
When I'm printing the exception at DecodehexBlk the error that printed is
Code:
CDataStream::read(): end of data: iostream error

When I'm creating a block by calling generatetoaddress RPC call, the block is accepted to the blockchain.
Post
Topic
Board Altcoin Discussion
Re: *** Complete Guide on How to Create a New Alt Coin – Update 2019 ***
by
liorko87
on 29/09/2021, 06:39:55 UTC
@Toki.Fujinami which software are you using in order to mine?
Post
Topic
Board Altcoin Discussion
Topic OP
Fee exceeds maximum configured by user
by
liorko87
on 11/08/2021, 12:00:15 UTC
I created an altcoin for research purposes.
When I'm trying to send a transaction I'm receiving this error:
Code:
Fee exceeds maximum configured by user (e.g. -maxtxfee, maxfeerate)

I tried to set a fee as the second argument but the problem still exists.
When I debugged it, I can see that the max_tx_fee is calculated from the vsize of the transaction.

How can I overcome this error?




Post
Topic
Board Altcoin Discussion
Topic OP
Altcoin difficulty does not updated
by
liorko87
on 29/06/2021, 14:03:22 UTC
I created an altcoin for research purposes based on Bitcoin 0.21.
For some reason the difficulty is still 1 after 450 block created.
The rate of my blocks is 1 blocks per 1.5 minutes instead of 1 block per 10 minutes as in Bitcoin.

Does anyone has a clue why it's happen?
Post
Topic
Board Development & Technical Discussion
Re: New RPC- Paramaters are not parsed correctly
by
liorko87
on 31/05/2021, 11:50:37 UTC
Ignore my last message, the error occurred because my for loop, when I deleted it, the error disappeared.
Thank you for your kind help!
Post
Topic
Board Development & Technical Discussion
Re: New RPC- Paramaters are not parsed correctly
by
liorko87
on 31/05/2021, 11:22:53 UTC
I never thought even looking there!
Now he notify me about another error:

Code:
error code: -1
error message:
JSON value is not a string as expected
Post
Topic
Board Development & Technical Discussion
Re: New RPC- Paramaters are not parsed correctly
by
liorko87
on 31/05/2021, 10:14:39 UTC
This is the updated code:

Code:
for (int i = 0; i < request.params.size(); i++) {
        std::cout << "param value: " << request.params[i].get_str() << " param type: " <<
            request.params[i].getType() << std::endl;
    }
    std::cout << "inside function" << std:: endl;
    const int64_t num_blocks{request.params[0].get_int64()};
    const uint64_t max_tries{request.params[3].isNull() ? DEFAULT_MAX_TRIES : request.params[3].get_int64()};

For me the getType() function redirects to UniValue class at:
https://github.com/bitcoin/bitcoin/blob/master/src/univalue/include/univalue.h#L64
Type 3 is VSTR according to the VType enum
Post
Topic
Board Development & Technical Discussion
Re: New RPC- Paramaters are not parsed correctly
by
liorko87
on 31/05/2021, 08:50:26 UTC
I'm not trying to pass a JSON at all.
This is the CLI call from the terminal:

Code:
./bitcoin-cli --datadir=<path_to_my_datadir> mycustomrpc 1 abc abc
Post
Topic
Board Development & Technical Discussion
Re: New RPC- Paramaters are not parsed correctly
by
liorko87
on 31/05/2021, 08:33:01 UTC
This is the beginning of the function, it fails in the parsing parameters

Code:
const int64_t num_blocks{request.params[0].get_int64()};
const uint64_t max_tries{request.params[3].isNull() ? DEFAULT_MAX_TRIES : request.params[3].get_int64()};
std::string str1 = request.params[2].get_str();
CTxDestination destination = DecodeDestination(request.params[1].get_str());
...
Post
Topic
Board Development & Technical Discussion
Re: New RPC- Paramaters are not parsed correctly
by
liorko87
on 31/05/2021, 08:27:57 UTC
I checked it in the debugger and it says it for the first parameter
Post
Topic
Board Development & Technical Discussion
Merits 2 from 1 user
Topic OP
New RPC- Paramaters are not parsed correctly
by
liorko87
on 31/05/2021, 08:22:32 UTC
⭐ Merited by NotATether (2)
I wrote a new RPC and my parameters are not parsed correctly.
This is the definition of the RPCHelpMan:

Code:
return RPCHelpMan{"mycustomrpc",
                "\nchange definitions(before the RPC call returns)\n",
                {
                    {"Param1", RPCArg::Type::NUM, RPCArg::Optional::NO, ""},
                    {"Param2", RPCArg::Type::STR, RPCArg::Optional::NO, ""},
                    {"Param3", RPCArg::Type::STR, RPCArg::Optional::NO, ""},
                    {"Param4", RPCArg::Type::NUM, /* default */ ToString(1000), "How many iterations to try."}
                },
                RPCResult{
                    RPCResult::Type::ARR, "", "",
                    {
                        {RPCResult::Type::STR_HEX, "", "param"},
                    }},
                RPCExamples{
            "\nChange definitions to bitcoin core\n"
            + HelpExampleCli("generatetoaddresswithminer", "param1 \"param2\" \"param3\" ")
                },
        [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue

When I'm running this command from my CLI, I got this error:

Code:
error code: -1
error message:
JSON value is not an integer as expected

Can someone tell me what's wrong in the function definition?
Post
Topic
Board Development & Technical Discussion
Re: ScriptHash to CKeyID
by
liorko87
on 25/05/2021, 07:42:03 UTC
@NotATether I missed your comment yesterday, thank you for your help, it solved my problem.
Post
Topic
Board Development & Technical Discussion
Re: ScriptHash to CKeyID
by
liorko87
on 24/05/2021, 15:01:54 UTC
According to DecodeBase58Check signature it's returns bool and not hash160:

Code:
bool DecodeBase58Check(const std::string& str, std::vector<unsigned char>& vchRet, int max_ret)

Did you meant to the vchRet
Post
Topic
Board Development & Technical Discussion
Re: ScriptHash to CKeyID
by
liorko87
on 24/05/2021, 14:18:33 UTC
The address is P2SH.
DecodeAddressDestination is a function that I added to base58.cpp. I added the implementation.

Code:
CTxDestination DecodeAddressDestination(const std::string& str, const std::vector<unsigned char>& pubkey_prefix) {
        std::vector<unsigned char> data;
        uint160 hash;
        if (DecodeBase58Check(str, data, 256)) {

        // base58-encoded Bitcoin addresses.
        // Public-key-hash-addresses have version 0 (or 111 testnet).
        // The data vector contains RIPEMD160(SHA256(pubkey)), where pubkey is the serialized public key.
        if (data.size() == hash.size() + pubkey_prefix.size() &&
        std::equal(pubkey_prefix.begin(), pubkey_prefix.end(), data.begin())) {
            std::copy(data.begin() + pubkey_prefix.size(), data.end(), hash.begin());
            return ScriptHash(hash);
            }
        }
        return CNoDestination();
}
Post
Topic
Board Development & Technical Discussion
Merits 4 from 3 users
Topic OP
ScriptHash to CKeyID
by
liorko87
on 24/05/2021, 09:47:34 UTC
⭐ Merited by NotATether (2) ,ETFbitcoin (1) ,Heisenberg_Hunter (1)
I have a valid base58 address that I got using getnewaddress command.
I'm trying to convert it to CKeyID object but I have some difficulties.

The problematic code:

Code:
string sKey = "my_address"; // it's not the real address
std::vector<unsigned char> prefix = std::vector<unsigned char>(1,5);
CTxDestination dest = ::DecodeAddressDestination(sKey, prefix);
CScript script = GetScriptForDestination(dest);
CKeyID key = CKeyID(script);

At the debugging I can see that dest value is ScriptHash
What I'm doing wrong?
Post
Topic
Board Altcoin Discussion
Topic OP
New blocks aren't saved to disk
by
liorko87
on 28/04/2021, 13:06:41 UTC
I created a bitcoin fork and when I'm shutting down my bitcoind server, the blocks sometimes aren't saved to my local disk.
When I'm starting the server again, some of the blocks that I saw before are missing.

Anyone has a clue?
Post
Topic
Board Altcoin Discussion
Re: *** Complete Guide on How to Create a New Alt Coin – Update 2019 ***
by
liorko87
on 28/04/2021, 12:57:02 UTC
@isp92074 don't activate SegWit at the beginning.
Post
Topic
Board Altcoin Discussion
Re: *** Complete Guide on How to Create a New Alt Coin – Update 2019 ***
by
liorko87
on 08/04/2021, 11:18:19 UTC
How are you mining? via generatetoaddress or a miner?
Post
Topic
Board Altcoin Discussion
Re: *** Complete Guide on How to Create a New Alt Coin – Update 2019 ***
by
liorko87
on 21/03/2021, 08:00:49 UTC
@isp92074 I had the same error, please check that SegWit height is not 1.
At the beginning try to leave the SegWit height as is.
Post
Topic
Board Altcoin Discussion
Re: *** Complete Guide on How to Create a New Alt Coin – Update 2019 ***
by
liorko87
on 11/03/2021, 13:46:17 UTC
Hi
I read your excellent tutorial and I have a problem to sync between two nodes.
At one node I manage to generate 10 blocks but the second node does not see those blocks.
The two nodes run on my localhost.

I'm using bitcoin v0.21 and the SegWith activation height is 2000