Bitcoin Forum
May 06, 2024, 01:10:18 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: « 1 2 3 4 5 [6] 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 ... 61 »
101  Economy / Digital goods / Re: DYDX Trading Script |Auto Trading | Market Making | Grid | Pump | on: May 02, 2023, 05:24:31 PM
ONLINE
102  Alternate cryptocurrencies / Service Discussion (Altcoins) / Re: Justin caught red-handed cheating on Binance staking event on: May 01, 2023, 05:31:28 PM
Win from Binance and retail if you ask me. 
Far too much of this stuff going on glad Binance took a stand on this and outed it.

On the other hand now SUI know JS was possibly looking for a big stake of the tokens so who's to say they don't OTC something to him now knowing he is "after a bag"
103  Alternate cryptocurrencies / Announcements (Altcoins) / Re: [ANN] Litecoin - a lite version of Bitcoin. Launched! on: May 01, 2023, 01:56:13 PM
Litecoin is one of the undervalued projects, along with EOS. These projects will show good growth this year

Agreed!  Super undervalued and being used more and more for payments every day I can see a future where BTC and LTC are the top 2 coins in future.
104  Economy / Digital goods / DYDX Trading Script |Auto Trading | Market Making | Grid | Pump | on: May 01, 2023, 01:40:18 PM
Moved To Services Board.
105  Bitcoin / Pools / Re: [∞ YH] solo.ckpool.org 2% fee solo mining 273 blocks solved! on: April 16, 2023, 12:13:17 PM
does any body know the tx fees i will get for mining 24 hours using 1 EH/s on this pool if I hit a block how much am gonna get along with it in miner fees

What you can do is look at the last few blocks and see what the average fees are per block
won't give you exact number as it changes every block but will give you a rough view of fees in a block.

Still some places on the Altcoin funded BTC Hunt!

LTC Deposit address :
Code:
MTsUyJCrCrHhv3L5EAA1RySzLJssQeUu9k

Code:

1) MagicByt3
|     PAID     |   282f9a9b4f3a638687119c7ee07b820b3140d0cf4cd0ea396e72d0b5e302a343
2) Yarrou!                  
|     PAID     |   4331886c256161889922415582a558881856c3d506b65f8e300fe06e10100f6f
3)  jimjam123          
|     PAID     |   45a08f395b0f6b0fc5fe804efe1430dd985459abd12f34f5b4bfcbcff3c21609
4) Free Slot              
|   PENDING |  
5) Free Slot              
|  PENDING  |
6) Free Slot
|  PENDING  |
7) Free Slot
|  PENDING  |
8) Free Slot
|  PENDING  |
9) Free Slot
|  PENDING  |
10) Free Slot
|  PENDING  |
106  Bitcoin / Pools / Re: [∞ YH] solo.ckpool.org 2% fee solo mining USA/DE 255 blocks solved! on: April 15, 2023, 02:25:08 AM
LTC Funded Blockhunt.

Going to run a small altcoin funded BTC hashrate solo run for those who might not have the larger 0.1 buy-in for the big groups.
Also I like to see altcoins being use for things and I think there is a fair amount of LTC floating about so it might open up to a wider audience while helping BTC along the way!


Well i'll leave this here as a warning to future dreamers (Renters) that's me now alot of $$ down the pan over the last 4 years renting hash to try for a block (would have been better buying the $$ of bitcoin in the dips) and I have also always kept S3's and v9's on chain too with no luck once this hash run's out this time I am out of the mining game.

Just threw my last 15 LTC at rentals no luck 6 hr's left then i'm sorry to say but I won't be returning to the mining space.

Would have still been a fair payday with bitcoin being at the +£7k range would have netted a profit of around 30k or so for 4 years work but the god's of the hash are just not with me.

Sad times...

Magic.

what changed to back again? am reading now every single page of this thread

Time away from doing something is always good.

Now back on the horse as they say!
107  Bitcoin / Pools / Re: [∞ YH] solo.ckpool.org 2% fee solo mining 273 blocks solved! on: April 13, 2023, 11:45:40 PM
LTC Funded Blockhunt.

NOFI but this a solo pool for btc not for altcoins. Please make your own thread in the appopriate sub forum. Damn, missed that it is a btc run but funded with altcoins.

Yep for BTC mining buddy just some don't want to spend there BTC on rentals and many mine altcoins so we can use them to do runs I think this opens up btc mining this way to more.

Cheap runs for the masses <3
108  Bitcoin / Pools / Re: [∞ YH] solo.ckpool.org 2% fee solo mining 273 blocks solved! on: April 13, 2023, 07:44:24 PM
LTC Funded Blockhunt.



Im in, please put me in for a spot.
Will get the LTC deposited tonight or tomorrow.
Thanks,

Hey jimjam long time no talk no problem will put you on the list!

 Cheesy
109  Bitcoin / Pools / Re: [∞ YH] solo.ckpool.org 2% fee solo mining 273 blocks solved! on: April 13, 2023, 07:21:57 PM
LTC Funded Blockhunt.

Going to run a small altcoin funded BTC hashrate solo run for those who might not have the larger 0.1 buy-in for the big groups.
Also I like to see altcoins being use for things and I think there is a fair amount of LTC floating about so it might open up to a wider audience while helping BTC along the way!

Normal rules apply max 10 places.

Buy in 3 LTC (approx $300)

Renting will be conducted from https://www.miningrigrentals.com/ and mining will start once all places and deposits have been confirmed.

I have created a small Telegram group that people are welcome to join where we can talk about future rentals.

https://t.me/BlockHuntz



+++  DEPOSIT +++



LTC Deposit address :
Code:
MTsUyJCrCrHhv3L5EAA1RySzLJssQeUu9k

Code:

