# KUB Layer 2 Network

## **Introduction to Layer 2 Networks**

Blockchain technology, in its foundational form (known as a Layer 1 network), faces a well-known challenge: the **blockchain trilemma**. This concept states that a blockchain can only effectively achieve two of the three key properties: **scalability**, **security**, and **decentralization**.&#x20;

A Layer 1 network like KUB, or others like Ethereum, prioritizes security and decentralization, but this can lead to limitations in transaction speed and higher fees when network usage is high.

A Layer 2 network is a secondary framework or protocol built on top of a Layer 1 blockchain. Its primary purpose is to address the scalability issue by handling a large number of transactions off the main chain, thereby increasing the network's throughput and reducing transaction costs.

## **The Rollup Approach**

The KUB Layer 2 network, like many modern L2 solutions, utilizes a technology called a rollup. Rollups bundle hundreds of transactions into a single, compressed transaction that is then submitted to the main Layer 1 network. This significantly reduces the amount of data that needs to be processed on the main chain, leading to faster and cheaper transactions.

There are two main types of rollups:

* Optimistic Rollups: This model operates under the assumption that all transactions bundled in a rollup are valid. It only verifies the transactions if a fraud proof is submitted by a user who suspects fraudulent activity. This optimistic approach allows for very high transaction speeds. A challenge period is a key feature, giving users a window of time to submit a fraud-proof.
* Zero-Knowledge (ZK) Rollups: These rollups use complex cryptographic proofs (known as ZK-proofs) to instantly verify the validity of off-chain transactions. A small proof is submitted to the Layer 1 network, which cryptographically guarantees that all transactions in the bundle are valid. This provides near-instant finality without a challenge period.

## KUB Layer 2 Network

The KUB Layer 2 network is an extension of the main KUB network (Layer 1). It is designed to enhance the KUB network's performance by providing a low-cost, high-speed environment for decentralized applications (dApps) and user transactions.

### Connecting to the KUB Layer 2 Network

Connecting to the KUB Layer 2 network is a straightforward process, similar to connecting to other blockchain networks. You will need a compatible cryptocurrency wallet, such as [MetaMask](https://metamask.io/). You can follow the instructions in this [guide](https://docs.kubchain.com/about-kub/connect-to-kub) or enter the following RPC details:

{% tabs %}
{% tab title="Layer 2 Mainnet" %}

| Name               | Value                           |
| ------------------ | ------------------------------- |
| Network Name       | KUB Layer 2 Mainnet             |
| RPC URL            | <https://kublayer2.kubchain.io> |
| Chain ID           | 9601                            |
| Currency Symbol    | KUB                             |
| Block Explorer URL | <https://kublayer2.kubscan.com> |
| {% endtab %}       |                                 |

{% tab title="Layer 2 Testnet" %}

| Name               | Value                                   |
| ------------------ | --------------------------------------- |
| Network Name       | KUB Layer 2 Testnet                     |
| RPC URL            | <https://kublayer2.testnet.kubchain.io> |
| Chain ID           | 259251                                  |
| Currency Symbol    | tKUB                                    |
| Block Explorer URL | <https://kublayer2.testnet.kubscan.com> |
| {% endtab %}       |                                         |
| {% endtabs %}      |                                         |

### Obtaining tKUB on the KUB Layer 2 Testnet

For developers wishing to develop their decentralized applications (dApps) on the KUB Layer 2 Testnet, you will need some tKUB. To obtain tKUB on the KUB Layer 2 Testnet, you first need to acquire tKUB on the KUB Testnet. Follow this [guide](https://docs.kubchain.com/tools/testnet-faucet) or visit the [KUB Faucet](https://faucet.kubchain.com/) to obtain some tKUB.&#x20;

Once you have received your tKUB, navigate to the section labeled **Bridge to KUB Layer 2 Testnet**. You will be presented with options to select the amount of tKUB you want to transfer from the KUB Testnet to the KUB Layer 2 Testnet. After making your selection, follow the on-screen instructions to complete the bridging process.

{% hint style="info" %}
You'll be able to receive 5 tKUB every 24 hours using the KUB Faucet.
{% endhint %}
