Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FrankoHash - A DAG Free Mining Algorithm #5

Open
chrisfranko opened this issue Jun 6, 2021 · 5 comments
Open

FrankoHash - A DAG Free Mining Algorithm #5

chrisfranko opened this issue Jun 6, 2021 · 5 comments

Comments

@chrisfranko
Copy link
Member

chrisfranko commented Jun 6, 2021


xip: TBA
title: FRANKOHASH (formally Frankomoto)
author: Christopher Franko (@chrisjfranko)
type: Standards Track
category: Core
status: Draft
created: 2021-06-06
discussion: #5

Simple Summary

Remove the DAG from the mining algo, and make Expanse mining more unique and community distributed.

Abstract

Goals

  • Remove the DAG requirement
  • Capture a greater market share of miners
  • Increase the amount of viable mining devices
  • Makes Expanse more unique

Motivation

For the last 6 years Expanse has shared a mining algorithm with Ethereum. In that time Expanse has struggled to capture any meaningful marketshare of the available hashing power. This has left the network vulnerable and led to numerous 51% attacks. We implemented 60 block finality to help mitigate the risks but we feel like we can do more. Currently the DAG architecture creates a number of unnecessary memory requirements.

As it currently is, every 30,000 blocks the memory requirements to process a hash increases, thus phasing out old equipment. The theory was, as memory requirements become harder to satisfy, the likelihood someone would waste resources on an ASIC goes down. With the release of a range of ETHASH ASIC miners, that theory was proven wrong. As it turns out, knowing the memory hardness schedule in advance completely mitigates having one in the first place. ASIC resistance is and was always a fools errand.

Furthermore, with Ethereum moving to a completely Proof of Stake consensus engine Expanse is in a great position to inherit a large PoW marketshare. It is in our networks best interest to open the doors to as many miners as we can. Not only will Expanse be more accessible to older mining gear, it should help with Expanse distribution. The more devices that can mine Expanse, the more secure the network will be over all.

Specifics

NEW PoW:  keccak256(keccak512(RLPHash, nonce)) <= 2^256 / difficulty
OLD PoW:  keccak256(ethash(RLPHash, nonce), keccack512(RLPHash, nonce)) <= 2^256 / difficulty

Frankomoto(RLPHash, nonce) returns (digest, result){
      mix_digest = keccak512(RLPHash, nonce)[:32] // the last 32 bytes of the hash512 - 64 byte slice.
      result = keccak256(digest)
}

Basics

At Block XXX we change the consensus Algorithm from ethash to frankohash.

Updates

  • add Frankohash to the consensus directory
  • add Frankohash to the config params
  • create a fork block

Bounties

  • Create Frankohash from chfast/ethash
  • Create GPU Miner from NSFEthminer
  • New Mining Pool

Notes

Keeping Mix Digest

Ive only decided to keep the MixDigest to make it easier for Expanse to fit into other Ethereum implementations like Besu and keep even more changes down, BUT we could just as easily not have a mix digest and do keccak256(RLPHash, nonce). However, having the double hash in there could help secure expanse against preimage attacks in the event one of the algos are broken. This is why bitcoin uses sha256d.

Using another algorithim for the Pre POW "MixDigest"

We could certainly change this to sha256 or even sha512-256 and speed things up even further.

Implementation

https://github.com/expanse-org/go-expanse/tree/frankomoto2

Copyright

Copyright and related rights waived via CC0.
ghts waived via CC0.

@chrisfranko
Copy link
Member Author

chrisfranko commented Jun 12, 2021

The Rebirth Testnet

With the release of XIP 5 (Frankohash) came an implementation and new Testnet. Over the coming weeks, Expanse will be adding new infrastructure and an official implementation to GEXP. Participating in the Rebirth testnet is easy! Below we will show you how.

Compiling GEXP on Linux/OSX

git clone https://github.com/expanse-org/go-expanse.git
cd go-expanse
git checkout frkhash
make gexp

Initializing the Rebirth Network

mkdir ~/rebirth


build/bin/gexp init --datadir ~/rebirth new_genesis.json

Starting GEXP

build/bin/gexp --datadir ~/rebirth --rebirth --syncmode=fast --networkid 1337 --bootnodes "enode://b919ed8c5d5bd11dc896cf099d548b805a0626d5fb6ab23ea1be3d2924fdaa22a0c1cda547cb15c0ac82b60572ff66192406390c20a9f53c4d97efd2d952a1a4@128.199.51.233:4915, enode://fa16f60afd655f8e866ef65a43fe30be5313e61aac8c64c006bf13e53ed6ddb3342153d81db63ccfdeef8b8ee1fe5b16511a85c7544d2e85e4ca0ac549836a02@136.35.204.139:42786"  console

Create New Account & Start Mining from JS Console

 personal.newAccount()
 miner.setEtherbase(eth.accounts[0])
 miner.start()

 ethash.getHashrate()
 eth.hashrate

@shrikus
Copy link

shrikus commented Jun 14, 2021

On the grounds that the new algorithm will be much faster, I think that uint64 for nonce is not enough and it would be good to add extranonce as well.

@chrisfranko
Copy link
Member Author

Can you give an example? Not enough in what way?

@shrikus
Copy link

shrikus commented Jun 24, 2021

If the algorithm is modified in the following way:

NEW PoW:  keccak256(keccak512(RLPHash, nonce, nonce2)) <= 2^256 / difficulty

then it would be possible to implement a modern Stratum protocol like in Ravencoin:

https://github.com/RavenCommunity/kawpow-stratum-pool

so nonce2 will be composed of two parts, pool prefix and miner suffix, which will ensure maximum workload spread causing less duplicated searches and broader search area

@chrisfranko
Copy link
Member Author

Thats very interesting. I'll look into it further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants