The second execution client for chain 2800: 23 files that let an independent implementation, in a different language on a different codebase, follow the chain and reach the same state. Published because the files derive from Nethermind under LGPL-3.0, and because a chain whose node software cannot be read cannot have independent operators. Nothing here is useful without upstream Nethermind. Contains no keys, no node addresses and no operational configuration. Two test files carried absolute paths and a host name from the machine they were written on; both were replaced with portable equivalents before this commit, which also makes the tests runnable by anyone. The README states the limits plainly: this client follows and validates, it does not produce mainnet blocks, and it has never been audited by a third party.
35 lines
945 B
C#
35 lines
945 B
C#
// Keccak-256 (Ethereum's pre-standard SHA-3) via BouncyCastle, plus hex helpers.
|
|
|
|
using System;
|
|
using Org.BouncyCastle.Crypto.Digests;
|
|
|
|
namespace Nethermind.AerePqc.Qbft;
|
|
|
|
public static class Keccak256
|
|
{
|
|
public static byte[] Hash(byte[] data)
|
|
{
|
|
var d = new KeccakDigest(256);
|
|
d.BlockUpdate(data, 0, data.Length);
|
|
var outp = new byte[32];
|
|
d.DoFinal(outp, 0);
|
|
return outp;
|
|
}
|
|
}
|
|
|
|
public static class Hex
|
|
{
|
|
public static byte[] Decode(string s)
|
|
{
|
|
if (s.StartsWith("0x") || s.StartsWith("0X")) s = s.Substring(2);
|
|
if (s.Length == 0) return Array.Empty<byte>();
|
|
if ((s.Length & 1) != 0) s = "0" + s;
|
|
var b = new byte[s.Length / 2];
|
|
for (int i = 0; i < b.Length; i++)
|
|
b[i] = Convert.ToByte(s.Substring(i * 2, 2), 16);
|
|
return b;
|
|
}
|
|
|
|
public static string Encode(byte[] b) => "0x" + Convert.ToHexString(b).ToLowerInvariant();
|
|
}
|