2

I am attempting to evaluate the exact implementation of the MIX block of the hashing mining. There is much information (may be too much) but could not locate any that describes the detailed implementation of the MIX function.

Here is a diagram that explains what exactly I am looking for:

enter image description here

I am interested in the EXACT steps for implementing a "Mixing Function" block.

1

Here's a basic Python implementation of what I think you're looking for, from the Ethash wiki. You'll need to grab the various constants from elsewhere on the page.

def calc_dataset(full_size, cache):
    return [calc_dataset_item(cache, i) for i in range(full_size // HASH_BYTES)]

def calc_dataset_item(cache, i):
    n = len(cache)
    r = HASH_BYTES // WORD_BYTES
    # initialize the mix
    mix = copy.copy(cache[i % n])
    mix[0] ^= i
    mix = sha3_512(mix)
    # fnv it with a lot of random cache nodes based on i
    for j in range(DATASET_PARENTS):
        cache_index = fnv(i ^ j, mix[j % r])
        mix = map(fnv, mix, cache[cache_index % n])
    return sha3_512(mix)

The fnv() call is the Fowler–Noll–Vo hash function.


For an actual working version that's out in the wild, take a look at Geth's algorithm.go. Again, generateDatasetItem() is probably what you're looking for.

3
  • I am not looking for code. I am looking for a flow chart as you could find for AES256 encryption algorithm and others. I want to emulate a design that will balance properly between the "Memory Hardness" limit and the "mixing function" potential rate (implemented in hardware)
    – Moti
    Oct 2 '18 at 16:34
  • Okay, other people may know of something, so I'll defer to any other answers you get. Oct 2 '18 at 16:49
  • Thanks for your help on this one. Will try to decipher the Python code. It seems that a starting point should be SHA3_512.
    – Moti
    Oct 3 '18 at 0:11
0

Here is a really good analysis of running Ethash on sample GPU hardware: https://github.com/LeastAuthority/ethereum-analyses/blob/master/PoW.md

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.