Use Bitcoin miner for Peercoin

Hi everyone,

I’m trying to start mining on my private Peercoin fork (Testnet) and I’ve choosen ntgbt miner to do it, a simple miner which exploits the RPC commands. GitHub - vsergeev/ntgbtminer: A no thrills getblocktemplate Bitcoin miner, written in Python.

It can connect with the chain, but when submitting the new block it returns an error.
Submitting manually through the RPC with “submitblock” I get “Block does not start with a coinbase” and trying to decode the transaction with “decoderawtransaction” returns “TX decode failed”.

QUESTION

I was wondering if Bitcoin miners are still compatible with Peercoin ?
If not, what is the problem with this block / transaction ?
I was thinking to make this miner compatible also for Peercoin in case this is not too complicated…

TEMPLATE
{
“capabilities”: [
“proposal”
],
“version”: 3,
“rules”: [
“csv”,
“!segwit”
],
“previousblockhash”: “00005ba98b590b60c7df80b06a892993f5dd6235e54708480019426d38c1945f”,
“transactions”: [
],
“coinbaseaux”: {
},
“coinbasevalue”: 8408120000,
“longpollid”: “00005ba98b590b60c7df80b06a892993f5dd6235e54708480019426d38c1945f2”,
“target”: “0007ffff00000000000000000000000000000000000000000000000000000000”,
“mintime”: 1624194519,
“mutable”: [
“time”,
“transactions”,
“prevblock”
],
“noncerange”: “00000000ffffffff”,
“sigoplimit”: 80000,
“sizelimit”: 4000000,
“weightlimit”: 4000000,
“curtime”: 1625761879,
“bits”: “1f07ffff”,
“height”: 1,
“default_witness_commitment”: “6a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9”
}

GENERATED BLOCK

030000005f94c1386d421900480847e53562ddf59329896ab080dfc7600b598ba95b000016e5f8cb4524b74c25af4849e2334bd66ea5f519ba92ac76f12d8d111c2fce658928e760ffff071f8d5500000101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0c010161626364656600000000ffffffff01c0ba29f5010000001976a914aeae10fcd9256bbc45f8b2a09a4e2fba7e05178f88ac00000000

BLOCK DECOMPOSITION I DID (Reference: Bitcoin Technical Guide | Simple Explanations of How Bitcoin Works)

version: 03000000

previous hash: 5f94c1386d421900480847e53562ddf59329896ab080dfc7600b598ba95b0000
merkle root: 16e5f8cb4524b74c25af4849e2334bd66ea5f519ba92ac76f12d8d111c2fce65
time: 8928e760
bits: ffff071f
nonce: 8d55000001

version:01000000

#input
count: 01
txid: 0000000000000000000000000000000000000000000000000000000000000000
ffffffff

#scriptsig
size: 0c
scriptSig: 010161626364656600000000
ffffffff

#output
count: 01
value: c0ba29f501000000
size: 19
scriptPubKey: 76 a9 14aeae10fcd9256bbc45f8b2a09a4e2fba7e05178f 88 ac #P2PKH

locktime: 00000000

NOTE

there was a similar unanswered question last year:

the tx format in peercoin is different from bitcoin. It contains the timestamp. You may have more luck setting up your own mining pool, rather than “solo” mining.

ok thanks nohea, I will try this one because nothing I’ve done so far seems to work.

EDIT: So just adding the time to the transaction will fix the compatibility problem ?

EDIT2: ok, adding timestamp does not solve, decoderawtransaction now is ok, but submitblock returns “Block decode failed - CDataStream::read(): end of data: unspecified iostream_category error”.

I used UNOMP a few years ago to do pooled mining with Peercoin and a forked chain. However that was before the Peercoin rebase on later bitcoin codebase. The tx binary format should be the same for the old and new Peercoin.
Last month i tried setup of NOMP pool software with Peercoin 0.10.x, it seems to launch but i didn’t have a SHA256 miner to test at the time.
If you are trying to fork your own, you got to learn all this stuff :sweat_smile:

it would be worth your while to look at peercoin branch of peercoin’s poolserver repository.

Ok I see the repo.
Thank you both, I’ll put my efforts on trying to set a pool. :+1:

this might be too old, but it was running the D7 ppc pool iirc: GitHub - chemicstry/poolserver: Cryptocurrency mining pool written in C++ for speed. Supports Stratum.
or this GitHub - hrobeers/poolserver: Cryptocurrency mining pool written in C++ for speed. Supports Stratum.

Thanks guys for your support, however for the moment I don’t know if I’ll have time to set up a pool since I’m running out of time with my thesis. :pray:

Thank you again, I hope you like the new Peercoin wallet UI. :iphone:

1 Like