Firo TESTNET is currently broken because of a smartnode payee requiring more than the coinbasevalue

Hello beautiful devs :heart:

I’m currently working on implementing FIRO inside miningcore (a very popular stratum mining pool).
I basically almost finished but i’m facing a little glitch in the matrix on the FIRO testnet.

If you look carefully at the following getblocktemplate, you will notice that there is a masternode payee which requires more amount than the coinbasevalue :poop:

{“result”:{“capabilities”:[“proposal”],“version”:536875008,“rules”:,“vbavailable”:{},“vbrequired”:0,“previousblockhash”:“02cb0e09136dba393205cc170733cfa59a8e1776730fb9c65ef80a85d23d0d6a”,“transactions”:[{“data”:“03000600000000000000fd490101002f9e01000100010ccf6465936ecad4465aa7712baf4945eb02551485f1637b40cda1258564a953320000000000000032000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000”,“txid”:“7fa9288c0da3b729a37e957c644ca3f8c7854070948554b56e41844ad5e1f3a0”,“hash”:“7fa9288c0da3b729a37e957c644ca3f8c7854070948554b56e41844ad5e1f3a0”,“depends”:,“fee”:0,“sigops”:0,“weight”:1368},{“data”:“03000600000000000000fda30101002f9e01000100038d3539ea9ed470f28e6e288759f223898e110deeb3184175e6200ed775506017fd90010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000fd900100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000”,“txid”:“e4eab31f3b1e0a86eb04925207eec9ca7b3b1e9bebf8acb6819edbc6c159c2c8”,“hash”:“e4eab31f3b1e0a86eb04925207eec9ca7b3b1e9bebf8acb6819edbc6c159c2c8”,“depends”:,“fee”:0,“sigops”:0,“weight”:1728}],“coinbaseaux”:{“flags”:“”},“coinbasevalue”:156250000,“longpollid”:“02cb0e09136dba393205cc170733cfa59a8e1776730fb9c65ef80a85d23d0d6a36”,“target”:“00ffff0000000000000000000000000000000000000000000000000000000000”,“mintime”:1686426044,“mutable”:[“time”,“transactions”,“prevblock”],“noncerange”:“00000000ffffffff”,“sigoplimit”:400000,“sizelimit”:2000000,“weightlimit”:2000000,“curtime”:1686446207,“bits”:“2000ffff”,“height”:106031,“znode”:[{“payee”:“TQpFR757b8o2r1AV4f7BCvUvejm1zFFrUX”,“script”:“76a914a2d828a0bca59007f8149a6af26e811bfc1b804b88ac”,“amount”:250000000},{“payee”:“TXAyRafTL2SUp4L6wY6bn6rAq8XR4Q5V1f”,“script”:“76a914e8944ca0633c694ef8249088594c386af232f77c88ac”,“amount”:62500000}],“znode_payments_started”:true,“znode_payments_enforced”:true,“coinbase_payload”:“02002f9e010069f53c24faeeffc307c8f451dbf4540926a4730a65aa6889d72f57ae28f9a3de2f94b1eca820a8e1e67439e7479e2845e43e0f1003f2f0374d467dd7b9fb0d18”,“pprpcheader”:“4a5750164d5e42fc7969cf31f1ceec87e455f8068957924531b1dbf78324feec”,“pprpcepoch”:81},“error”:null,“id”:0}

So every time, i try to submit block, the daemon answers rightfully: bad-txns-vout-negative

[2023-06-11 01:28:30.0887] [I] [firo1] Submitting block 106031 [1644b7b6b33540a0a1e193a33f916cc64f5ae1b10b51da2e167b0cbac2514ff1]
[2023-06-11 01:28:30.0917] [W] [firo1] Block 106031 submission failed with: bad-txns-vout-negative

It would be quite helpful if that little issue could be fixed, i would love to complete all my testing :heart:

1 Like

Thanks, I have passed this on to the devs.

2 Likes

Spoke to our dev Peter who took a quick look at it.

There is nothing wrong with the block template, the error bad-txns-vout-negative indicates there is one single entry in the block that has negative amount. If there was more funds mined in the coinbase transaction that is allowed the error code would be bad-cb-amount.

The payment of 3.125 was broken into two payments of 2.5 and 0.625 (which is correct), one of it is a operator commission that was set by the masternode operator. Amount of payment to be made to masternode is correct (2.5 + 0.625 = 3.125).

Hi Reuben,

Thanks for the reply. So what should i do exactly in order to have my block successfully submitted?

I am building the coinbase transaction with all these data and clearly: 156250000 - 250000000 = -93750000 <= bad-txns-vout-negative. Or am i missing something?

Never-mind, i think i understand now how the block reward works on FIRO. Thanks to the FAQ: FAQ | Firo - Privacy-preserving cryptocurrency :fire: :rocket:

