Bitcoin Forum
August 29, 2024, 08:23:25 PM *
News: Latest Bitcoin Core release: 27.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2]  All
  Print  
Author Topic: Requesting Testnet4 tBTC  (Read 469 times)
BlackHatCoiner
Legendary
*
Offline Offline

Activity: 1624
Merit: 7972


Bitcoin is a royal fork


View Profile WWW
Today at 08:14:59 AM
Merited by vjudeu (1)
 #21

Test coins are weird: some of them are free, some of them are burned.
Both the "free" and the "burned" link to the same transaction. I get that the coinbase reward is burned, because it is sent to OP_RETURN, but where are the free coins?

Of course, for CPU-based mining, some modifications are needed, but I think grinding coins with bitcoin-util should still be possible. I will think about some kind of such implementation.
What's the recommended way to mine testnet4 with CPU? Is it possible directly from Core with generatetoaddress? And, is there mining software for testnet that is configurable with GPUs?

LoyceV
Legendary
*
Offline Offline

Activity: 3416
Merit: 17295


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
Today at 08:30:17 AM
Merited by BlackHatCoiner (4), vjudeu (1)
 #22

Test coins are weird: some of them are free, some of them are burned.
Both the "free" and the "burned" link to the same transaction.
They have different txids:
"free": 8f4cf55da2abc21ac4f5d176bd5aefcfdc91852343dbfe91215d7c8afa966baf
"burned": c3750456a633ddc6493b26fd5ef288b339e84f231f31128fd6d84276b8871abf

vjudeu
Hero Member
*****
Offline Offline

Activity: 825
Merit: 1977



View Profile
Today at 08:35:52 AM
Merited by LoyceV (6), BlackHatCoiner (4)
 #23

Quote
Can you explain this one?
Those coins were sent to OP_TRUE. Which means, that anyone could sweep them, as it was done here: https://mempool.space/testnet4/tx/09096e1e6fb31f33f3de40b9a1d76908e565e9646e5aed4e0813e0a2a799fc4c

As you can see, no signatures were provided.

Similar case was in https://mempool.space/testnet4/tx/3a72c025a8995fe94af9ec00d61046f55fe18133ebb98f290f81aa68f3bc8fc1
The previous script was simply OP_TRUE, but that one was P2WSH, with OP_TRUE, which made it standard.

Quote
Both the "free" and the "burned" link to the same transaction.
Huh?

First link: https://mempool.space/testnet4/tx/8f4cf55da2abc21ac4f5d176bd5aefcfdc91852343dbfe91215d7c8afa966baf
Second link: https://mempool.space/testnet4/tx/c3750456a633ddc6493b26fd5ef288b339e84f231f31128fd6d84276b8871abf

They are different. But yes, those free coins are now taken, so you have to find something else.

Quote
What's the recommended way to mine testnet4 with CPU?
The easiest way is to make two small changes in the source code, and just recompile it. But there are also other ways.

Quote
Is it possible directly from Core with generatetoaddress?
Yes, if your Bitcoin Core implementation will always give you the block template, moved forward by 20 minutes.

