Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: Coding Enthusiast on March 24, 2020, 08:18:03 AM



Title: Is there any online (web) tool where I could broadcast a new block I mined?
Post by: Coding Enthusiast on March 24, 2020, 08:18:03 AM
I have a transaction stuck in TestNet which is not being mined, so I decided to mine it myself.
The problem is that Denovo's P2P network implementation is incomplete so I can't broadcast the block I find, which is why I'm looking for a workaround to broadcast that block.

Code:
Mining...
Finished
elapsed time: 00:02:49.4430433
block height: 1670930
block header: 000000207afc873c6dd49c55a8ec591947e65ea8e3c993f67ba5e5f8b522e35e000000007fbb3f2100ca7f1af3dc16b448f3a94f0e0556a4c86fb6a1f6fa316ebc615df81dc0795effff001d1418859f
block hash: 00000000eadf03548790f5aefd32f4c11b131b29229664a9a039fd1ad3466ea3


Title: Re: Is there any online (web) tool where I could broadcast a new block I mined?
Post by: TheBeardedBaby on March 24, 2020, 08:27:10 AM
I don't think you going to get much of support here,this section it's mostly for discussions and your question will drown quickly in the sea of spam. Better move your thread in this section > Bitcoin Technical Support  (https://bitcointalk.org/index.php?board=4.0).


Title: Re: Is there any online (web) tool where I could broadcast a new block I mined?
Post by: ABCbits on March 24, 2020, 12:45:48 PM
I never try it, but Bitcoin Core console have command called submitblock which used to submit new block to network.

Here's help information from Bitcoin Core.

Code:
submitblock "hexdata" ( "dummy" )

Attempts to submit new block to network.
See https://en.bitcoin.it/wiki/BIP_0022 for full specification.

Arguments:
1. hexdata    (string, required) the hex-encoded block data to submit
2. dummy      (string, optional, default=ignored) dummy value, for compatibility with BIP22. This value is ignored.

Examples:
> bitcoin-cli submitblock "mydata"
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "submitblock", "params": ["mydata"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/


Title: Re: Is there any online (web) tool where I could broadcast a new block I mined?
Post by: Coding Enthusiast on March 24, 2020, 01:13:33 PM
Doesn't submitblock command require the node to be fully synced? I remember reading that it first "verifies" the block before broadcasting it which would require being synced.


Title: Re: Is there any online (web) tool where I could broadcast a new block I mined?
Post by: jackg on March 25, 2020, 11:56:34 PM
Block explorers don't seem to like the idea of pushing blocks, I had a quick look at smartbit and blockchain.com and neither seem very happy with it.

You can push a hex transaction but I'm guessing you're after pushing the entire block for experimental purposed, in which case, what etf suggested might be your best option, I think the testnet blockchain is similar to the size of the litecoin blockchain and on my dual core 2GHz laptop, it seemed to take only about 8 hours to download and store the entire thing. It's not the best but if you really need it it's not that bad - load it up before sleep and wake up with the full sync.


Title: Re: Is there any online (web) tool where I could broadcast a new block I mined?
Post by: Coding Enthusiast on March 26, 2020, 04:45:37 AM
what HCP suggested might be your best option,
Did you mean "ETFbitcoin" or was one comment deleted?

I think the testnet blockchain is similar to the size of the litecoin blockchain and on my dual core 2GHz laptop, it seemed to take only about 8 hours to download and store the entire thing. It's not the best but if you really need it it's not that bad - load it up before sleep and wake up with the full sync.
That is 22.5 GB blockchain, ignoring the chainstate. It's a bit high just to broadcast one block, not to mention eventually I am going to download it with my own code as soon as I can fix my P2PNetwork namespace which is why I don't want to do it twice.


Title: Re: Is there any online (web) tool where I could broadcast a new block I mined?
Post by: ABCbits on March 26, 2020, 07:36:23 AM
I think the testnet blockchain is similar to the size of the litecoin blockchain and on my dual core 2GHz laptop, it seemed to take only about 8 hours to download and store the entire thing. It's not the best but if you really need it it's not that bad - load it up before sleep and wake up with the full sync.
That is 22.5 GB blockchain, ignoring the chainstate. It's a bit high just to broadcast one block, not to mention eventually I am going to download it with my own code as soon as I can fix my P2PNetwork namespace which is why I don't want to do it twice.

That's certainly wasteful of resource (especially if you have slow connection), i assume software you use can't connect to Bitcoin Core client?


P.S. i have fully synced testnet full node (originally used to learn more about Bitcoin, but eventually only used to test LN in past), PM me if you trust me to broadcast it.


Title: Re: Is there any online (web) tool where I could broadcast a new block I mined?
Post by: Coding Enthusiast on March 26, 2020, 07:56:10 AM
That's certainly wasteful of resource (especially if you have slow connection), i assume software you use can't connect to Bitcoin Core client?

P.S. i have fully synced testnet full node (originally used to learn more about Bitcoin, but eventually only used to test LN in past), PM me if you trust me to broadcast it.

Thanks for the offer.
The problem is not trust though since it is TestNet and it is a block, the problem is that I'm already wasting a lot of time starting to mine the next block and by the time I copy the result and send it to you it could be already too late and you could end up in a "fork".
I've already sent you a block (#1671095) I found in ~5 min in PM though. Edit: ... someone else found the same block after 20 minutes. :D


Title: Re: Is there any online (web) tool where I could broadcast a new block I mined?
Post by: DaveF on March 28, 2020, 12:22:38 AM
Similar to what ETFBitcoin said, in theory if I setup a full testnet node and opened the ports and gave you the RPC name and password could you do it that way?
Not sure if that would work for you. Also, not sure where the VM with the testnet node is but that would just take a little bit of looking on the VM server :-)

-Dave


Title: Re: Is there any online (web) tool where I could broadcast a new block I mined?
Post by: ABCbits on March 28, 2020, 11:25:53 AM
Similar to what ETFBitcoin said, in theory if I setup a full testnet node and opened the ports and gave you the RPC name and password could you do it that way?
Not sure if that would work for you. Also, not sure where the VM with the testnet node is but that would just take a little bit of looking on the VM server :-)