My calculation was just wrong :slight_smile:

1 Like

Is it possible for someone to mine on the testnet, i can’t mine currently using minincore because the last block was yesterday lol

You can always trigger it by going to faucet and doing a withdrawal to get some small testnet coins.
https://testexplorer.firo.org/faucet

1 Like

Noted about the faucet trick :+1:t4:

Mission accomplished :fire: :rocket:

[2023-06-14 02:45:06.5596] [I] [firo1] Starting Pool ... 
[2023-06-14 02:45:06.5625] [I] [firo1] ExtraNonceProvider using 4 bits for instance id, 12 bits for 4095 values, instance id = 0xF 
[2023-06-14 02:45:06.5669] [I] [firo1] Starting Job Manager ... 
[2023-06-14 02:45:06.6189] [I] [firo1] All daemons online 
[2023-06-14 02:45:06.6344] [I] [firo1] All daemons synched with blockchain 
[2023-06-14 02:45:06.6394] [I] [firo1] Loading current light cache ... 
[2023-06-14 02:45:06.6394] [I] [firo1] No pre-generated cache available, creating new for epoch 81 
[2023-06-14 02:45:06.6431] [D] [firo1] Generating cache for epoch 81 
[2023-06-14 02:45:07.4341] [D] [firo1] Done generating cache for epoch 81 after 00:00:00.7905766 
[2023-06-14 02:45:07.4366] [I] [firo1] Seed hash for epoch 81 is bf544f3a8adce8002e4ec2a0af5fc0615ae1508d746c330510cde6f239796be6 
[2023-06-14 02:45:07.4366] [I] [firo1] Loaded current light cache 
[2023-06-14 02:45:07.4829] [I] [firo1] Subscribing to ZMQ push-updates from (tcp://127.0.0.1:18889, rawblock) 
[2023-06-14 02:45:07.4914] [I] [firo1] Job Manager Online 
[2023-06-14 02:45:07.5117] [D] [firo1] Subscribed to tcp://127.0.0.1:18889/rawblock 
[2023-06-14 02:45:08.5189] [I] [firo1] Pre-generating cache for epoch 82 
[2023-06-14 02:45:08.5189] [D] [firo1] Generating cache for epoch 82 
[2023-06-14 02:45:08.5434] [I] [firo1] Detected new block 106083 [INIT] 
[2023-06-14 02:45:08.5434] [I] [firo1] Broadcasting jobs 
[2023-06-14 02:45:08.5504] [D] [firo1] Loading pool stats 
[2023-06-14 02:45:08.5971] [I] [firo1] Pool Online 
[2023-06-14 02:45:08.5984] [I] [firo1] 

Mining Pool:            firo1
Coin Type:              FIRO [FIRO]
Network Connected:      TestNet
Detected Reward Type:   POW
Current Block Height:   106083
Current Connect Peers:  8
Network Difficulty:     5.9604E-08
Network Hash Rate:      0.02 H/s
Stratum Port(s):        4064, 4065
Pool Fee:               0.1%
 
[2023-06-14 02:45:08.6037] [I] [firo1] Stratum ports 0.0.0.0:4064, 0.0.0.0:4065 online 
[2023-06-14 02:45:09.3217] [D] [firo1] Done generating cache for epoch 82 after 00:00:00.8026094 
[2023-06-14 02:45:09.3217] [I] [firo1] Seed hash for epoch 82 is 851eaf8bf2dfc0087cf1ecb186d1a435fec582ffb1da52c3581e7d1a71558141
2023-06-14 02:48:59.5228] [D] [firo1] [0HMRCG5GGR7R7] [NET] Waiting for data ... 
[2023-06-14 02:48:59.5228] [D] [firo1] [0HMRCG5GGR7R7] [PIPE] Received data: {"id":204933632,"method":"mining.submit","params":["TNpnbDXCdUpobWCkXabjpokiDsntMVvowQ.ganymede","9","0xf00100000ddd8be8","0x9858a33b21a133119600b2c53ccab9d8f07990c53e01aaa4c93e0ee24608e481","0x8d70b3737eef753f4ac5e4e8eff5ddbbfa2d18239158df4658e8709cca36343f"],"worker":"ganymede"}
 
