{"id":24466097,"url":"https://github.com/maksandre/private-eth","last_synced_at":"2025-03-14T12:26:07.012Z","repository":{"id":230373380,"uuid":"779002408","full_name":"Maksandre/private-eth","owner":"Maksandre","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-29T09:57:21.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-21T06:13:35.692Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/Maksandre.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-03-28T20:53:22.000Z","updated_at":"2024-03-29T11:12:59.000Z","dependencies_parsed_at":"2024-03-29T11:01:24.701Z","dependency_job_id":null,"html_url":"https://github.com/Maksandre/private-eth","commit_stats":null,"previous_names":["maksandre/private-eth"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maksandre%2Fprivate-eth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maksandre%2Fprivate-eth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maksandre%2Fprivate-eth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maksandre%2Fprivate-eth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Maksandre","download_url":"https://codeload.github.com/Maksandre/private-eth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243575271,"owners_count":20313213,"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":"2025-01-21T06:13:39.709Z","updated_at":"2025-03-14T12:26:06.979Z","avatar_url":"https://github.com/Maksandre.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## TL;DR\n\n1. **Install Geth**: Download and install Geth: https://geth.ethereum.org/docs/getting-started/installing-geth\n\n2. **Init node 1:**\n\n```sh\ngeth --datadir node1 init genesis.json\n```\n\n3. **Run bootnode:**\n\n```sh\nbootnode -nodekey boot.key -addr :30305\n```\n\n4. **Run node**\n```sh\n./node1.sh\n```\n\n5. **Connect to node**: http://127.0.0.1:8555\n\n\n## Full Configuration\n\n### Step-1: Create Accounts for Each Node\n\nYou'll need separate folders for each node in your network to keep their data isolated.\n\n```sh\nmkdir node1 node2\n```\n\nEach node needs an account to participate in the network. Here's how to create one for Node 1. Repeat for Node 2 using its folder.\n\n\n```sh\ngeth --datadir node1 account new\ngeth --datadir node2 account new\n```\n\nYou'll be prompted to create a password. Save them to the `password.txt` file for each node.\n\n### Step-2: Prepare the Genesis File\n\nThe genesis file is like the first page of your private blockchain.\n\nHere's a simplified `genesis.json` you can use:\n\n```json\n{\n  \"config\": {\n    \"chainId\": 123454321,\n    \"homesteadBlock\": 0,\n    \"eip150Block\": 0,\n    \"eip155Block\": 0,\n    \"eip158Block\": 0,\n    \"byzantiumBlock\": 0,\n    \"constantinopleBlock\": 0,\n    \"petersburgBlock\": 0,\n    \"istanbulBlock\": 0,\n    \"clique\": {\n      \"period\": 15,\n      \"epoch\": 30000\n    }\n  },\n  \"difficulty\": \"1\",\n  \"gasLimit\": \"8000000\",\n  \"extradata\": \"0x0000000000000000000000000000000000000000000000000000000000000000\u003cPUBLIC-KEY-HERE\u003e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\n  \"alloc\": {\n    \"A950a6fdA35d8422539C65Cd7B37016f974764B2\": { \"balance\": \"1000000000000000000\" },\n  }\n}\n```\n\nIn `extradata`, you'll add the address of your Node 1 account without `0x` prefix and surrounded by zeros on each side.\n\n### Step-3. Initialize Each Node with the Genesis Block\n\nRun the following command for each node.\n\n```sh\ngeth --datadir node1 init genesis.json\ngeth --datadir node2 init genesis.json\n```\n\n### Step-4: Start the Bootnode\n\nThe next step is to configure a bootnode. This can be any node, but for this tutorial the developer tool bootnode will be used to quickly and easily configure a dedicated bootnode. First the bootnode requires a key, which can be created with the following command, which will save a key to boot.key:\n\n```sh\nbootnode -genkey boot.key\n```\n\nThis key can then be used to generate a bootnode as follows:\n\n```sh\nbootnode -nodekey boot.key -addr :30305\n```\n\nSet enode from the console output into node.sh scripts\n\n### Step-5: Connect Nodes\n   \nIn `node1.sh` and `node2.sh` set `bootnodes`, `unlock`, `miner.etherbase`.\n\nRun nodes by running scripts in separate terminals.\n\n### Step-7: Verify the Connection\n\nTo verify Node 2 is connected to Node 1, attach a console to Node 2:\n\n```sh\ngeth attach http://127.0.0.1:8555\n```\n\nThen check the peer count:\n\n```\nnet.peerCount\n```\n\nIf everything is set up correctly, you should see 1, indicating that Node 2 is connected to one peer (Node 1).\n\n### Congratulations!\n\nYou've successfully set up a private Ethereum network using the Clique consensus algorithm. You can connect to the node using Metamask - use http://127.0.0.1:8555\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaksandre%2Fprivate-eth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaksandre%2Fprivate-eth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaksandre%2Fprivate-eth/lists"}