Quote
And, is there mining software for testnet that is configurable with GPUs?
You have regular Bitcoin Core node. You can connect CPUs, GPUs, FPGAs, ASICs, whatever. The most difficult part is to get the block header, which has the minimal difficulty. For example, if you call "getblocktemplate", you should see this:
Code:
$ ./bitcoin-cli -testnet4 getblocktemplate '{"rules": ["segwit"]}'
{
  "capabilities": [
    "proposal"
  ],
  "version": 536870912,
  "rules": [
    "csv",
    "!segwit",
    "taproot"
  ],
  "vbavailable": {
  },
  "vbrequired": 0,
  "previousblockhash": "00000000000000308df706a8736dfe78eee7cea416adc1dc5bfcf4bc11202f6c",
  "transactions": [
    {
      "data": "020000000001047ce0d3213f28576ae83c57b920f4e20538d5e6d4e07ca488385aa0f1931e64110000000000fdffffff248aa47fdced15c751d2d300f1cb31ffef9d2f3a49215f6532104a1c78038f410100000000fdffffffb40af33649e7adf8e7efd2b1f01a2bee16ba1586b1a4e572b3c18f47d98f598e0000000000fdffffff2aad614089f83012a5975c807eb903fdb3ee83c843a6612186de6290c79520ce0100000000fdffffff02534d09000000000017a9145902315224c25891835b6821cd1cdc551de83238870e800a00000000001976a91498bde795388b03245d24953077dab58b24a7293488ac024730440220492f752d2b5ed7e0f0315ae1a6bd801488d88ffe340dfe9601b8918463bdfb0f022038a58690c81d4b071ac723936087af0317b2f226483e76b08c99ed7191ddef6d012102685699ed77f94e735d50f82eb4c11d40b864becb9743de95abf7ef8f29445d6c0247304402203704695217a419dce8c47cfa1bf206cf17f73a9c61b86b364f5b4c0c4371ddcb02207a2730ac55198033d4559a1ddf937f842c77e74026423d39a8441199fd8af57d012103be9522eaa49f32cd3eb559ea3c3187b3559043a720ceda1a215ac3405b40cce00247304402200b4e0ba529ad8c4568144fb081d3cb737b11af330fe03951d48787beef37761602201323dea016586094b45002a78dcceb4ad25eb48cf0341fd99727230648dc00da012103780699159f1a6f5242348bc8d61f58d3bd7b00c78a0d40fd7f2e57a178b379690247304402205fb3f7174e98b469d707246e3d62913066ae23bd17fc5429978500dd9508d009022049d2abcd23e3c78244b6cc9a8563ca783fda57d080b81ac4bd0af9359650418b012102d9e9ddd6c2ea0dc6c057a04e50e8d0915e9cd01c0e96b9502b04da269dd43dcca9a20000",
      "txid": "ff162dc6fcf24922a43662e445f7a0ddaec61dece249f4e01364696802bd9aee",
      "hash": "ecaba0fa0b919a167fbeee188ae394822e8e2e26d779df4c4132093fc7642797",
      "depends": [
      ],
      "fee": 605,
      "sigops": 8,
      "weight": 1390
    },
    {
      "data": "0200000000010295698b94fc9021b4b2a62dbb11e23acde77acf48ce8ce027332e81df15d4f7810000000000fdffffffecd68f83a2c9b4c76f6ec81990423ecad0bf5a513f58bb6e6f69e6872e6da2ee0200000000fdffffff020e800a00000000001976a914ff47820227d99093460b37f9616091a7ddb3e56688ac534d09000000000017a914ca2943e61732f9efd9cdf561c23fde303da03791870247304402205906443248e791515dad9bd35faccd3f07c88dc85a87c7eddc7b949419baea1902203beec98f1ff929b03641f45f1ee360e23e5ad20f9a0d7ef33fccb7e9918509da0121032a9c67647bf7d3b1ccf1965af9fd177c1abab097c0cbd5aaa59c195c7f07736302473044022034a08ba1de8e51bd59391682052c003a1360f10cd6e8b7353f10315afa27227202201c52da6a6e9813633153ffb711a95241b04c794e35029d1e26ef1553e6029aa50121032566f685bf194f85fa25617adbbaa174d2ef463d1ff9500d6704523243ada098a9a20000",
      "txid": "fb743188fee53fb54e4a839a176e37d74209a5eaf0df20513e16005147a7c5a3",
      "hash": "80e7071bac1b5ac08a8ddfe4c13dc29e0c1d7063a884de9703e51b28fb71ad9f",
      "depends": [
      ],
      "fee": 255,
      "sigops": 6,
      "weight": 848
    },
    {
      "data": "02000000000101d4c733a3d78574af8a5f8242f036f0529b8cdf049504f532f3cb4376a53876950100000000fdffffff03f70100000000000022512010397b2d4a2d4a67d55ccaee88c0e8e92c7f38aeebf4ca0e40499962586309a9ec030000000000002251205ae432a8aa5e7aa98d47c74a28390db89edec262d4e2ca1f6b41704495c01d4bb28a070000000000225120d2912b91d0802aa584f4c8ff364f9bb2d5af103368fef4c61584b34f1f081f8b01407848bd0612823ee11f6153ac354f91238cf9c9db66a60a234fbf1f43d3749228e1a1475eae46f66cf5606f262be605383268fe608ab25cb7c0458684cba6149c00000000",
      "txid": "9e5fd8b8a6d206db9117852e9fecb54a1792be229c09c004912e9f2d455d49b1",
      "hash": "464504217e5bcd3ddce9d6db8adc1ac3f65af434cfc6e1094ae03e6420b9ced5",
      "depends": [
      ],
      "fee": 197,
      "sigops": 0,
      "weight": 788
    },
    {
      "data": "02000000000101b1495d452d9f2e9104c0099c22be92174ab5ec9f2e851791db06d2a6b8d85f9e0000000000fdffffff014a01000000000000225120d2912b91d0802aa584f4c8ff364f9bb2d5af103368fef4c61584b34f1f081f8b03406bbe431da4a0931ee616f95c5f00d4ac4ed3828abd2b46c029a11ea5b2cc0ab1eae3bab0ee977409deaa1b598f5fdb5e4a4ec740b7cacc7960cf77fe139d6e0bab206a11672055d3ad2b612dc3372a7101f402816920842ce10c1aeeff3de093c72fac0063036f7264010118746578742f706c61696e3b636861727365743d7574662d38004c647b2270223a22736e73222c226f70223a22757064617465222c226e616d65223a2268657265222c22706572736f6e616c5f6e616d65223a2279697a68656e66656e67222c22706572736f6e616c5f64657363223a2231323334203837363520313638227d6821c16a11672055d3ad2b612dc3372a7101f402816920842ce10c1aeeff3de093c72f00000000",
      "txid": "7f551414f35e270415de3199396c93a097fd65264e805b2d0213c08c6bcfaa85",
      "hash": "bb8c41b018f6c4539102be484c5ad1326adf1ab152a58e6d123c78f0f896943d",
      "depends": [
        3
      ],
      "fee": 173,
      "sigops": 0,
      "weight": 650
    },
    {
      "data": "0200000002df830a452b60b91173357cd5bdb326f880f88b385ab97b950f26e8bc5a2a941e000000006a4730440220096855154d1fcdfc6dab47daac98579924f334bb444c735d0bfa75b009511872022074de7516dc8618c50173be6d15030774d18a6cbfcf508f1f2c9893a1980ffda70121026261f23b0f4f8009fd41437b547a3e50f4fddf34e8eeeb9524151d79e0f8c4ccfdffffff2efe099bcb6a8240891fd0f1ac2b4b79d00d20a36490901f7fd4d02f533bba17010000006a47304402202fec5222ad4bb68992f5edd0185bbfce61aadf03b12875993335adc461596f73022038bfe361f226548743bb7f56f827012221e7317796ace2199835795d89a828b60121030b0b57615595a0fcd04d466ab85313cd6369f07e9028c76b6f54d9fac1a8bbc4fdffffff03e71b050000000000160014386a025c6618718f6d12f605f169f4da380269842ee607000000000017a914f52cb69f975a79e9ad6be43b4f2ad5a3c8d7d56187534d090000000000160014134e35380abc71a8f678fcc49ccb5fd95e1bc7cba9a20000",
      "txid": "1a739e3ece13dd70b9e2d7184e31609e158ba0f8962a5eea76bf6c1d5579ae7b",
      "hash": "1a739e3ece13dd70b9e2d7184e31609e158ba0f8962a5eea76bf6c1d5579ae7b",
      "depends": [
      ],
      "fee": 398,
      "sigops": 0,
      "weight": 1592
    }
  ],
  "coinbaseaux": {
  },
  "coinbasevalue": 5000001628,
  "longpollid": "00000000000000308df706a8736dfe78eee7cea416adc1dc5bfcf4bc11202f6c324",
  "target": "00000000ffff0000000000000000000000000000000000000000000000000000",
  "mintime": 1724919762,
  "mutable": [
    "time",
    "transactions",
    "prevblock"
  ],
  "noncerange": "00000000ffffffff",
  "sigoplimit": 80000,
  "sizelimit": 4000000,
  "weightlimit": 4000000,
  "curtime": 1724920984,
  "bits": "1d00ffff",
  "height": 41642,
  "default_witness_commitment": "6a24aa21a9ed9392f1fe90c4f596eda2d286bba00dc8e2d66c0ec049783f9893f11043575063"
}
As you can see, "bits" field is set into "1d00ffff", and the time of the block is pushed forward. If you can see the real difficulty instead, then your CPU miner will try to mine a block with that difficulty, and will probably fail to do that on time.