[2023-06-14 02:48:59.5228] [D] [firo1] [0HMRCG5GGR7R7] Dispatching request 'mining.submit' [204933632] 
[2023-06-14 02:48:59.5308] [I] [firo1] Submitting block 106091 [543ebc89fb46292bcff66b8a6a10fb8531669f205c4a615a86b49956b26f7dd0] 
[2023-06-14 02:48:59.5435] [I] [firo1] Daemon accepted block 106091 [543ebc89fb46292bcff66b8a6a10fb8531669f205c4a615a86b49956b26f7dd0] submitted by TNpnbDXCdUpobWCkXabjpokiDsntMVvowQ 
[2023-06-14 02:48:59.5435] [I] [firo1] [0HMRCG5GGR7R7] Share accepted: D=0.05 
[2023-06-14 02:48:59.5435] [D] [firo1] [0HMRCG5GGR7R7] Updating VarDiff 
[2023-06-14 02:48:59.5435] [D] [firo1] [0HMRCG5GGR7R7] Sending: {"result":true,"id":204933632} 
[2023-06-14 02:48:59.5435] [D] [firo1] [0HMRCG5GGR7R7] [PIPE] Waiting for data ... 
[2023-06-14 02:48:59.5435] [D] [firo1] [0HMRCG5GGR7R7] [NET] Received data: {"id":9,"jsonrpc":"2.0","method":"eth_submitHashrate","params":["0x0000000000000000000000000037ec79","0xbd98d7cfbe8e3480ebaacba79765f7cd0fe67aa3e587c7baa16fbd15956a3115"]}
 
[2023-06-14 02:48:59.5435] [D] [firo1] [0HMRCG5GGR7R7] [NET] Waiting for data ... 
[2023-06-14 02:48:59.5435] [D] [firo1] [0HMRCG5GGR7R7] [PIPE] Received data: {"id":9,"jsonrpc":"2.0","method":"eth_submitHashrate","params":["0x0000000000000000000000000037ec79","0xbd98d7cfbe8e3480ebaacba79765f7cd0fe67aa3e587c7baa16fbd15956a3115"]}
 
[2023-06-14 02:48:59.5435] [D] [firo1] [0HMRCG5GGR7R7] Dispatching request 'eth_submitHashrate' [9] 
[2023-06-14 02:48:59.5435] [D] [firo1] [0HMRCG5GGR7R7] Unsupported RPC request: {"jsonrpc":"2.0","method":"eth_submitHashrate","params":["0x0000000000000000000000000037ec79","0xbd98d7cfbe8e3480ebaacba79765f7cd0fe67aa3e587c7baa16fbd15956a3115"],"id":9,"jsonrpc":"2.0"} 
[2023-06-14 02:48:59.5435] [D] [firo1] [0HMRCG5GGR7R7] [PIPE] Waiting for data ... 
[2023-06-14 02:48:59.5435] [D] [firo1] [0HMRCG5GGR7R7] Sending: {"error":{"code":20,"message":"Unsupported request eth_submitHashrate","data":null},"id":9} 
[2023-06-14 02:48:59.5557] [I] [firo1] Detected new block 106092 [ZMQ] 
[2023-06-14 02:48:59.5557] [I] [firo1] Broadcasting jobs 
[2023-06-14 02:48:59.5557] [D] [firo1] [0HMRCG5GGR7R7] Sending: {"jsonrpc":"2.0","method":"mining.notify","params":["10","b044abad80d63a1fa5dae56cdbd5202d37dc2517dd0bac6702aa8bdda0e10d27","bf544f3a8adce8002e4ec2a0af5fc0615ae1508d746c330510cde6f239796be6","000000153feac000000000000000000000000000000000000000000000000000",true,106092,"2000ffff"],"id":null}

I had an hard time finding how to generate the blockHash but i finally figured it out: block header (bytes) + nonce (reversed bytes) + mixHash (reversed bytes) then compute/digest with sha256d.

Everything seem to work as expected. I will keep testing and then i will make all the code available on my miningcore github repository (as always). I will also post the link here for anyone interested.

Finally managed to achieve one of my main goals since i started my mining pool operator journey: Having FIRO supported :raised_hands:t4:

Thanks for the great help everyone, truly appreciated :pray:t4:

2 Likes

As promised, i share here my integration of FIRO inside miningcore: GitHub - blackmennewstyle/miningcore: Miningcore is a high-performance Mining Pool Software for Linux and Windows.

The first step is to install all the dependencies, create the database, clone the repo and compile everything. Everything is explained in the README file.

The final step is to create the proper config.json for FIRO and then run the stratum pool. Also explained in the README file, some very important additional inputs are also provided in the dedicated discussion for FIRO: Add support for FIRO (FIROPOW) · blackmennewstyle/miningcore · Discussion #5 · GitHub

Be mindful, running a stratum mining pool is very challenging, you need to be familiar with admin system concepts like networking, firewall and server administration. Be sure to test your setup.

In the meantime, you can also support my mining pool: https://firo.cedric-crispin.com/ :pick:

Enjoy the rest of your week :pray:t4: :muscle:t4:

4 Likes

Thank you so much, Cedric! Very cool of you to put all of that effort in, and to ultimately share it all with the community! :grin:
I’ve shared the news in the mining channel over on Telegram and Discord!

1 Like

You’re welcome :slight_smile: and thank you for the support :pray:t4:

1 Like