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

Add Holesky testnet #2982

Merged
merged 7 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/blockchain/test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ describe('blockchain test', () => {
)
})

it('should initialize holesky correctly', async () => {
// Taken from: https://github.com/eth-clients/holesky/blob/36e4ff2d5138dcb2eb614f0f60fdb060b2adc1e2/README.md#metadata
const holeskyHash = '0xff9006519a8ce843ac9c28549d24211420b546e12ce2d170c77a8cca7964f23d'
const common = new Common({ chain: Chain.Holesky })
const blockchain = await Blockchain.create({
common,
})
const genesisHash = blockchain.genesisBlock.hash()

assert.deepEqual(bytesToHex(genesisHash), holeskyHash, 'correct genesis hash for holesky')
})

it('should initialize correctly with Blockchain.fromBlocksData()', async () => {
const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Chainstart })
const blockchain = await Blockchain.fromBlocksData(blocksData, {
Expand Down
116 changes: 116 additions & 0 deletions packages/common/src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,4 +448,120 @@ export const chains: ChainsDict = {
'enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.sepolia.ethdisco.net',
],
},
holesky: {
name: 'holesky',
chainId: 17000,
networkId: 17000,
defaultHardfork: 'paris',
consensus: {
type: 'pos',
algorithm: 'casper',
},
comment: 'PoS test network to replace Goerli',
url: 'https://github.com/eth-clients/holesky/',
genesis: {
baseFeePerGas: '0x3B9ACA00',
difficulty: '0x01',
extraData: '0x686f77206d7563682069732074686520666973683f',
gasLimit: '0x17D7840',
nonce: '0x0000000000001234',
timestamp: '0x65046234',
},
hardforks: [
{
name: 'chainstart',
block: 0,
forkHash: '0x01d65a8c',
},
{
name: 'homestead',
block: 0,
forkHash: '0x01d65a8c',
},
{
name: 'tangerineWhistle',
block: 0,
forkHash: '0x01d65a8c',
},
{
name: 'spuriousDragon',
block: 0,
forkHash: '0x01d65a8c',
},
{
name: 'byzantium',
block: 0,
forkHash: '0x01d65a8c',
},
{
name: 'constantinople',
block: 0,
forkHash: '0x01d65a8c',
},
{
name: 'petersburg',
block: 0,
forkHash: '0x01d65a8c',
},
{
name: 'istanbul',
block: 0,
forkHash: '0x01d65a8c',
},
{
name: 'muirGlacier',
block: 0,
forkHash: '0x01d65a8c',
},
{
name: 'berlin',
block: 0,
forkHash: '0x01d65a8c',
},
{
name: 'london',
block: 0,
forkHash: '0x01d65a8c',
},
{
name: 'paris',
ttd: '0',
block: 0,
forkHash: '0x01d65a8c',
},
{
name: 'mergeForkIdTransition',
block: 0,
forkHash: '0x01d65a8c',
},
{
name: 'shanghai',
block: null,
timestamp: '1694790240',
forkHash: '0x445efa46',
},
{
name: 'cancun',
block: null,
timestamp: '2000000000',
forkHash: '0x104c16da',
},
],
bootstrapNodes: [
{
ip: '146.190.13.128',
port: 30303,
id: 'ac906289e4b7f12df423d654c5a962b6ebe5b3a74cc9e06292a85221f9a64a6f1cfdd6b714ed6dacef51578f92b34c60ee91e9ede9c7f8fadc4d347326d95e2b',
location: '',
comment: 'bootnode 1',
},
{
ip: '178.128.136.233',
port: 30303,
id: 'a3435a0155a3e837c02f5e7f5662a2f1fbc25b48e4dc232016e1c51b544cb5b4510ef633ea3278c0e970fa8ad8141e2d4d0f9f95456c537ff05fdf9b31c15072',
location: '',
comment: 'bootnode 2',
},
],
},
}
5 changes: 5 additions & 0 deletions packages/common/src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export enum Chain {
Mainnet = 1,
Goerli = 5,
Sepolia = 11155111,
Holesky = 17000,
}

/**
Expand Down Expand Up @@ -33,6 +34,10 @@ export const ChainGenesis: Record<Chain, GenesisState> = {
blockNumber: BigInt(0),
stateRoot: hexToBytes('0x5eb6e371a698b8d68f665192350ffcecbbbf322916f4b51bd79bb6887da3f494'),
},
[Chain.Holesky]: {
blockNumber: BigInt(0),
stateRoot: hexToBytes('0x69d8c9d72f6fa4ad42d4702b433707212f90db395eb54dc20bc85de253788783'),
},
}

export enum Hardfork {
Expand Down
Loading