> For the complete documentation index, see [llms.txt](https://docs.lagomchain.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lagomchain.com/concepts/chain-id.md).

# Chain ID

A Chain ID is a unique identifier assigned to a blockchain network. It helps to:

* Differentiate networks (Mainnet, Testnet, Devnet).
* Ensure transactions are broadcasted to the correct network.
* Prevent replay attacks by including the Chain ID in signed transactions (EIP-155 compliance).

***

### **LagomChain's Chain ID Format**

LagomChain follows a structured **Chain ID format**, which includes:

1. **Identifier** – Defines the blockchain name.
2. **EIP-155 Number** – Immutable replay protection number.
3. **Version Number** – Represents the current network version and is incremented upon upgrades or forks.

#### **Chain ID Format in Genesis**

```
{identifier}_{EIP155}-{version}
```

Exampl&#x65;**:**

```
lagom_986-1
```

***

### **Official Chain IDs**

#### **Mainnet:**

```
lagom_986-1
```

#### **Testnet:**

```
lagom_testnet-986-1
```

Certain upgrades may require an increase in the version number, but not all protocol changes necessitate a Chain ID change.

***

### **The Chain Identifier in LagomChain**

Every blockchain must have a unique chain-id defined in `genesis.json`.\
LagomChain’s Chain ID is used in:

* EIP-155 replay protection to prevent cross-chain transaction replays.
* Cosmos SDK standardization for smooth chain upgrades.
* Tendermint consensus rules, ensuring network integrity.

#### **Example Configuration in `genesis.json`**

```json
{
  "chain_id": "lagom_986-1"
}
```

***

### **Chain ID Upgrade Process**

When upgrading the LagomChain network, the version number must be incremented to avoid consensus issues.

#### Example of Chain ID Upgrad&#x65;**:**

| **Previous Chain ID** | **Upgraded Chain ID** | **Reason for Change**                       |
| --------------------- | --------------------- | ------------------------------------------- |
| `lagom_986-1`         | `lagom_986-2`         | Major upgrade requiring new consensus rules |
| `lagom_testnet-986-1` | `lagom_testnet-986-2` | Testnet upgrade for new feature testing     |

***

### **Why Chain ID Matters**

#### **1. Ensures Network Uniqueness**

Each blockchain network must have a distinct Chain ID to differentiate it from others.

#### **2. Prevents Replay Attacks (EIP-155 Compliance)**

Transactions signed on one network cannot be replayed on another due to the Chain ID being embedded in the transaction data.

#### **3. Enables Seamless Upgrades**

By following the structured Chain ID format, LagomChain ensures smooth protocol upgrades without breaking consensus.