-Dave

There's major security concern if you enable RPC connection over internet, see https://github.com/bitcoin/bitcoin/blob/master/doc/JSON-RPC-interface.md#security (https://github.com/bitcoin/bitcoin/blob/master/doc/JSON-RPC-interface.md#security)


Title: Re: Is there any online (web) tool where I could broadcast a new block I mined?
Post by: DaveF on March 28, 2020, 12:42:08 PM
Similar to what ETFBitcoin said, in theory if I setup a full testnet node and opened the ports and gave you the RPC name and password could you do it that way?
Not sure if that would work for you. Also, not sure where the VM with the testnet node is but that would just take a little bit of looking on the VM server :-)

-Dave

There's major security concern if you enable RPC connection over internet, see https://github.com/bitcoin/bitcoin/blob/master/doc/JSON-RPC-interface.md#security (https://github.com/bitcoin/bitcoin/blob/master/doc/JSON-RPC-interface.md#security)

Yes and no.
If I only allow Coding's IPs then it's mitigated and with a long complex username / password it's mitigated a bit more

But in the end it's a VM just running bitcoin in testnet so even if it gets trashed I really don't care.
Probably going to spin up a new one anyway because as pathetic as this next line is it's true:
I can't find it......Somewhere someplace I have a virtual drive image with nothing but Win10 and bitcoin on it set to testnet. Not sure where it is at the moment.

-Dave


Title: Re: Is there any online (web) tool where I could broadcast a new block I mined?
Post by: Coding Enthusiast on March 30, 2020, 04:30:05 AM
Thanks Dave for the offer, I really appreciate it.
@ETFbitcoin helped me find a mistake in my difficulty assessment which makes it a bit harder for me to find blocks in a competing way. I still haven't had time to fix that part. I will post an update here if I could successfully fix it in which case I may be able to broadcast it myself since the bug doesn't seem to be with my P2PNetwork implementation anymore.


Title: Re: Is there any online (web) tool where I could broadcast a new block I mined?
Post by: Coding Enthusiast on September 28, 2020, 09:16:54 AM
It took me some time but I finally fixed most of the issues I had with my P2PNetwork implementation so I could come back to this today to mine and submit my first block to TestNet blockchain.
Block #1,836,446 https://tbtc.bitaps.com/1836446
Block version is weird because it is copied from previous block, the block is empty because I don't have any mempool yet and it is just an experiment at this point.
Going to test more things now on TestNet, I'll probably submit some of my RegTest block experiments here too.

Thanks again for your help guys.

P.S. Interesting thing was that core nodes that I connected to sent me back the same block as Inv message for some reason (highest version was 0.19.0.1).


Title: Re: Is there any online (web) tool where I could broadcast a new block I mined?
Post by: HCP on September 30, 2020, 10:41:12 PM
Out of curiosity, how did you actually mine the block? ???

Did you just manually construct one, then started hashing until you found a nonce that fit the lowest difficulty and waited until a block had not been found for a while and the difficulty reset before broadcasting? (Possibly having to rehash if a new block was broadcast in the meantime)

Or are you running a more "traditional" mining setup with a CPU/GPU/ASIC miner and just got "lucky" with the TestNet difficulty? ???


Title: Re: Is there any online (web) tool where I could broadcast a new block I mined?
Post by: Coding Enthusiast on October 01, 2020, 04:52:19 AM
Out of curiosity, how did you actually mine the block? ???

Did you just manually construct one, then started hashing until you found a nonce that fit the lowest difficulty and waited until a block had not been found for a while and the difficulty reset before broadcasting? (Possibly having to rehash if a new block was broadcast in the meantime)

Or are you running a more "traditional" mining setup with a CPU/GPU/ASIC miner and just got "lucky" with the TestNet difficulty? ???
No, this is my own implementation of Bitcoin protocol and since at this point the library part (Bitcoin.Net) is almost finished I'm testing parts that don't have unit tests while improving the API.
It is a modified miner using only 2 of CPU cores and I run it only when I'm trying to create new test vectors like my last commit (https://github.com/Autarkysoft/Denovo/commit/118ecbb19c09f0954a09dfb94d3e9ff847f44e30). I'll probably add GPU support when I start adding GPU support to FinderOuter.
As for difficulty, I'm simply manipulating it to submit my test blocks. I still have to get lucky to find a good block since I don't produce that much hashrate but it is easier.