In general, I can see two options:

1. Modifying Bitcoin Core.
2. Having unmodified Bitcoin Core, getting original block template, and modifying it in your mining software, or just before passing it to your mining software.

I think it is easier to recompile Bitcoin Core, but it is possible to get for example some 80-byte block header, and then write some code, to replace block time and difficulty, and then pass it into some mining software. Also, mining with Bitcoin Core is easier, because then you don't have to worry about dumping the whole block, making a proper Segwit commitment, and so on.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
BlackHatCoiner
Legendary
*
Offline Offline

Activity: 1624
Merit: 7972


Bitcoin is a royal fork


View Profile WWW
Today at 08:43:56 AM
 #24

I could swear that both these links sent me to the same transaction. SMF bug? ... Anyway, thanks, I'll try to mine a block and let you know.

LoyceV
Legendary
*
Offline Offline

Activity: 3416
Merit: 17295


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
Today at 11:19:45 AM
Merited by vjudeu (1)
 #25

If you can get it right, then you can mine blocks with the minimal difficulty, and we can go further. This simple exercise is what I started with, long time ago, when I was curious, how to mine blocks with Bitcoin Core.
This worked:
Code:
{
  "hash": "0000000085550338d113b883f211c87c7aa3e045ba6e03bae855ea884d1a1be7",
  "confirmations": 1,
  "height": 1,
  "version": 536870912,
  "versionHex": "20000000",
  "merkleroot": "20bb379fd28f090730ac2d207b92c6e95c69dfa48a8118577edb20e068c9a65d",
  "time": 1724929784,
  "mediantime": 1724929784,
  "nonce": 157273468,
  "bits": "1d00ffff",
  "difficulty": 1,
  "chainwork": "0000000000000000000000000000000000000000000000000000000200020002",
  "nTx": 1,
  "previousblockhash": "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943",
  "strippedsize": 225,
  "size": 225,
  "weight": 900,
  "tx": [
    "20bb379fd28f090730ac2d207b92c6e95c69dfa48a8118577edb20e068c9a65d"
  ]
}