1) MagicByt3
|     PAID     |   282f9a9b4f3a638687119c7ee07b820b3140d0cf4cd0ea396e72d0b5e302a343
2) Yarrou!                  
|     PAID     |   4331886c256161889922415582a558881856c3d506b65f8e300fe06e10100f6f
3)  jimjam123           
|     PAID     |   45a08f395b0f6b0fc5fe804efe1430dd985459abd12f34f5b4bfcbcff3c21609
4) Free Slot              
|   PENDING |  
5) Free Slot              
|  PENDING  |
6) Free Slot
|  PENDING  |
7) Free Slot
|  PENDING  |
8) Free Slot
|  PENDING  |
9) Free Slot
|  PENDING  |
10) Free Slot
|  PENDING  |


Mining Address : https://solo.ckpool.org/users/1MH9f5wc5phwL2KzqjzAdriERHPawmaRjy


Post TXID and payout address if you decided to join or stop by the telegram.


110  Bitcoin / Pools / Re: [∞ YH] solo.ckpool.org 2% fee solo mining 271 blocks solved! on: March 14, 2023, 10:05:26 AM
Well done solo miner!  A very lucky block indeed.

Good to see the solo mining getting some exposure in the media too.

https://cointelegraph.com/news/solo-bitcoin-miner-defies-odds-to-mine-valid-btc-block-gets-150k-block-reward

Keep it up lads!!
111  Bitcoin / Bitcoin Technical Support / Re: have found my wallet from 2014 on: February 25, 2023, 08:03:26 PM
Did you save a seed anywhere or save the private keys for the wallet?

I would advise to sit with a pen and paper and try think back to the time when you were using it, try recall what you were doing, who you were with when you last used the wallet. Try think of password write them down make a list so you don't end up trying the same ones over and over.

Something like this might be worth looking into.

https://github.com/gurnec/btcrecover/blob/master/TUTORIAL.md#btcrecover-tutorial
112  Bitcoin / Development & Technical Discussion / Re: Python Mining Process | Visual Mining Learning | Community Updated on: February 25, 2023, 04:05:29 PM
Coinbase Hash smth output looks like garbage

Seems fine here could you elaborate why you think it's incorrect?  It decodes correctly.  



Code:
  SOLO ADDRESS:  1MH9f5wc5phwL2KzqjzAdriERHPawmaRjy 
