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

PoW hardfork network upgrade spec and guide #331

Open
h4x3rotab opened this issue Jun 16, 2018 · 9 comments
Open

PoW hardfork network upgrade spec and guide #331

h4x3rotab opened this issue Jun 16, 2018 · 9 comments
Labels

Comments

@h4x3rotab
Copy link
Member

h4x3rotab commented Jun 16, 2018

(This issue will be converted to a Wiki page when the content is fixed)

0. This hardfork network upgrade will not create a new coin

1. Changes

  1. Fork height: 536200 (accomplished via successful hardfork on July 3rd, 2018, at 9:59:26 PM UTC)
  2. Switch to Equihash-BTG
  3. Difficulty adjustment: Testnet hardfork upgrade #330
    • At the fork height, the difficulty will be reduced to 1/100th
    • Subsequent per-block Difficulty adjustments will be made via the LWMA difficulty adjustment algorithm.

2. Run a new full node

Anyone running full node should upgrade to the latest version v0.15.1, which can be compiled from 0.15 branch:
https://github.com/BTCGPU/BTCGPU/tree/0.15

Precompiled binaries (v0.15.1):
https://github.com/BTCGPU/BTCGPU/releases/tag/v0.15.1

If you are running it on the mainnet or the testnet-v3 (learn more), the in-place upgrade should be ok. If you are running on the old testnet, you need to clean up the testnet datadir first.

3. Upgrade guide for pool operators

You will need to upgrade the full node as well as the pool software. The full node can be updated in-place. Details on updating pool software follow below. Please don't hesitate to reach out to us for help:

Why do we need to upgrade the pool software?

The change in PoW algorithm means that both the validation function and solution size will be different, and the block header size has changed. Old pools won't support the new blocks.

Is there any working pool software?

We have a reference implementation of z-nomp for the fork:
https://github.com/BitcoinGold-mining/z-nomp-bitcoin-gold

Please carefully test it before using it on production and run it at your own risk. The BTG Org can't take any responsibility for losses potentially caused by running the reference pool.

What if we want to change our own pool?

Please change the following components and check commits of the reference z-nomp:

  • Block header handling: solution size is now 100 vs. the original 1344 bytes. (Don't forget the leading encoded length before the solution is also changed)
  • PoW validation

There are a few useful tools for pool development in this GitHub project:
https://github.com/BitcoinGold-mining

How to test the pool?

You can run your pool on the BTG testnet, which has already forked to the new code. Then you can connect any working miner to the pool. (nheqminer and EWBF currently work, and more are being announced by their developers.)

The naive nheqminer on a typical GPU finds ~2.5 Sol/s while EWBF can be 10x more efficient. EWBF Cuda Equihash Miner v0.2 should work with the following parameters: --algo 144_5 --pers BgoldPoW.

Upgrade procedure

We suggest running a new pool for the upgraded chain. Unlike Monero, it's difficult to do an in-place pool upgrade because Equihash-BTG (144,5) is very different than the original Equihash (200,9). The recommended procedure is:

  1. Replace the full node with v0.15.1 (or the latest master branch)
  2. Launch a new pool for upgraded chain
  3. Ask miners to download the new miner software
  4. Miners can keep mining on their current pool before the fork
  5. When it reaches the fork height, stop the old pool and turn on the new pool
    • The old pool won't find any more valid blocks because the full node will reject Equihash (200,9) blocks.
  6. Miners turn off the old software and turn on the new software

4. Upgrade guide for miners

Please follow the guide from your pool if they provide one. You should know the information below:

  1. NV miners: EWBF, see above for details (the list is growing)
  2. AMD miners: lolMiner, ...
  3. It's likely that you will need to watch the blockchain and switch your miners manually when it reaches the fork height.
  4. There's an intentional difficulty discount at the time of the fork which should make it temporarily extra-profitable to mine.

The difficulty will be reduced to 1/100th of what it was before. This is partly to compensate for the new PoW being much harder, and partly to compensate for the possibility that some miners or pools are slow to upgrade. This will reduce the likelihood of a slow-block start, but means that mining immediately after the fork will temporarily be extra-profitable until the DAA adjusts the Difficulty and hashrates stabilize.

Before the hardfork upgrade:

  1. Make sure your pool will support BTG hardfork network upgrade
  2. Install the new miner software
  3. Config and test the miner on a testnet pool, either from your usual pool or our official testnet pool: https://test-pool.bitcoingold.org (Backup: http://test-pool.btcgpu.org, http://btg-testnet.miningspot.net/)
  4. Wait for the hardfork block height 536200

Where to check the block height?

During the hardfork upgrade:

  1. Stop the old miner
  2. Start the new miner

5. Upgrade guide for Exchanges

Exchanges should pause BTG deposits and withdrawals one day before the fork height. When the hashrate of the blockchain becomes stable after the fork, Exchanges can resume regular deposit and withdrawal operations.

A fork period typically has no effect on trading with coins that are already held on Exchange.

Risk warning:

  • Not pausing the wallet before the hardfork may result in loss of funds because reorgs can happen during the fork
  • Resuming wallets too early after the hardfork may result in losing money because reorgs can occur during the fork
  • Not upgrading full nodes before the fork may result in loss of funds because an old node may stay on an abandoned chain

We are more than willing to help our partners to prepare for the hardfork. Please don't hesitate to contact us for help:

6. Upgrade guide for Wallet Providers

Wallet service providers should upgrade the full node and change the block validation logic before the fork.

Risk warning:

  • Not upgrading the full node before the fork may result in loss of funds because you may stay on an abandoned chain

7. Upgrade guide for Payment Gateways

Similar to exchanges, payment gateway providers should:

  • Upgrade the full node before the fork
  • Pause the service one day before the fork height
  • Resume the service when the hashrate becomes stable after the fork

Risk warning: same as Exchanges.

8. Upgrade guide for Blockchain Explorers and other services

All services should upgrade the full node before the fork.

9. Upgrade guide for users

Users should upgrade their wallet software as directed by their wallet provider.

Users should avoid sending or receiving BTG during the fork. More specifically, we suggest all users stop sending or receiving BTG at least a few blocks before the fork, and wait for an official announcement of the blockchain being stable enough after the fork before resuming activity.

Please stay tuned. Watch our official twitter account, and subscribe to our email notifications (The homepage is temporarily unavailable due to an network attack. It will be back soon).

@h4x3rotab
Copy link
Member Author

We will launch an officlal testnet pool for testing before the fork height. It will be useful for testing.

@h4x3rotab
Copy link
Member Author

h4x3rotab commented Jun 17, 2018

How to contribute to the hardfork?

Run a mainnet or testnet full node in listening mode and support the network! We will make a new release (v0.15.1) but before that, please compile your own node by following the doc doc/build-unix.md.

@h4x3rotab h4x3rotab changed the title Testnet PoW fork spec and guide PoW hardfork network upgrade spec and guide Jun 20, 2018
@h4x3rotab
Copy link
Member Author

h4x3rotab commented Jun 22, 2018

中文版

0. 本次硬分叉升级只是网络升级,不会产生新币

1. 改动

  1. 分叉高度: 536200 (已于北京时间7月4日05:59:26分叉)
  2. PoW算法改为Equihash-BTG
  3. 难度调整算法: Testnet hardfork upgrade #330
    • 在分叉高度,难度将会暂时降低到百分之一(降低100倍)
    • 在45个区块后激活LWMA难度调整算法,每个区块都会触发动态难度调整

2. 运行全节点

所有人都需要把全节点升级到 v0.15.1,此版本可以编译自0.15分支:
https://github.com/BTCGPU/BTCGPU/tree/0.15

安装包 (v0.15.1):
https://github.com/BTCGPU/BTCGPU/releases/tag/v0.15.1

如果你的全节点是运行在主网或者testnet3上 (什么是testnet3?),直接替换掉旧的全节点即可。但如果你的全节点还运行在旧的testnet上(在2月已经被重置),除了替换掉全节点,还需要删除数据目录下的testnet3目录。

3. Upgrade guide for pool operators

You will need to upgrade the full node as well as the pool software. The full node can be updated in-place. Details on updating pool software follow below. Please don't hesitate to reach out to us for help:

Why do we need to upgrade the pool software?

The change in PoW algorithm means that both the validation function and solution size will be different, and the block header size has changed. Old pools won't support the new blocks.

Is there any working pool software?

We have a reference implementation of z-nomp for the fork:
https://github.com/BitcoinGold-mining/z-nomp-bitcoin-gold

Please carefully test it before using it on production and run it at your own risk. The BTG Org can't take any responsibility for losses potentially caused by running the reference pool.

What if we want to change our own pool?

Please change the following components and check commits of the reference z-nomp:

  • Block header handling: solution size is now 100 vs. the original 1344 bytes. (Don't forget the leading encoded length before the solution is also changed)
  • PoW validation

There are a few useful tools for pool development in this GitHub project:
https://github.com/BitcoinGold-mining

How to test the pool?

You can run your pool on the BTG testnet, which has already forked to the new code. Then you can connect any working miner to the pool. (nheqminer and EWBF currently work, and more are being announced by their developers.)

The naive nheqminer on a typical GPU finds ~2.5 Sol/s while EWBF can be 10x more efficient. EWBF Cuda Equihash Miner v0.2 should work with the following parameters: --algo 144_5 --pers BgoldPoW.

Upgrade procedure

We suggest running a new pool for the upgraded chain. Unlike Monero, it's difficult to do an in-place pool upgrade because Equihash-BTG (144,5) is very different than the original Equihash (200,9). The recommended procedure is:

  1. Replace the full node with v0.15.1 (or the latest master branch)
  2. Launch a new pool for upgraded chain
  3. Ask miners to download the new miner software
  4. Miners can keep mining on their current pool before the fork
  5. When it reaches the fork height, stop the old pool and turn on the new pool
    • The old pool won't find any more valid blocks because the full node will reject Equihash (200,9) blocks.
  6. Miners turn off the old software and turn on the new software

4. 矿工升级指南

如果你熟悉的矿池提供了教程,请按照他们提供的教程操作。在这里提供一些基本的信息:

  1. NVIDIA可用的矿机有: EWBF (矿机列表持续更新中...)
  2. AMD可用的矿机有: lolMiner
  3. 你可能需要一直监视区块高度,因为在到达升级高度536200时需要切换矿机和矿池
  4. 在到达升级高度时,区块链的难度会下降100倍(降至百分之一),因此可能在升级初期会取得更高获利

在到达升级高度时,区块链的挖矿难度会按照设定降低100倍。原因有两个:其一是新的PoW算法难度远大于原本的Equihash,同样的矿机下新算法的Sol/s较低,其二是一些矿池或者矿工会因为准备不足,暂停BTG挖矿。为了平衡算力降低,我们按比例设定了难度降低,这样可以避免难度过高出块慢的问题。同时因为难度降低,挖矿也会更容易获利。在45个区块后,每个区块都会触发动态难度调整算法,最终难度会和算力保持平衡,恢复到升级前前稳定的状态。

升级前:

  1. 联系矿池,确定矿池支持这次BTG的算法升级
  2. 安装好新的矿机软件
  3. (可选)用支持新算法的矿机在测试网络矿池上挖矿,测试矿机配置。如果你的矿池没有提供测试用矿池,可以尝试官方的测试网络矿池: http://test-pool.bitcoingold.org (备用地址:http://test-pool.btcgpu.org,http://btg-testnet.miningspot.net/)
  4. 等待区块高度到达升级高度536200

在哪里看区块高度?

硬分叉升级时:

  1. 关闭旧矿机
  2. 启动新矿机

5. 交易所升级指南

交易所应该尽快升级全节点,并在分叉升级发生的前一天停止冲提币。在分叉后,等到算力稳定下来即可开放冲提币。

在这次升级中交易所的场内交易可以不受影响。

风险提示:

  • 如果没有在分叉前暂停冲提币,可能会由于Reorg(区块链重组)导致丢币
  • 如果在分叉后过早开放冲提币,可能会由于Reorg导致丢币
  • 如果没有升级全节点,则有可能由于进入了一条错误的链而丢币

BTG团队非常愿意帮助合作伙伴应对硬分叉升级中遇到的各种问题,请通过以下渠道联系我们:

6. Upgrade guide for Wallet Providers

Wallet service providers should upgrade the full node and change the block validation logic before the fork.

Risk warning:

  • Not upgrading the full node before the fork may result in loss of funds because you may stay on an abandoned chain

7. Upgrade guide for Payment Gateways

Similar to exchanges, payment gateway providers should:

  • Upgrade the full node before the fork
  • Pause the service one day before the fork height
  • Resume the service when the hashrate becomes stable after the fork

Risk warning: same as Exchanges.

8. Upgrade guide for Blockchain Explorers and other services

All services should upgrade the full node before the fork.

9. 普通用户升级指南

普通用户应该参照使用中的钱包的提示升级钱包。

同时,在硬分叉升级发生前后应该避免收发币。我们建议在区块链达到分叉高度的前几十个区块时暂停收发币,并等待官方通知。我们会在区块链足够稳定时向社区发出通知。

请时刻留意我们的官方 Twitter账号 并订阅我们的 邮件通知 (目前bitcoingold.org网站正在被攻击,等网络恢复后即可订阅)。

@holyr00d
Copy link

any news on amd miners?

@h4x3rotab
Copy link
Member Author

@R00dNet lolMiner does the job: https://bitcointalk.org/index.php?topic=4591317.0

@holyr00d
Copy link

no it does not. I run a rx 480 8gb reference and does not even pick up card. it is a very buggy miner, just read the comments.... tried it when it was launched. quite disappointing.

@oliverw
Copy link

oliverw commented Aug 16, 2018

Is the pool reference implementation https://github.com/BitcoinGold-mining/z-nomp-bitcoin-gold really working? I'm getting block-decode failures when testing this code against the current testnet.

@martin-key
Copy link
Collaborator

martin-key commented Aug 16, 2018 via email

@kaldrako1
Copy link

Create a trillion dollar coin

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

No branches or pull requests

7 participants
@oliverw @h4x3rotab @martin-key @holyr00d @kaldrako1 and others