3. Edit "src/chain.h" and "src/node/miner.cpp" exactly as I presented on forum.
If this is ELI5, I may need ELI4....

vjudeu
Hero Member
*****
Offline Offline

Activity: 825
Merit: 1977



View Profile
Today at 12:01:57 PM
 #26

Quote
If this is ELI5, I may need ELI4....
If you can get a single block, after the Genesis Block, then it means, that you have enough computing power, to mine on testnet4.

Quote
Edit "src/chain.h" and "src/node/miner.cpp" exactly as I presented on forum.
Those code changes are simple:

1. Go to "src/chain.h".
2. CTRL+F "static constexpr int64_t MAX_FUTURE_BLOCK_TIME = 2 * 60 * 60;"
3. Replace it with: "static constexpr int64_t MAX_FUTURE_BLOCK_TIME = 20 * 60 * 60;"
4. Save changes.

5. Go to "src/node/miner.cpp".
6. CTRL+F "int64_t nNewTime{std::max<int64_t>(pindexPrev->GetMedianTimePast() + 1, TicksSinceEpoch<std::chrono::seconds>(NodeClock::now()))};"
7. Replace it with: "int64_t nNewTime{std::max<int64_t>(pindexPrev->GetMedianTimePast() + 1, pindexPrev->GetBlockTime() + consensusParams.nPowTargetSpacing*2 + 1)};".
8. Save changes.

As I said: you can do that, and recompile Bitcoin Core, then all "generateXYZ" commands will give you easier blocks. The alternative is to not touch Bitcoin Core at all, but then, you have to extract the whole block, save it somewhere, replace time and difficulty, and then pass your 80-byte header to your mining software. But for me, recompiling Bitcoin Core is easier.