[ 20:06:25.205196 ]  [*] Subscribe thread started.
b'{"params":["5eebeafb0018d3a2","d52462208723afbf50e768bd417f12c042107f740005596e0000000000000000","01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff350315e00b0004076afa6304b1d2bf1f0c","0a636b706f6f6c112f736f6c6f2e636b706f6f6c2e6f72672fffffffff030ff94e25000000001976a914de7065b31fad6c0f9c66b81f1958ebb356af9fb888acf5eac200000000001976a914f4cbe6c6bb3a8535c963169c22963d3a20e7686988ac0000000000000000266a24aa21a9ed8060d1d70f0e2a5ad8dafa90110c982049d48ddd3d8baac3950de4a510948cd800000000",["643c00c388d1e21f5d80241a80e767007e2df4102067eb7af5944259448993f8","1e89696b69c10f50edd41aa1c9b6bdd1118e483df2ae7e65f9771dcfbe7af12c","317959a9a67b01c436c5fc8157fe53cc985319b51c58e584c743849aedf9e6e2","4f3c0b9e356ffaa1d6807aa597c5591e2035dff11325a6cdfabdc47b727c51f5","c3e6ddae4f3c578bed721e48f6bd9b0d90a20d55930823b77429629cb2b51d09","b514b4d495627c99525ce537dcc001f68823d90073a37892f3419282874dcde9","0cb0a22c092c00d753afe7e5b48b01f0b0c073986111f4bb04f7871b1ebd2971","13674fd28edfcc48223cecbff3ffab129991c50b99c9366936ee2f1508862bac","b2fd85e1716ed267ee3ec1087ff93da892f202cef4f9320129fcae6f7db8ab0d","bf70597a04f7aadda795bbbd3488599edf6c08a38fd1700f2ce8bd48f717c877","5074da5f8c301f5b11d600c914ab4494b2954c8882f988fa316a9b22a6bbc13c"],"20000000","170689a3","63fa6a07",true],"id":null,"method":"mining.notify"}\n{"params":[10000],"id":null,"method":"mining.set_difficulty"}\n{"result":true,"error":null,"id":2}\n'
[*] Target:  [ 0000000000000000000689a30000000000000000000000000000000000000000
[*] Extranonce2:  [ 00000000bfc82f61
[ 20:06:29.210088 (  SOLO MINER STARTED   )~~--------------
 --------------~~(   IN SATOSHI WE TRUST   )~~--------------
 --------------~~(   DO NOT TRUST VERIFY   )~~--------------
[*] Coinbase Hash:  [ 01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff350315e00b0004076afa6304b1d2bf1f0cadc6e88800000000bfc82f610a636b706f6f6c112f736f6c6f2e636b706f6f6c2e6f72672fffffffff030ff94e25000000001976a914de7065b31fad6c0f9c66b81f1958ebb356af9fb888acf5eac200000000001976a914f4cbe6c6bb3a8535c963169c22963d3a20e7686988ac0000000000000000266a24aa21a9ed8060d1d70f0e2a5ad8dafa90110c982049d48ddd3d8baac3950de4a510948cd800000000
 [*] Coinbase Hash Bin Hex:  [ b'\x87c\x05@\x1b\x9e\x91\x1a\xb8\x17\xc2r\xafs"\n\x8c\xa2k\x1a\x97\xc0\x99\x14;\xc5\x82&\x10?\xa4_'
 [*] Coinb-1:  [ 01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff350315e00b0004076afa6304b1d2bf1f0c
 [*] Coinb-2:  [ 0a636b706f6f6c112f736f6c6f2e636b706f6f6c2e6f72672fffffffff030ff94e25000000001976a914de7065b31fad6c0f9c66b81f1958ebb356af9fb888acf5eac200000000001976a914f4cbe6c6bb3a8535c963169c22963d3a20e7686988ac0000000000000000266a24aa21a9ed8060d1d70f0e2a5ad8dafa90110c982049d48ddd3d8baac3950de4a510948cd800000000
 [*] Merkle Root:  [ 01deed1aa10f17f91810cc5697bb89d82950db1c39a954a58b3e11a77edb34f8
 [*] Block Height:  [ 778260 ]
 [ 20:06:29.496780 ]  [*] Working to solve block Good Luck!
 [ 20:07:15.322047 ]  [*] New hash:   {} for block   000000a4d882b03fa38f9ec9e2b032966b93b9a6b3cd5a4e222efce5d92184d3
 [ 20:07:15.322076 ]  Hash: 000000a4d882b03fa38f9ec9e2b032966b93b9a6b3cd5a4e222efce5d92184d3
[*] Nonce: 43598071 [*] Hashrate: 16777216.0695652



Decoded :

Code:
{
    "addresses": [
        "1MH9f5wc5phwL2KzqjzAdriERHPawmaRjy",
        "1PKN98VN2z5gwSGZvGKS2bj8aADZBkyhkZ"
    ],
    "block_height": -1,
    "block_index": -1,
    "confirmations": 0,
    "data_protocol": "unknown",
    "double_spend": false,
    "fees": 0,
    "hash": "5fa43f102682c53b1499c0971a6ba28c0a2273af72c217b81a919e1b40056387",
    "inputs": [
        {
            "age": 0,
            "output_index": -1,
            "script": "0315e00b0004076afa6304b1d2bf1f0cadc6e88800000000bfc82f610a636b706f6f6c112f736f6c6f2e636b706f6f6c2e6f72672f",
            "script_type": "empty",
            "sequence": 4294967295
        }
    ],
    "outputs": [
        {
            "addresses": [
                "1MH9f5wc5phwL2KzqjzAdriERHPawmaRjy"
            ],
            "script": "76a914de7065b31fad6c0f9c66b81f1958ebb356af9fb888ac",
            "script_type": "pay-to-pubkey-hash",
            "value": 625932559
        },
        {
            "addresses": [
                "1PKN98VN2z5gwSGZvGKS2bj8aADZBkyhkZ"
            ],
            "script": "76a914f4cbe6c6bb3a8535c963169c22963d3a20e7686988ac",
            "script_type": "pay-to-pubkey-hash",
            "value": 12774133
        },
        {
            "addresses": null,
            "data_hex": "aa21a9ed8060d1d70f0e2a5ad8dafa90110c982049d48ddd3d8baac3950de4a510948cd8",
            "script": "6a24aa21a9ed8060d1d70f0e2a5ad8dafa90110c982049d48ddd3d8baac3950de4a510948cd8",
            "script_type": "null-data",
            "value": 0
        }
    ],
    "preference": "low",
    "received": "2023-02-25T20:12:08.805687149Z",
    "relayed_by": "54.197.21.66",
    "size": 219,
    "total": 638706692,
    "ver": 1,
    "vin_sz": 1,
    "vout_sz": 3,
    "vsize": 219
}

Input New Transaction Hex
Transaction Hex*
01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff350315e00b0004076afa6304b1d2bf1f0cadc6e88800000000bfc82f610a636b706f6f6c112f736f6c6f2e636b706f6f6c2e6f72672fffffffff030ff94e25000000001976a914de7065b31fad6c0f9c66b81f1958ebb356af9fb888acf5eac200000000001976a914f4cbe6c6bb3a8535c963169c22963d3a20e7686988ac0000000000000000266a24aa21a9ed8060d1d70f0e2a5ad8dafa90110c982049d48ddd3d8baac3950de4a510948cd800000000



Best regards
113  Bitcoin / Development & Technical Discussion / Re: Python Mining Process | Visual Mining Learning | Community Updated on: February 24, 2023, 07:07:58 PM


Breakdown now shows:
Target - Extranonce2 - Coinbase Hash - Coinbase Hash BIN Hex - Coinb-1 - Coinb-2 - Merkel Root - Block Height - Nonce - Hashrate

Code:
[*] Target:  [ 0000000000000000000730390000000000000000000000000000000000000000
[*] Extranonce2:  [ 00000000dd398605
[*] Coinbase Hash:  [ 01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff35039fdf0b0004fb09f963041a71420c0c4f52e28800000000dd3986050a636b706f6f6c112f736f6c6f2e636b706f6f6c2e6f72672fffffffff0394a2b225000000001976a914de7065b31fad6c0f9c66b81f1958ebb356af9fb888aca4f3c400000000001976a914f4cbe6c6bb3a8535c963169c22963d3a20e7686988ac0000000000000000266a24aa21a9ed39a54281bf28eedaa2da014692e7417cfe7d2ad5f2558f7036d730ccda8d941000000000
[*] Coinbase Hash Bin Hex:  [ b'\xab{\xecV&\xfd?\xcf\xdd\xe3\xef\xc4\x9b\x99\xcdq$ov&\x94\xe8jP\x8f\x9f/\xa3\x89\x0f\xe7\xd3'
[*] Coinb-1:  [ 01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff35039fdf0b0004fb09f963041a71420c0c
[*] Coinb-2:  [ 0a636b706f6f6c112f736f6c6f2e636b706f6f6c2e6f72672fffffffff0394a2b225000000001976a914de7065b31fad6c0f9c66b81f1958ebb356af9fb888aca4f3c400000000001976a914f4cbe6c6bb3a8535c963169c22963d3a20e7686988ac0000000000000000266a24aa21a9ed39a54281bf28eedaa2da014692e7417cfe7d2ad5f2558f7036d730ccda8d941000000000
 [*] Merkle Root:  [ ebc4cc2a50e3cfb379320491c03253ad3fbb251affd42b8243f5e4bb921abad1
 [*] Block Height:  [ 778142 ]
 [ 19:03:36.767895 ]  [*] Working to solve block Good Luck!
[*] Nonce: 3a3b78b1 [*] Hashrate: 9320675.555555556
114  Bitcoin / Pools / Re: [∞ YH] solo.ckpool.org 2% fee solo mining 269 blocks solved! on: February 23, 2023, 06:59:36 PM
Well done miner! Well earned block! Enjoy!  Smiley
115  Economy / Collectibles / Re: [A U C T I O N ] Litecoin MoonChikun Silver + NFTs + Display Case on: February 19, 2023, 12:24:56 PM
 Shocked No bids.. Listing closed.
116  Economy / Collectibles / Re: [A U C T I O N ] Litecoin MoonChikun Silver + NFTs + Display Case on: February 19, 2023, 02:09:12 AM
10 hours remain!  Smiley
117  Bitcoin / Development & Technical Discussion / Re: Python Mining Process | Visual Mining Learning | Community Updated on: February 18, 2023, 03:19:27 PM
ImportError: No module named context

python3
pip3 install context = ERROR: No matching distribution found for context.viewer

Context should be with python above 3.7 if below update python to the later version.

Context is not a pip module.

Edit : Added the context file just include it in the same directory as the SoloMine.py file.
118  Bitcoin / Pools / Re: KanoPool since 2014 🐈 - PPLNS and Solo 0.5% fee - Worldwide - 2433 blocks on: February 18, 2023, 01:51:05 AM
One before 500 days would do just nice.  Smiley
119  Bitcoin / Mining / Re: My USB SHA256 lottery on: February 18, 2023, 01:47:40 AM
Thanks kano. I did think your version had some fixed hence asking.
120  Bitcoin / Development & Technical Discussion / Python Mining Process | Visual Mining Learning | Community Updated on: February 18, 2023, 01:21:50 AM
** Update 28/02/2024 - Final code now on Github. https://github.com/DaCryptoRaccoon/BitcoinSoloPy

Looking for some advice on the mining process with python I have added the sections below I am most interested in knowing if they are in the correct order they seem to be working and output looks good.  I would be interested to have the community update maybe add in some features use it for a learning tool to visually see the mining process so I included the full script at the bottom of the post.  

I would also like to know how I can calculate the hashrate of the CPU and display that along size the nonce value that runs on the same line while the script is running I am unsure how to go about calculating the hashrate so this would be something I would be interested in having added.

Any help or updates if anyone is interested in this would be great!

As stated at the start of the post here are some section that I would like to know if they are in the correct sequence.

Code:
    ## This code is used to create a target (difficulty) and extranonce2 value for a mining context (ctx).
    ## The target is created by taking the last 3 bits of the nbits field from the context and appending '00' to the end of it ctx.nbits[2:] times.
    ## The extranonce2 value is a random number between 0 and 2^32-1, which is converted to hex and padded with zeros to match the length of the ctx.extranonce2_size.

    target = (ctx.nbits[2 :] + '00' * (int(ctx.nbits[:2] , 16) - 3)).zfill(64)
    extranonce2 = hex(random.randint(0 , 2 ** 32 - 1))[2 :].zfill(2 * ctx.extranonce2_size)  # create random

    ## This code is used to create a coinbase hash from the mining context (ctx) and the extranonce2 value generated in the previous code.
    ## The coinbase is created by combining the ctx.coinb1, ctx.extranonce1, extranonce2 and ctx.coinb2 fields.
    ## The coinbase hash is then generated by taking the SHA-256 hash of the coinbase twice and getting the binary digest.

    coinbase = ctx.coinb1 + ctx.extranonce1 + extranonce2 + ctx.coinb2
    coinbase_hash_bin = hashlib.sha256(hashlib.sha256(binascii.unhexlify(coinbase)).digest()).digest()

    ## This code is used to generate a Merkle root from the mining context (ctx) and the coinbase hash generated in the previous code.
    ## The Merkle root is generated by looping through the ctx.merkle_branch list and combining the merkle_root and the current branch element in each iteration.
    ## The combined values are then hashed twice with SHA-256 to generate the new merkle_root.

    merkle_root = coinbase_hash_bin
    for h in ctx.merkle_branch :
        merkle_root = hashlib.sha256(hashlib.sha256(merkle_root + binascii.unhexlify(h)).digest()).digest()

   ## This code is used to convert the binary Merkle root generated in the previous code to a hexadecimal string.
   ## The binary merkle_root is converted to a hexadecimal string using the binascii.hexlify() function,
   ## and then the result is decoded to a string using the decode() method.

    merkle_root = binascii.hexlify(merkle_root).decode()

    ## This code is used to format the Merkle root generated in the previous code. The string is split into two-character substrings,
    ## and the result is reversed using the [::-1] slice notation.
    ## The work_on variable is used to get the current block height,
    ## and the ctx.nHeightDiff dictionary is updated with the new block height and a value of 0.

    merkle_root = ''.join([merkle_root[i] + merkle_root[i + 1] for i in range(0 , len(merkle_root) , 2)][: :-1])
    work_on = get_current_block_height()
    ctx.nHeightDiff[work_on + 1] = 0

    ## This code is used to calculate the difficulty for the current block.
    ## The difficulty is calculated by taking the hex string "00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
    ## and dividing it by the target value which is also in hex format. The result is the difficulty for the current block.

    _diff = int("00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" , 16)

     ## This code is used to generate a blockheader from the mining context (ctx), the Merkle root,
     ## a random nonce, and the hash of the blockheader. The blockheader is created by combining the
     ## ctx.version, ctx.prevhash, merkle_root, ctx.ntime, ctx.nbits, nonce and,
     ## '000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000'.
     ## The hash of the blockheader is then generated by taking the SHA-256 hash of the blockheader twice and getting the binary digest.
     ## The result is then converted to a hexadecimal string using the binascii.hexlify() function.

        nonce = hex(random.randint(0 , 2 ** 32 - 1))[2 :].zfill(8)  # nNonce   #hex(int(nonce,16)+1)[2:]
        blockheader = ctx.version + ctx.prevhash + merkle_root + ctx.ntime + ctx.nbits + nonce + \
                      '000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000'
        hash = hashlib.sha256(hashlib.sha256(binascii.hexlify()



Running Output In Terminal :

Code:
[ 00:52:13.570480 ]  Solo Miner Active
[ 00:52:13.570503 ]  [*] Bitcoin Miner Restarted
[*] Target:  [ 0000000000000000000730390000000000000000000000000000000000000000
[*] Extranonce2:  [ 0000000081c85ef1
[*] Coinbase Hash:  [ 01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff35037fdb0b00043d21f06304a91445120c663eb5880000000081c85ef10a636b706f6f6c112f736f6c6f2e636b706f6f6c2e6f72672fffffffff035da99424000000001976a914de7065b31fad6c0f9c66b81f1958ebb356af9fb888ac941dbf00000000001976a914f4cbe6c6bb3a8535c963169c22963d3a20e7686988ac0000000000000000266a24aa21a9ed120b0cd349e61ea31bd80040ca4e6a2daae782690bd6c70c597f6f00f43bf3ec00000000
[*] Merkle Root:  [ 7132975fd8b01f54806294db489ff4628474e43d5486680692a7c4186aae2d99
[*] Diff:  [ 26959946667150639794667015087019630673637144422540572481103610249215 ]
[*] Nonce: d501c71560





UPDATED CODE READ DOWN TOPIC


The code connects to CK Solo pool for work and pulls the block height from blockchain.info you can change the address in the script you might get lucky! but probably not!

If anyone can work out how I can calculate the hashrate of the CPU and have it output in the same terminal line as the nonce value would be great!

SoloMine.py


Code:

# Bitcoin Solo Miner
import requests
import socket
import threading
import json
import hashlib
import binascii
import logging
import random
import time
import traceback
import context as ctx
from datetime import datetime
from signal import SIGINT , signal
from colorama import Back , Fore , Style


sock = None

def timer() :
    tcx = datetime.now().time()
    return tcx

## Lucky BTC Address! May Satoshi Be With You!
address = '1MH9f5wc5phwL2KzqjzAdriERHPawmaRjy'

print(Back.BLUE , Fore.WHITE , 'SOLO ADDRESS:' , Fore.GREEN, str(address) , Style.RESET_ALL)

def handler(signal_received , frame) :
    ## Handle Cleanup ##
    ctx.fShutdown = True
    print(Fore.MAGENTA , '[' , timer() , ']' , Fore.YELLOW , 'Force Close, Please Wait..')

## Start Logging to file miner.log
## Include Timestamps

def logg(msg) :
    # basic logging
    logging.basicConfig(level = logging.INFO , filename = "miner.log" ,
                        format = '%(asctime)s %(message)s')
    logging.info(msg)

 ## This code is used to get the current block height of the Bitcoin network.
 ## The request is made to the blockchain.info API and the response is parsed to get the height field.
 ## The height is then converted to an integer and returned.

def get_current_block_height() :
    # returns the current network height
    r = requests.get('https://blockchain.info/latestblock')
    return int(r.json()['height'])

## This code is used to check if the mining context (ctx) is in shutdown mode.
## If the ctx.fShutdown flag is set to True, the ctx.listfThreadRunning list is updated with the current thread's index (n) and set to False.
## The thread's exit flag is also set to True to signal the thread to exit.

def check_for_shutdown(t) :
    ## handle shutdown ##
    n = t.n
    if ctx.fShutdown :
        if n != -1 :
            ctx.listfThreadRunning[n] = False
            t.exit = True

## This code is defining a custom thread class called ExitedThread which is a subclass of threading.Thread.
## The class has two attributes, exit and arg, and four methods,
## __init__, run, thread_handler and thread_handler2. The __init__ method is used to initialize the class and set the exit,
## arg and n attributes. The run method is used to call the thread_handler method with the arg and n attributes as parameters.
## The thread_handler method is used to check for shutdown and if the exit flag is set to True, the thread exits.
## The thread_handler2 method is used to be implemented by subclasses and is not implemented in this class.
## The check_self_shutdown and try_exit methods are used to check for shutdown and try to exit the thread, respectively.


class ExitedThread(threading.Thread) :
    def __init__(self , arg , n) :
        super(ExitedThread , self).__init__()
        self.exit = False
        self.arg = arg
        self.n = n

    def run(self) :
        self.thread_handler(self.arg , self.n)
        pass

    def thread_handler(self , arg , n) :
        while True :
            check_for_shutdown(self)
            if self.exit :
                break
            ctx.listfThreadRunning[n] = True
            try :
                self.thread_handler2(arg)
            except Exception as e :
                logg("ThreadHandler()")
                print(Fore.MAGENTA , '[' , timer() , ']' , Fore.WHITE , 'ThreadHandler()')
                logg(e)
                print(Fore.RED , e)
            ctx.listfThreadRunning[n] = False

            time.sleep(2)
            pass

    def thread_handler2(self , arg) :
        raise NotImplementedError("must impl this func")

    def check_self_shutdown(self) :
        check_for_shutdown(self)

    def try_exit(self) :
        self.exit = True
        ctx.listfThreadRunning[self.n] = False
        pass

 ## This code is defining a function called bitcoin_miner which is used to start and restart the bitcoin miner.
 ## If the miner is restarted, it will log and print that it has been restarted and sleep for 5 seconds.
 ## It will then log and print that the miner has started. It then runs a loop which checks if the miner thread is still alive and if the subscribe thread is running.
 ## If either of these conditions are not true, the loop will break. Otherwise,
 ## it will set the miner thread to be running, call the mining method on the miner thread, and set the miner thread to be not running.
 ## If an exception occurs, it is logged and the traceback is printed, and the loop breaks.

def bitcoin_miner(t , restarted = False) :
    if restarted :
        logg('\n[*] Bitcoin Miner restarted')
        print(Fore.MAGENTA , '[' , timer() , ']' , Fore.YELLOW , 'Solo Miner Active')
        print(Fore.MAGENTA , '[' , timer() , ']' , Fore.BLUE , '[*] Bitcoin Miner Restarted')
        time.sleep(5)

    ## This code is used to create a target (difficulty) and extranonce2 value for a mining context (ctx).
    ## The target is created by taking the last 3 bits of the nbits field from the context and appending '00' to the end of it ctx.nbits[2:] times.
    ## The extranonce2 value is a random number between 0 and 2^32-1, which is converted to hex and padded with zeros to match the length of the ctx.extranonce2_size.

    target = (ctx.nbits[2 :] + '00' * (int(ctx.nbits[:2] , 16) - 3)).zfill(64)
    extranonce2 = hex(random.randint(0 , 2 ** 32 - 1))[2 :].zfill(2 * ctx.extranonce2_size)  # create random
    print( Fore.YELLOW , '[*] Target:' ,Fore.GREEN, '[' , target) , ']'
    print( Fore.YELLOW , '[*] Extranonce2:' ,Fore.GREEN , '[' , extranonce2) , ']'

    ## This code is used to create a coinbase hash from the mining context (ctx) and the extranonce2 value generated in the previous code.
    ## The coinbase is created by combining the ctx.coinb1, ctx.extranonce1, extranonce2 and ctx.coinb2 fields.
    ## The coinbase hash is then generated by taking the SHA-256 hash of the coinbase twice and getting the binary digest.

    coinbase = ctx.coinb1 + ctx.extranonce1 + extranonce2 + ctx.coinb2
    coinbase_hash_bin = hashlib.sha256(hashlib.sha256(binascii.unhexlify(coinbase)).digest()).digest()
    print( Fore.YELLOW , '[*] Coinbase Hash:' ,Fore.GREEN , '[' , coinbase) , ']'

    ## This code is used to generate a Merkle root from the mining context (ctx) and the coinbase hash generated in the previous code.
    ## The Merkle root is generated by looping through the ctx.merkle_branch list and combining the merkle_root and the current branch element in each iteration.
    ## The combined values are then hashed twice with SHA-256 to generate the new merkle_root.

    merkle_root = coinbase_hash_bin
    for h in ctx.merkle_branch :
        merkle_root = hashlib.sha256(hashlib.sha256(merkle_root + binascii.unhexlify(h)).digest()).digest()

        ## This code is used to convert the binary Merkle root generated in the previous code to a hexadecimal string.
        ## The binary merkle_root is converted to a hexadecimal string using the binascii.hexlify() function,
        ## and then the result is decoded to a string using the decode() method.

    merkle_root = binascii.hexlify(merkle_root).decode()
    print( Fore.YELLOW , '[*] Merkle Root:' ,Fore.YELLOW , '[' , merkle_root) , ']'

    # This code is used to format the Merkle root generated in the previous code. The string is split into two-character substrings,
    ## and the result is reversed using the [::-1] slice notation.
    ## The work_on variable is used to get the current block height,
    ## and the ctx.nHeightDiff dictionary is updated with the new block height and a value of 0.

    merkle_root = ''.join([merkle_root[i] + merkle_root[i + 1] for i in range(0 , len(merkle_root) , 2)][: :-1])
    work_on = get_current_block_height()
    ctx.nHeightDiff[work_on + 1] = 0

    ## This code is used to calculate the difficulty for the current block.
    ## The difficulty is calculated by taking the hex string "00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
    ## and dividing it by the target value which is also in hex format. The result is the difficulty for the current block.

    _diff = int("00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" , 16)
    print( Fore.YELLOW , '[*] Diff:' ,Fore.YELLOW , '[' , int(_diff) , ']')
    logg('[*] Working to solve block at block height {}'.format(work_on + 1))
    print(Fore.MAGENTA , '[' , timer() , ']' , Fore.YELLOW , '[*] Working to solve block at ' , Fore.RED , 'height {}'.format(work_on + 1))

    ## Start Mining Loop ##

    ## This code is a while loop which checks if the thread should be shut down and if so, it breaks out of the loop.
    ## It then checks if a new block has been detected and if so, it logs and prints that a new block has been detected,
    ## logs and prints the difficulty of the block, restarts the bitcoin miner, and continues the loop.

    while True :
        t.check_self_shutdown()
        if t.exit :
            break

        if ctx.prevhash != ctx.updatedPrevHash :
            logg('[*] NEW BLOCK {} DETECTED ON NETWORK'.format(ctx.prevhash))
            print(Fore.YELLOW , '[' , timer() , ']' , Fore.MAGENTA , '[*] New block {} detected on' , Fore.BLUE , ' network '.format(ctx.prevhash))
            logg('[*] Best difficulty previous block {} was {}'.format(work_on + 1 ,ctx.nHeightDiff[work_on + 1]))
            print(Fore.MAGENTA , '[' , timer() , ']' , Fore.GREEN , '[*] Best Diff Trying Block' , Fore.YELLOW , ' {} ' , Fore.BLUE , 'was {}'.format(work_on + 1 ,ctx.nHeightDiff[work_on + 1]))
            ctx.updatedPrevHash = ctx.prevhash
            bitcoin_miner(t , restarted = True)
            print(Back.YELLOW , Fore.MAGENTA , '[' , timer() , ']' , Fore.BLUE , 'NEW BLOCK DETECTED - RESTARTING MINER...' ,
                  Style.RESET_ALL)
            continue

            ## This code is used to generate a blockheader from the mining context (ctx), the Merkle root,
            ## a random nonce, and the hash of the blockheader. The blockheader is created by combining the
            ## ctx.version, ctx.prevhash, merkle_root, ctx.ntime, ctx.nbits, nonce and,
            ## '000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000'.
            ## The hash of the blockheader is then generated by taking the SHA-256 hash of the blockheader twice and getting the binary digest.
            ## The result is then converted to a hexadecimal string using the binascii.hexlify() function.

        nonce = hex(random.randint(0 , 2 ** 32 - 1))[2 :].zfill(8)  # nNonce   #hex(int(nonce,16)+1)[2:]
        blockheader = ctx.version + ctx.prevhash + merkle_root + ctx.ntime + ctx.nbits + nonce + \
                      '000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000'
        hash = hashlib.sha256(hashlib.sha256(binascii.unhexlify(blockheader)).digest()).digest()
        hash = binascii.hexlify(hash).decode()

        ## Print Functions for terminal output
        ## Print Rolling Nonce
        ## Print Rolling Nonce + Block Header
        ## Print Block Header

        print( Fore.YELLOW + '[*] Nonce: ' + Fore.GREEN + str(nonce) , end="\r")
        ## Print Nonce Rolling + Rolling Block Header ##
        #print( Fore.YELLOW + '[*] Nonce: ' + Fore.GREEN + str(nonce) + Fore.YELLOW , '[*] Block Header:' ,Fore.GREEN , '[' , str(blockheader) , end="\r")
        ## Print Block Header ##
        #print( Fore.YELLOW , '[*] Block Header:' ,Fore.GREEN , '[' , str(blockheader) ,  end="\r")


        ##Log all hashes that start with 7 zeros or more ##
        if hash.startswith('000000') :
            logg('[*] New hash: {} for block {}'.format(hash , work_on + 1))
            print(Fore.MAGENTA , '[' , timer() , ']' , Fore.GREEN, '[*] New hash:' , Fore.GREEN , ' {} for block' , Fore.YELLOW ,' {}'.format(hash , work_on + 1))
            print(Fore.MAGENTA , '[' , timer() , ']' , Fore.YELLOW , 'Hash:' , str(hash).format(work_on + 1))

            ## This code is used to check if the difficulty of the current block is greater than the difficulty of the previous block.
            ## The difficulty of the current block is calculated by dividing the predetermined difficulty value _diff by the hash of the blockheader this_hash.
            ## If the current difficulty is greater than the previous difficulty stored in the ctx.nHeightDiff dictionary,
            ## the new difficulty is set as the value for the current block.

        this_hash = int(hash , 16)
        difficulty = _diff / this_hash

        if ctx.nHeightDiff[work_on + 1] < difficulty :
            # new best difficulty for block at x height
            ctx.nHeightDiff[work_on + 1] = difficulty

            ## This code is used to check if the hash of the blockheader is less than the target value.
            ## If the hash is less than the target, it means the block has been successfully solved and the ctx.solved flag is set to True.

        if hash < target :
            logg('[*] Block {} solved.'.format(work_on + 1))

            print(Fore.MAGENTA , '[' , timer() , ']' , Fore.YELLOW , '[*] Block {} solved.'.format(work_on + 1))
            logg('[*] Block hash: {}'.format(hash))
            print(Fore.YELLOW)
            print(Fore.MAGENTA , '[' , timer() , ']' , Fore.YELLOW , '[*] Block hash: {}'.format(hash))
            logg('[*] Blockheader: {}'.format(blockheader))
            print(Fore.BLUE , '--------------~~( ' , Fore.GREEN  , 'BLOCK SOLVED CHECK WALLET!' , Fore.ORANGE , ' )~~--------------')

            print(Fore.YELLOW , '[*] Blockheader: {}'.format(blockheader))
            payload = bytes('{"params": ["' + address + '", "' + ctx.job_id + '", "' + ctx.extranonce2 \
                            + '", "' + ctx.ntime + '", "' + nonce + '"], "id": 1, "method": "mining.submit"}\n' ,
                            'utf-8')
            logg('[*] Payload: {}'.format(payload))
            print(Fore.MAGENTA , '[' , timer() , ']' , Fore.BLUE , '[*] Payload:' , Fore.GREEN , ' {}'.format(payload))
            sock.sendall(payload)
            ret = sock.recv(1024)
            logg('[*] Pool response: {}'.format(ret))
            print(Fore.MAGENTA , '[' , timer() , ']' , Fore.GREEN , '[*] Pool Response:' , Fore.CYAN ,
                  ' {}'.format(ret))
            print(payload)
            return True

         ## This code is used to set up a connection to the ckpool server and send a handle subscribe message.
         ## The response is parsed to get the ctx.sub_details, ctx.extranonce1 and ctx.extranonce2_size fields.
         ## Then an authorize message is sent with the address and password, and the response is read until the mining.notify message is received.

def block_listener(t) :
    # init a connection to ckpool
    sock = socket.socket(socket.AF_INET , socket.SOCK_STREAM)
    sock.connect(('solo.ckpool.org' , 3333))
    # send a handle subscribe message
    sock.sendall(b'{"id": 1, "method": "mining.subscribe", "params": []}\n')
    lines = sock.recv(1024).decode().split('\n')
    response = json.loads(lines[0])
    ctx.sub_details , ctx.extranonce1 , ctx.extranonce2_size = response['result']
    # send and handle authorize message
    sock.sendall(b'{"params": ["' + address.encode() + b'", "password"], "id": 2, "method": "mining.authorize"}\n')
    response = b''
    while response.count(b'\n') < 4 and not (b'mining.notify' in response) : response += sock.recv(1024)
    print(response)

    ## This code is used to parse the response from the ckpool server and get the necessary fields for the mining context (ctx).
    ## The response is split into individual lines and only lines that contain the 'mining.notify' string are parsed.
    ## The parsed results are then stored in the,
    ## ctx.job_id, ctx.prevhash, ctx.coinb1, ctx.coinb2, ctx.merkle_branch, ctx.version, ctx.nbits, ctx.ntime and ctx.clean_jobs fields.

    responses = [json.loads(res) for res in response.decode().split('\n') if
                 len(res.strip()) > 0 and 'mining.notify' in res]
    ctx.job_id , ctx.prevhash , ctx.coinb1 , ctx.coinb2 , ctx.merkle_branch , ctx.version , ctx.nbits , ctx.ntime , ctx.clean_jobs = \
        responses[0]['params']

    ## Do this one time, will be overwriten by mining loop when new block is detected

    ctx.updatedPrevHash = ctx.prevhash

    while True :
        t.check_self_shutdown()
        if t.exit :
            break

        ## This code is used to check if the previous hash in the response from the ckpool server is different from the previous hash,
        ## in the mining context (ctx). If the hashes are different, the response is parsed to get the necessary fields
        ## for the mining context and the fields are updated with the new values.

        response = b''
        while response.count(b'\n') < 4 and not (b'mining.notify' in response) : response += sock.recv(1024)
        responses = [json.loads(res) for res in response.decode().split('\n') if
                     len(res.strip()) > 0 and 'mining.notify' in res]

        if responses[0]['params'][1] != ctx.prevhash :

            ## New block detected on network
            ## update context job data

            ctx.job_id , ctx.prevhash , ctx.coinb1 , ctx.coinb2 , ctx.merkle_branch , ctx.version , ctx.nbits , ctx.ntime , ctx.clean_jobs = \
                responses[0]['params']

    ## This code is defining a custom thread class called CoinMinerThread which is a subclass of ExitedThread.
    ## The class has two methods, __init__ and thread_handler2. The __init__ method is used to initialize the class and set the n attribute to 0.
    ## The thread_handler2 method calls the thread_bitcoin_miner method with the arg parameter. The thread_bitcoin_miner method is used to check for shutdown,
    ## and then calls the bitcoin_miner function with the current thread object as the parameter. The result of the bitcoin_miner function is logged to the console.

class CoinMinerThread(ExitedThread) :
    def __init__(self , arg = None) :
        super(CoinMinerThread , self).__init__(arg , n = 0)

    def thread_handler2(self , arg) :
        self.thread_bitcoin_miner(arg)

    def thread_bitcoin_miner(self , arg) :
        ctx.listfThreadRunning[self.n] = True
        check_for_shutdown(self)
        try :
            ret = bitcoin_miner(self)
            logg(Fore.MAGENTA , "[" , timer() , "] [*] Miner returned %s\n\n" % "true" if ret else "false")
            print(Fore.LIGHTCYAN_EX , "[*] Miner returned %s\n\n" % "true" if ret else "false")
        except Exception as e :
            logg("[*] Miner()")
            print(Back.WHITE , Fore.MAGENTA , "[" , timer() , "]" , Fore.BLUE , "[*] Miner()")
            logg(e)
            traceback.print_exc()
        ctx.listfThreadRunning[self.n] = False

    pass

## This code is defining a new class called NewSubscribeThread which is a subclass of ExitedThread. It has two methods,
## __init__ and thread_handler2. The __init__ method sets up the thread with the specified argument and sets the number of threads to 1.
## The thread_handler2 method calls the thread_new_block method with the specified argument.
## The thread_new_block method sets the thread to be running, checks for shutdown, and then calls the block_listener function. If an exception occurs,
## it is logged and the traceback is printed. Finally, the thread is set to be not running.

class NewSubscribeThread(ExitedThread) :
    def __init__(self , arg = None) :
        super(NewSubscribeThread , self).__init__(arg , n = 1)

    def thread_handler2(self , arg) :
        self.thread_new_block(arg)

    def thread_new_block(self , arg) :
        ctx.listfThreadRunning[self.n] = True
        check_for_shutdown(self)
        try :
            ret = block_listener(self)
        except Exception as e :
            logg("[*] Subscribe thread()")
            print(Fore.MAGENTA , "[" , timer() , "]" , Fore.YELLOW , "[*] Subscribe thread()")
            logg(e)
            traceback.print_exc()
        ctx.listfThreadRunning[self.n] = False

    pass

    ## This code is defining a function called StartMining which creates a thread for subscribing and one for mining.
    ## It first creates a new thread called subscribe_t which uses the NewSubscribeThread class.
    ## It then starts the thread and logs that the subscribe thread has been started.
    ## It then sleeps for 4 seconds and creates a new thread called miner_t which uses the CoinMinerThread class.
    ## It then starts the thread and logs that the Bitcoin solo miner has been started.

def StartMining() :
    subscribe_t = NewSubscribeThread(None)
    subscribe_t.start()
    logg("[*] Subscribe thread started.")
    print(Fore.MAGENTA , "[" , timer() , "]" , Fore.GREEN , "[*] Subscribe thread started.")

    time.sleep(4)

    miner_t = CoinMinerThread(None)
    miner_t.start()
    logg("[*]£££ Bitcoin Solo Miner Started £££")
    print(Fore.MAGENTA , "[" , timer() , '(', Fore.GREEN  , 'SOLO MINER STARTED' , Fore.BLUE , ' )~~--------------')
    print(Fore.BLUE , '--------------~~( ' , Fore.YELLOW , 'IN SATOSHI WE TRUST' , Fore.BLUE , ' )~~--------------')
    print(Fore.BLUE , '--------------~~( ' , Fore.GREEN  , 'DO NOT TRUST VERIFY' , Fore.BLUE , ' )~~--------------')


if __name__ == '__main__' :
    signal(SIGINT , handler)
    StartMining()



Context.py

Code:
fShutdown = False
listfThreadRunning = [False] * 2
local_height = 0
nHeightDiff = {}
updatedPrevHash = None
job_id = None
prevhash = None
coinb1 = None
coinb2 = None
merkle_branch = None
version = None
nbits = None
ntime = None
clean_jobs = None
sub_details = None
extranonce1 = None
extranonce2_size = None




Pages: « 1 2 3 4 5 [6] 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 ... 61 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!