Author

Topic: [Help needed] mining pseudo required .... (solved and added new questions) (Read 221 times)

newbie
Activity: 8
Merit: 1
Thank you all (no one replied !!!!!!!!!!!!  Undecided )
i got it anyway by keeping to try several things

i think this will be the first really and fully working C# stratum solo bitcoin miner (at least for my searching for a month)
answers for my questions in case anyone would like to know

1- yes i have to reverse prevhash by 4 then when calculating header reverse it by byte
2- not sure yet but most likely they are not coz version, bits and time are not  
3- no only the mrklRoot
4- yes extranonce2 is increment field so you can randomize it , and no you can not use jobId because its incremental variable
5- you can ignore the job updates or you can start over a new job but branches do not added they will be a complete new and updated old branches
6- no
7- yes hash found must be reversed to compare it with target
8- there are too many just go to any blockchain explorer and extract data from any block


Now my new task is to create merkle branches from waiting transactions , so my next questions are
1- what is the coinbase address or string as sender to my address
2- will the amount be the reward only (6.25) or should i calculate fees and add them to the amount?
newbie
Activity: 8
Merit: 1
Hello there , i am trying to create my solo miner FOR FUN and the nano chance to win (i know it wont happen)
i am using my pc cpu i know the whale world say it's a waste of time and effort but what if i can manage to obtain a 0.001% chance just by using that cpu ?
i am using solo.ckpool.org
so, for now i have successfully connected to stratum and obtained the data
prevhash = 3039670f966d8851b7bf7a8c6a790a2a9461ca5d0004ec230000000000000000
coinb1    = xxxxxxxxxxxxxx
mrkl =
version = 20000000
my questions are
1- the prev hash received is reversed should i reverse it back to original to create header or it will be appended as it is?
2- are coinb1,mrklbranches,version , bits and time reversed as well or they are in correct order ?
3- i know i have to reverse merkleroot after creating it , should i reverse the full header or just the merkleroot ?
4- extranonce2 from my study and search i should random it , is that correct or its a fixed number ? and if randomized can i use the job id as extranonce2?
5- every minute the stratum sends me a new job with same prevhash should i add the branches to the prev ones or can i ignore that and continue working
6- the padding string included in the hash calculations or we add it after hash found ?
        padding string which is "0000008000000000000000000000000000000000000000000000000000000000000000000000000 00000000080020000"
7- should i reverse the hash found to check the target or compare it as it is ? ("should i log it starting with 19 zeros or ending with them?)
8- is there any test block data i can use to test my codes?


my pseudo as for now
1 connect to pool and authorize
2 from received (mining.subscribe) extract ExtraNonce1 and ExtratNonce2_size
3 randomize ExtratNonce2 and save it as required size
4 from received (mining.notify) if not cleanJob ignore else extract the job data as Job
5 from Job extract job difficulty and calculate target
6 extract the rest Job info and start the mining process
7 coinbase_bin = coinb1+extranonce1+extranonce2+coinb2
8 coin_b_hash = double hash coinbase_bin
9 foreach x branch in merklebranches mrklRoot=coin_b_hash+x and double hash that
10 reverse mrklRoot
11 job_data=networkVersion + PreviousHash + mrklRoot + NetworkTime + NetworkBits; (All as recieved without reversing)
12 create nonce
13 toHash=job_data+nonce+padding
14 hash = double hash toHash
15 if hash>target goto 12
16 submit work (username,job_id,extranonce2,NetworkTime,nonce)

thanks in advance
Jump to: