Skip to content

Commit 7a84300

Browse files
authored
Merge pull request #11826 from joaolago1113/fix
Corrections to Implementation Code in Dagger-Hashimoto Algorithm Documentation
2 parents df45c10 + 566eb97 commit 7a84300

File tree

8 files changed

+16
-16
lines changed
  • public/content
    • developers/docs/consensus-mechanisms/pow/mining/mining-algorithms/dagger-hashimoto
    • translations
      • es/developers/docs/consensus-mechanisms/pow/mining/mining-algorithms/dagger-hashimoto
      • fr/developers/docs/consensus-mechanisms/pow/mining/mining-algorithms/dagger-hashimoto
      • it/developers/docs/consensus-mechanisms/pow/mining/mining-algorithms/dagger-hashimoto
      • ja/developers/docs/consensus-mechanisms/pow/mining/mining-algorithms/dagger-hashimoto
      • pt-br/developers/docs/consensus-mechanisms/pow/mining/mining-algorithms/dagger-hashimoto
      • tr/developers/docs/consensus-mechanisms/pow/mining/mining-algorithms/dagger-hashimoto
      • zh/developers/docs/consensus-mechanisms/pow/mining/mining-algorithms/dagger-hashimoto

8 files changed

+16
-16
lines changed

public/content/developers/docs/consensus-mechanisms/pow/mining/mining-algorithms/dagger-hashimoto/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ The algorithm used to generate the set of DAGs used to compute the work for a bl
143143
def get_prevhash(n):
144144
from pyethereum.blocks import GENESIS_PREVHASH
145145
from pyethereum import chain_manager
146-
if num <= 0:
146+
if n <= 0:
147147
return hash_to_int(GENESIS_PREVHASH)
148148
else:
149149
prevhash = chain_manager.index.get_block_by_number(n - 1)
@@ -186,7 +186,7 @@ def orig_hashimoto(prev_hash, merkle_root, list_of_transactions, nonce):
186186
shifted_A = hash_output_A >> i
187187
transaction = shifted_A % len(list_of_transactions)
188188
txid_mix ^= list_of_transactions[transaction] << i
189-
return txid_max ^ (nonce << 192)
189+
return txid_mix ^ (nonce << 192)
190190
```
191191

192192
Unfortunately, while Hashimoto is considered RAM hard, it relies on 256-bit arithmetic, which has considerable computational overhead. However, Dagger-Hashimoto only uses the least significant 64 bits when indexing its dataset to address this issue.

public/content/translations/es/developers/docs/consensus-mechanisms/pow/mining/mining-algorithms/dagger-hashimoto/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ El algoritmo utilizado para generar el conjunto de DAG usado para calcular el tr
143143
def get_prevhash(n):
144144
from pyethereum.blocks import GENESIS_PREVHASH
145145
from pyethereum import chain_manager
146-
if num <= 0:
146+
if n <= 0:
147147
return hash_to_int(GENESIS_PREVHASH)
148148
else:
149149
prevhash = chain_manager.index.get_block_by_number(n - 1)
@@ -186,7 +186,7 @@ def orig_hashimoto(prev_hash, merkle_root, list_of_transactions, nonce):
186186
shifted_A = hash_output_A >> i
187187
transaction = shifted_A % len(list_of_transactions)
188188
txid_mix ^= list_of_transactions[transaction] << i
189-
return txid_max ^ (nonce << 192)
189+
return txid_mix ^ (nonce << 192)
190190
```
191191

192192
Desafortunadamente, aunque Hashimoto se considera de RAM difícil, se basa en la aritmética de 256 bits, que tiene una sobrecarga computacional considerable. Sin embargo, Dagger-Hashimoto solo utiliza los 64 bits menos significativos al indexar su conjunto de datos para abordar este problema.

public/content/translations/fr/developers/docs/consensus-mechanisms/pow/mining/mining-algorithms/dagger-hashimoto/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ L'algorithme utilisé pour générer l'ensemble des DAG utilisés pour calculer
143143
def get_prevhash(n):
144144
from pyethereum.blocks import GENESIS_PREVHASH
145145
from pyethereum import chain_manager
146-
if num <= 0:
146+
if n <= 0:
147147
return hash_to_int(GENESIS_PREVHASH)
148148
else:
149149
prevhash = chain_manager.index.get_block_by_number(n - 1)
@@ -186,7 +186,7 @@ def orig_hashimoto(prev_hash, merkle_root, list_of_transactions, nonce):
186186
shifted_A = hash_output_A >> i
187187
transaction = shifted_A % len(list_of_transactions)
188188
txid_mix ^= list_of_transactions[transaction] << i
189-
return txid_max ^ (nonce << 192)
189+
return txid_mix ^ (nonce << 192)
190190
```
191191

192192
Malheureusement, bien que Hashimoto soit considéré comme de la RAM en dur, il repose sur l'arithmétique 256-bit, qui présente des frais supplémentaires de calcul considérables. Cependant, Dagger-Hashimoto n'utilise que les 64 bits les moins significatifs lors de l'indexation de son jeu de données pour résoudre ce problème.

public/content/translations/it/developers/docs/consensus-mechanisms/pow/mining/mining-algorithms/dagger-hashimoto/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ L'algoritmo usato per generare la serie di DAG usati per calcolare il lavoro per
143143
def get_prevhash(n):
144144
from pyethereum.blocks import GENESIS_PREVHASH
145145
from pyethereum import chain_manager
146-
if num <= 0:
146+
if n <= 0:
147147
return hash_to_int(GENESIS_PREVHASH)
148148
else:
149149
prevhash = chain_manager.index.get_block_by_number(n - 1)
@@ -186,7 +186,7 @@ def orig_hashimoto(prev_hash, merkle_root, list_of_transactions, nonce):
186186
shifted_A = hash_output_A >> i
187187
transaction = shifted_A % len(list_of_transactions)
188188
txid_mix ^= list_of_transactions[transaction] << i
189-
return txid_max ^ (nonce << 192)
189+
return txid_mix ^ (nonce << 192)
190190
```
191191

192192
Sfortunatamente, anche se Hashimoto è considerato gravoso per la RAM, si affida a un'aritmetica a 256 bit, che richiede molti calcoli. Per risolvere questo problema, Dagger-Hashimoto usa comunque solo i 64 bit meno significativi, indicizzando il proprio dataset.

public/content/translations/ja/developers/docs/consensus-mechanisms/pow/mining/mining-algorithms/dagger-hashimoto/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def quick_calc(params, seed, p):
143143
def get_prevhash(n):
144144
from pyethereum.blocks import GENESIS_PREVHASH
145145
from pyethereum import chain_manager
146-
if num <= 0:
146+
if n <= 0:
147147
return hash_to_int(GENESIS_PREVHASH)
148148
else:
149149
prevhash = chain_manager.index.get_block_by_number(n - 1)
@@ -186,7 +186,7 @@ def orig_hashimoto(prev_hash, merkle_root, list_of_transactions, nonce):
186186
shifted_A = hash_output_A >> i
187187
transaction = shifted_A % len(list_of_transactions)
188188
txid_mix ^= list_of_transactions[transaction] << i
189-
return txid_max ^ (nonce << 192)
189+
return txid_mix ^ (nonce << 192)
190190
```
191191

192192
残念ながら、ハシモトは RAM の消費が多いとみなされています。256 ビット演算に依存しており、計算にかなりのオーバーヘッドがあります。 しかし、ダガーハシモトでは、この問題に対処するため、最下位 64 ビットのみを使用してデータセットのインデックスを作成します。

public/content/translations/pt-br/developers/docs/consensus-mechanisms/pow/mining/mining-algorithms/dagger-hashimoto/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ O algoritmo usado para gerar o conjunto de DAGs usados para computar o trabalho
143143
def get_prevhash(n):
144144
from pyethereum.blocks import GENESIS_PREVHASH
145145
from pyethereum import chain_manager
146-
if num <= 0:
146+
if n <= 0:
147147
return hash_to_int(GENESIS_PREVHASH)
148148
else:
149149
prevhash = chain_manager.index.get_block_by_number(n - 1)
@@ -186,7 +186,7 @@ def orig_hashimoto(prev_hash, merkle_root, list_of_transactions, nonce):
186186
shifted_A = hash_output_A >> i
187187
transaction = shifted_A % len(list_of_transactions)
188188
txid_mix ^= list_of_transactions[transaction] << i
189-
return txid_max ^ (nonce << 192)
189+
return txid_mix ^ (nonce << 192)
190190
```
191191

192192
Infelizmente, enquanto Hashimoto é considerado de uso intenso de RAM, ele depende da aritmética de 256 bits, o que tem uma sobrecarga computacional considerável. No entanto, Dagger-Hashimoto usa apenas os 64 bits menos significativos ao indexar seu conjunto de dados para resolver esta questão.

public/content/translations/tr/developers/docs/consensus-mechanisms/pow/mining/mining-algorithms/dagger-hashimoto/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Bir blok için çalışmayı hesaplamak için kullanılan DAG setini oluşturmak
143143
def get_prevhash(n):
144144
from pyethereum.blocks import GENESIS_PREVHASH
145145
from pyethereum import chain_manager
146-
if num <= 0:
146+
if n <= 0:
147147
return hash_to_int(GENESIS_PREVHASH)
148148
else:
149149
prevhash = chain_manager.index.get_block_by_number(n - 1)
@@ -186,7 +186,7 @@ def orig_hashimoto(prev_hash, merkle_root, list_of_transactions, nonce):
186186
shifted_A = hash_output_A >> i
187187
transaction = shifted_A % len(list_of_transactions)
188188
txid_mix ^= list_of_transactions[transaction] << i
189-
return txid_max ^ (nonce << 192)
189+
return txid_mix ^ (nonce << 192)
190190
```
191191

192192
Ne yazık ki, Hashimoto RAM zor olarak kabul edilirken, önemli hesaplama yükü olan 256-bit aritmetik kullanır. Ancak Dagger-Hashimoto, bu sorunu çözmek için veri kümesini indekslerken yalnızca en az önemli 64 biti kullanır.

public/content/translations/zh/developers/docs/consensus-mechanisms/pow/mining/mining-algorithms/dagger-hashimoto/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def quick_calc(params, seed, p):
143143
def get_prevhash(n):
144144
from pyethereum.blocks import GENESIS_PREVHASH
145145
from pyethereum import chain_manager
146-
if num <= 0:
146+
if n <= 0:
147147
return hash_to_int(GENESIS_PREVHASH)
148148
else:
149149
prevhash = chain_manager.index.get_block_by_number(n - 1)
@@ -186,7 +186,7 @@ def orig_hashimoto(prev_hash, merkle_root, list_of_transactions, nonce):
186186
shifted_A = hash_output_A >> i
187187
transaction = shifted_A % len(list_of_transactions)
188188
txid_mix ^= list_of_transactions[transaction] << i
189-
return txid_max ^ (nonce << 192)
189+
return txid_mix ^ (nonce << 192)
190190
```
191191

192192
不幸的是,虽然 Hashimoto 被视为 RAM 硬件,但它依靠的是 256 位计算,计算量非常之大。 然而,Dagger-Hashimoto 在索引其数据集时仅使用最低有效 64 位来解决此问题。

0 commit comments

Comments
 (0)