Quote
Long time ago, when I started, I simply used "generatetoaddress" command manually, and modified my system clock, to set it 20 minutes after the last block.
This is another way, if you don't want to touch your source code. You can simply set your system clock 20 minutes into the future. But then:

1. You will get some warnings, that "your clock is different, than in other nodes".
2. It will work only for a single block. When you mine it, then you won't mine a second block on top of that, because you will need to move your time again, 20 more minutes forward, or you will be mining with the real difficulty.
3. If any other CPU miner will produce a block, then you will mine again with the real difficulty.
4. Your browser will tell you, that HTTPS connection is insecure, because your system time will be set differently.
5. Other programs, or even your Operating System, may try to update your time, and set it automatically, if you don't disable it.

So, by manually tweaking your system clock, and using unmodified Bitcoin Core, you can mine a block or two, but it quickly becomes tedious.

But of course, if you have nothing else, then you can start with that. If you change your system clock manually, and then restart Bitcoin Core, you should be able to mine a block on your CPU, if your block template will give you "1d00ffff".

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
LoyceV
Legendary
*
Offline Offline

Activity: 3416
Merit: 17295


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
Today at 03:55:27 PM
Merited by garlonicon (1)
 #27

Quote
If this is ELI5, I may need ELI4....
If you can get a single block, after the Genesis Block, then it means, that you have enough computing power, to mine on testnet4.

Quote
Edit "src/chain.h" and "src/node/miner.cpp" exactly as I presented on forum.
Those code changes are simple:

1. Go to "src/chain.h".
2. CTRL+F "static constexpr int64_t MAX_FUTURE_BLOCK_TIME = 2 * 60 * 60;"
3. Replace it with: "static constexpr int64_t MAX_FUTURE_BLOCK_TIME = 20 * 60 * 60;"
4. Save changes.

5. Go to "src/node/miner.cpp".
6. CTRL+F "int64_t nNewTime{std::max<int64_t>(pindexPrev->GetMedianTimePast() + 1, TicksSinceEpoch<std::chrono::seconds>(NodeClock::now()))};"
7. Replace it with: "int64_t nNewTime{std::max<int64_t>(pindexPrev->GetMedianTimePast() + 1, pindexPrev->GetBlockTime() + consensusParams.nPowTargetSpacing*2 + 1)};".
8. Save changes.
Thanks, I got this far. But after compiling, it doesn't seem to know "testnet4":
Code:
./bitcoind --testnet4 -prune=25000
Error: Error parsing command line arguments: Invalid parameter --testnet4
This was after I used https://github.com/fjahr/bitcoin/tree/2024-04-testnet-4-fix so not what I expected.

garlonicon
Hero Member
*****
Offline Offline

Activity: 843
Merit: 2086


Pawns are the soul of chess


View Profile
Today at 05:23:09 PM
 #28

Maybe the author changed that branch in the meantime. Now, you can just clone the official code from https://github.com/bitcoin/bitcoin/ from the master branch, because things are already merged.

Also:
Quote
This branch is 360 commits behind bitcoin/bitcoin:master.
So, I guess using official code is better now. At the time of writing, it was not yet merged, so there was no other way.

Or: you can also use https://github.com/bitcoin/bitcoin/tree/28.x because this is what you can get, if you download release candidate for v28. But usually I just stick with the master.

Edit:
Quote
Code:
./bitcoind --testnet4 -prune=25000
A single dash in -testnet4, not --testnet4.

LoyceV
Legendary
*
Offline Offline

Activity: 3416
Merit: 17295


Thick-Skinned Gang Leader and Golden Feather 2021


View Profile WWW
Today at 07:13:07 PM
 #29

Or: you can also use https://github.com/bitcoin/bitcoin/tree/28.x because this is what you can get, if you download release candidate for v28. But usually I just stick with the master.
I'll try this next, thanks.

Quote
Edit:
Quote
Code:
./bitcoind --testnet4 -prune=25000
A single dash in -testnet4, not --testnet4.
Both work. Bitcoin Core isn't so picky. That's why I got sloppy with the dashes.

Pages: « 1 [2]  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!