---
# System prepended metadata

title: Creating a private ethereum network.

---

# Creating a private ethereum network.

1. Download geth from https://geth.ethereum.org/downloads/ and unzip it
2. Enter the directory where the geth binary is stored.
3. Create a file called genesis-block.json with the following content
    ```json
    {
        "config": {
            "chainId": 15,
            "homesteadBlock": 0,
            "eip150Block": 0,
            "eip155Block": 0,
            "eip158Block": 0,
            "byzantiumBlock": 0,
            "constantinopleBlock": 0,
            "petersburgBlock": 0,
            "ethhash": {}
        },
        "difficulty": "10000000",
        "gasLimit": "8000000",
        "alloc": {
        }
    }
    
4. Initialize the chain using - 
    ``` 
    ./geth --http --http.corsdomain '*' --networkid 2010 --http.api personal,eth,net,web3 --nodiscover --datadir ~/gethdir init genesis-block.json
    ```
4. Create a mining account using. Note down the address created. We will call this address ADDRESS.
    ```bash
    ./geth account new --datadir ~/gethdir/
    ```
5. Start the chain using - 
    ```bash
    ./geth --http --http.corsdomain '*' --networkid 2010 --http.api "personal,eth,net,web3,miner,txpool,admin" --nodiscover --miner.etherbase ADDRESS --datadir ~/gethdir --mine --miner.threads 1 --light.serve 25
    ```
    Do remember to change ADDRESS to the address you have created.
5. In a different console, connect to the running instance using - 
    ```bash
    ./geth attach http://localhost:8545
    ```
    
6. start mining by typing the following in the console 
    ```bash
    miner.start()
    ```
7. Check if mining is working by checking the logs of the running chain. It should have messages regarding blocks being successfully sealed.
8. In case the mining takes too long, you can reduce the difficulty in genesis-block.io, delete the data directory and repeat from step 4.

## Light client

Light clients are initialized in the same manner with the same genesis block, but started in light mode - 

```bash
./geth --http --http.port 8546 --http.corsdomain '*' --networkid 2010 --http.api "personal,eth,net,web3,txpool,admin" --nodiscover  --datadir ~/gethdirlight --port 30304 --syncmode "light"

```

