Algorithm - explanation

@okzx @mikaelh - thanks guys for your continued support. apologies to be a bit of pain but I still have some queries -

  1. Please could you clarify on how does does one mine(which i guess is equivalent to finding new chains) when the origin is dependent on a variable which keeps changing by the minute ? Does it mean that one has to find these chains within the period of 1 minute before the hash changes again…which would seem like a very little time to find such a chain ?

  2. Also how does one include a transaction into the block or where do I get one if hypothetically I manage to find a chain which satisfies the criteria mentioned above.

cheers,
op

  1. Short answer. Yes. But that is by design. We want to have block times of one minute. That means that the difficulty level will be set so that using the combined computing power of the network that on average only one Cunningham chain that meets the requirements to be submitted as a block is found.

  2. I believe the transactions are stored in the block data as well as included in the hash for that block.

Well, you need to design your algorithm so that you get fast results. The reference client finds a bunch chain candidates and tests in less than one second.

If you’re using the getwork protocol, the daemon picks the transactions and makes the block. If you’re using getblocktemplate, you need to construct your own block (see libblkmaker).

@mikaelh @okzx thanks a ton…i’ll assimilate all this complexity before coming back w/ more :slight_smile:

cheers,
op

Block 354639 - http://primecoin.21stcenturymoneytalk.org/index.php?block_hash=f9909f15443fca320f2b38559e641855017cc9a9c9625f34d705082c14f7fe96

PrimeOrigin - 910349017770326773100803360454591087592649950817412857064426552616187722846458158311925176557280

Previous Block Hash - 998ec5856d6e0133360510414598a1941d2d03d929234112614346f84007a296 = [69456121357665805563614502505635608822143681338101999189895725832307621733014] (decimal equivalent)

I have checked that primeorigin is not actually divisible by the previous block hash.

@mikaelh @okzx Please can either of you confirm if this is the block hash which you had mentioned…

You need to use the “block header hash”.

In Primecoin mining the origin is composed like this: origin = headerHash * primorial * candidateMultiplier

The header hash is an intermediate hash calculated from the block header (it is NOT the final block hash). It’s a 256-bit number that is required to be greater than 2^255.

What he is referring to is commonly called the “block header hash”. Which is documented:

Well, the header hash can be defined like this: blockHeaderHash = HASH(nVersion, hashPrevBlock, hashMerkleRoot, nTime, nBits, nNonce)