{"id":18150302,"url":"https://github.com/jesserc/hardhat-poa-geth-integration","last_synced_at":"2025-06-14T21:32:26.173Z","repository":{"id":221031743,"uuid":"752832179","full_name":"Jesserc/Hardhat-PoA-Geth-Integration","owner":"Jesserc","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-05T18:16:12.000Z","size":224,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T22:42:52.258Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Jesserc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-04T23:00:05.000Z","updated_at":"2024-06-12T08:21:10.000Z","dependencies_parsed_at":"2024-02-05T20:37:21.796Z","dependency_job_id":"0af127f1-c5dc-487e-af26-13a888ad245c","html_url":"https://github.com/Jesserc/Hardhat-PoA-Geth-Integration","commit_stats":null,"previous_names":["jesserc/hardhat-poa-geth-integration"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Jesserc/Hardhat-PoA-Geth-Integration","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jesserc%2FHardhat-PoA-Geth-Integration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jesserc%2FHardhat-PoA-Geth-Integration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jesserc%2FHardhat-PoA-Geth-Integration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jesserc%2FHardhat-PoA-Geth-Integration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jesserc","download_url":"https://codeload.github.com/Jesserc/Hardhat-PoA-Geth-Integration/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jesserc%2FHardhat-PoA-Geth-Integration/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259887267,"owners_count":22926893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-02T00:08:41.414Z","updated_at":"2025-06-14T21:32:26.146Z","avatar_url":"https://github.com/Jesserc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hardhat-PoA-Geth Integration\n\nCreating and connecting a private Go-Ethereum network with Hardhat\n\n## Nodes Information\n\n- **Node chainId**\n  - `19026` - bytes4(abi.encodePacked(\"JR\"))\n- **Node 1:**\n  - Public key: 0x3E835c623Bb57926140B3f4C9d945A4d095e6995\n  - Password: 123456\n- **Node 2:**\n  - Public key: 0x8A05cE0a845599beD82f13589aFc2F81Ea256Ebd\n  - Password: 123456\n\n## Steps to Set Up Nodes\n\n1. Create directories for nodes:\n\n   ```bash\n   mkdir node1\n   mkdir node2\n   ```\n\n2. Initialize Node 1:\n\n   ```bash\n   geth --datadir node1 account new\n   geth init --datadir node1 genesis.json\n   ```\n\n3. Initialize Node 2:\n\n   ```bash\n   geth --datadir node2 account new\n   geth init --datadir node2 genesis.json\n   ```\n\n4. Create and start Bootstrap Node:\n\n   ```bash\n   bootnode --genkey boot.key\n   bootnode -nodekey boot.key -addr :30305\n   ```\n\n5. Start Node 1:\n\n   ```bash\n   geth --datadir node1 \\\n        --port 30306 \\\n        --bootnodes 'enode://86350457e8966ac7c80802d8b1a1dccb06b22136ff7f416c3a6ccc4947d9baa2503011dc7e74735e23d560fd50c15dada85d2a378649947dcde17abc020afd8e@127.0.0.1:0?discport=30305' \\\n        --networkid 123454321 \\\n        --unlock 0x3e6441efd0aba016be6a6357eec79fafd4433f4d \\\n        --password node1/password.txt \\\n        --authrpc.port 8551 \\\n        --mine \\\n        --miner.etherbase 0x3e6441efd0aba016be6a6357eec79fafd4433f4d \\\n        --http \\\n        --http.api 'web3,eth,net,debug,personal' \\\n        --http.corsdomain '*' \\\n        --allow-insecure-unlock \\\n        --http.port 30306\n   ```\n\n6. Start Node 2:\n\n   ```bash\n   cd ../node2\n   geth --datadir node2 \\\n        --port 30307 \\\n        --bootnodes 'enode://86350457e8966ac7c80802d8b1a1dccb06b22136ff7f416c3a6ccc4947d9baa2503011dc7e74735e23d560fd50c15dada85d2a378649947dcde17abc020afd8e@127.0.0.1:0?discport=30305' \\\n        --networkid 123454321 \\\n        --unlock 0x45750942b281a91226b2f7781eca133caf6a592b \\\n        --password node2/password.txt \\\n        --authrpc.port 8552\n   ```\n\n7. Connect to Node 1 (start Geth JS console):\n\n   ```bash\n   # On a new terminal run\n   geth attach node1/data/geth.ipc\n   ```\n\n8. Interact with Nodes:\n\n   ```javascript\n   // Send transaction from Node 1 to Node 2\n   eth.sendTransaction({\n     to: \"0x45750942b281a91226b2f7781eca133caf6a592b\",\n     from: eth.accounts[0],\n     value: 25000,\n   });\n\n   // Check balance of Node 2\n   eth.getBalance(\"0x45750942b281a91226b2f7781eca133caf6a592b\");\n   ```\n\n## Scheduling Hard Forks (Example)\n\n1. Update `genesis.json`, e.g:\n\n   ```json\n   {\n     \"config\": {\n       \"londonBlock\": 4000\n     }\n   }\n   ```\n\n   `// a hard fork would occur to implement London fork upgrades once the node mines/validates up to block 4000`\n\n2. Re-init (upgrade) nodes:\n   ```bash\n   geth init --datadir node1 genesis.json # You'd have to delete node1/geth folder before running this command if you changed the network ID in genesis.json.\n   ```\n\n## Connecting Local Private Node with Hardhat\n\nThis private node (node1) uses port `30306` which can be connected to Hardhat because of Geth's -http. I've configured Hardhat to work with the node just fine; you can find it in hardhat/hardhat.config.js:\n\n```js\nmodule.exports = {\n  solidity: \"0.8.19\",\n  networks: {\n    localhost: {\n      url: \"http://127.0.0.1:30306\", // Use the publicly local exposed port\n      chainId: 19026,\n    },\n  },\n};\n```\n\nAfter setting up the node with the previous commands stated above, we can just open a new terminal in the Harhat porject and run:\n\n```bash\nnpx hardhat run scripts/deploy.js --network localhost\n```\n\nThis should deploy the contract to the local private Geth node and return:\n\n![Contract Deployment](images/image.png)\n\nWe can then trace the contract creation transaction with `debug.traceTransaction('your-transaction-hash')` in the Geth JavaScript console opened earlier:\n\n![Transaction Tracing](images/image2.png)\n\nThe Geth JS console comes with the following objects (and some others):\n\n- eth: Interact with the Ethereum blockchain and smart contracts.\n- web3: Access the Web3.js API for broader blockchain interactions.\n- net: Manage network connections and peers.\n- admin: Manage administrative tasks like node status and peers.\n- debug: Access debugging tools and options.\n- txpool: Query the transaction pool and manage pending transactions.\n- miner: Control mining operations (if applicable).\n- clique: Interact with the Clique Proof-of-Authority consensus engine.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjesserc%2Fhardhat-poa-geth-integration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjesserc%2Fhardhat-poa-geth-integration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjesserc%2Fhardhat-poa-geth-integration/lists"}