# Dev notes - w/c 13 May 2024
## Reviewing pk910's previous work + using geth ChainConfig
**Geth local setup**
Make sure golang version is up to date
Pull latest changes to my fork & rebuild
`git remote add upstream git@github.com:ethereum/go-ethereum.git`
`git pull upstream master`
`make geth`
Update personal access token if needed
`git remote remove origin`
`git remote add origin https://<token>@github.com/atkinsonholly/go-ethereum.git`
**Running ephemery locally with my geth fork**
Get the latest ephemery version
https://github.com/ephemery-testnet/ephemery-genesis/releases
Delete geth datadir and make sure that my geth fork is initialized with the latest ephemery version
Note: not needed if running with flag (below)
`./build/bin/geth --datadir ../gethData init ../testnet-all/genesis.json`
Launch hol-geth with latest params (from `nodevars_env.txt`) without flag
`./build/bin/geth --datadir ../gethData --port 30303 --http --http.addr 0.0.0.0 --http.port 8545 --http.api eth,net,personal,web3 --ws --ws.addr 0.0.0.0 --ws.port 8546 --ws.api eth,net,personal,web3 --authrpc.jwtsecret=/tmp/jwtsecret --syncmode=full --bootnodes "enode://50a54ecbd2175497640bcf46a25bbe9bb4fae51d7cc2a29ef4947a7ee17496cf39a699b7fe6b703ed0feb9dbaae7e44fc3827fcb7435ca9ac6de4daa4d983b3d@137.74.203.240:30303" --networkid 39438128`
**Running ephemery locally with my geth fork - now with ephemery flag**
Launch hol-geth with flag (don't forget to rebuild!)
`./build/bin/geth --ephemery`
The following error results from using:
```
g := new(Genesis)
reader := strings.NewReader(EphemeryAllocData)
if err := json.NewDecoder(reader).Decode(g); err != nil {
panic(err)
}
```

Changing to read EphemeryAllocData as GenesisAlloc means the whole config isn't sought from `genesis_alloc.go`, yet there are still import issues to fix:

Updating the reset period and original timestamp:

Deleting chaindata at default location means that geth can start:

After updating to latest ephemery default settings and verifying ChainId (shown in logs) and timestamp are correctly calculated (used debugger):

Need to correctly format alloc:

**TODO:**
- [x] Fix iteration calculation in `genesis.go` - actual chainId is currently CHAIN_ID="39438128"
- [x] Review error in logs "Head block is not reachable" => Shown if there is no chaindata at the default location
- [x] Refactor `func DefaultEphemeryGenesisBlock()` for consistency with other testnets
- [ ] Fix config issue above in`genesis.go` relating to import/use of EphemeryAllocData vs ephemery chain config
- [ ] Review EphemeryAllocData format. Since KilnData was removed it appears this format is no longer used and I should use a new format for ephemeryAllocData instead
- [ ] Review where to include `minGenesisTimestamp` and `genesisDelay` - should these be in `genesis.go` or in `config.go`?
- [ ] Update the ephemery var names to correctly reflect EIP spec
- [ ] Review where to define (or not) Coinbase, Mixhash, ParentHash
**Observations:**
- MIN_GENESIS_TIME (1638471600) not easy to find in ephemery resources
- Debugging in geth as follows
`./build/bin/geth --ephemery --verbosity 4`
`log.Debug("msg", key, val)`