> ## Documentation Index
> Fetch the complete documentation index at: https://mgb-ru.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Испытай свою программу

> Узнайте, как протестировать простую программу на Rust.

***

### Быстрый Доступ

Если вы предпочитаете сразу перейти к коду:

> [card] [GitHub](https://github.com/magicblock-labs/magicblock-engine-examples/blob/main/rust-counter/tests)
>
> Tests for Rust Counter

> [card] [GitHub](https://github.com/magicblock-labs/magicblock-engine-examples/tree/main/pinocchio-counter/tests)
>
> Tests for Pinocchio Counter

> [card] [Guide](https://mgb-ru.mintlify.site/pages/ephemeral-rollups-ers/how-to-guide/local-development.md)
>
> Local Development

***

## Пошаговое руководство

Создавайте корректные транзакции, которые вызывают инструкции вашей программы для делегирования и анделегирования. Полный тест для этого проекта можно найти в скрипте тестирования на [Typescript](https://github.com/magicblock-labs/magicblock-engine-examples/blob/main/rust-counter/tests)

**1. [Import SDK and initialize Connection](#1-connection)**

Настройте подключение и аккаунты

**2. [Delegate PDA on Base Layer](#2-delegate)**

Протестируйте CPI-хук для делегирования аккаунта состояния на базовом слое.

> [!NOTE]
>
> These public validators are supported for development. Make sure to add the
> specific ER validator in your instruction when delegating:
>
> <ul>
>   <li>
>     Asia (devnet-as.magicblock.app):&#x20;
>     `MAS1Dt9qreoRMQ14YQuhg8UTZMMzDdKhmkZMECCzk57`
>   </li>
>
>   <li>
>     EU (devnet-eu.magicblock.app):&#x20;
>     `MEUGGrYPxKk17hCr7wpT6s8dtNokZj5U2L57vjYMS8e`
>   </li>
>
>   <li>
>     US (devnet-us.magicblock.app):&#x20;
>     `MUS3hc9TCw4cGC12vHNoYcCGzJG1txjgQLZWVoeNHNd`
>   </li>
>
>   <li>
>     TEE (tee.magicblock.app):&#x20;
>     `FnE6VJT5QNZdedZPnCoLsARgBwoE6DeJNjBs2H1gySXA`
>   </li>
>
>   <li>
>     Local ER (localhost):&#x20;
>     `mAGicPQYBMvcYveUZA5F5UNNwyHvfYh5xkLS2Fr1mev`
>   </li>
> </ul>

**3. [Commit PDA on ER](#3-commit)**

Протестируйте CPI-хук для фиксации аккаунта состояния на ЭР

**4. [Undelegate PDA on ER](#4-undelegate)**

Протестируйте CPI-хук для анделегирования аккаунта состояния на ЭР.

***

## Пример счётчика

The following software packages may be required, other versions may also be compatible:

| Software | Version | Installation Guide |
| - | - | - |
| **Solana** | 2.3.13 | [Install Solana](https://docs.anza.xyz/cli/install) |
| **Rust** | 1.85.0 | [Install Rust](https://www.rust-lang.org/tools/install) |
| **Node** | 24.10.0 | [Install Node](https://nodejs.org/en/download/current) |

### Фрагменты кода

> [tab] 1. Подключение
>
> ### Import SDK and create Connection
>
> Import relevant libraries `@magicblock-labs/ephemeral-rollups-sdk` or `@magicblock-labs/ephemeral-rollups-kit`. Initialize connection before testing and sending transactions.
>
> ```bash kit theme={null}
> yarn add @magicblock-labs/ephemeral-rollups-kit@latest
> ```
>
> ```bash web3.js theme={null}
> yarn add @magicblock-labs/ephemeral-rollups-sdk@latest
> ```
>
> > [!NOTE]
> >
> > These public RPC endpoints are currently free and supported for development:
> > \
> > &#x20;Magic Router Devnet: [https://devnet-router.magicblock.app](https://devnet-router.magicblock.app) \\
> >
> > Solana Devnet: [https://api.devnet.solana.com](https://api.devnet.solana.com) \\
> >
> > ER Devnet: [https://devnet.magicblock.app](https://devnet.magicblock.app) \\
> >
> > TEE Devnet: [https://tee.magicblock.app/](https://tee.magicblock.app/) \\
> >
> > Find out more details [
> > here
> > ](https://mgb-ru.mintlify.site/pages/ephemeral-rollups-ers/how-to-guide/local-development.md).
>
> ```
> ```
>
> ```
> ```
>
> [⬆️ Back to Top](#code-snippets)

> [tab] 2. Делегировать
>
> ### Test `delegation` transaction
>
> Create a instruction with the right order and attributes of accounts, and the instruction discriminator for `delegation` of your program. Send the transaction with the instruction to Base Layer (Solana) network.
>
> > [card] [Transaction (Base Layer): Delegate](https://solscan.io/tx/5jUdf5rsfQsbLYAahS9axrnLnEjdbUqtXUmGfgGuS7QqbYJ4FZHgXTNoT1bxPXp7XQu78r8Ebpp1RT2u9V6qsc1r?cluster=devnet)
> >
> > Inspect transactions details on Solana Explorer
>
> ```
> ```
>
> ```
> ```
>
> [⬆️ Back to Top](#code-snippets)

> [tab] 3. Фиксировать
>
> ### Test `commit` transaction
>
> Create a instruction with the right order and attributes of accounts, and the instruction discriminator for `commit` of your program. Send the transaction with the instruction to ER network.
>
> > [card] [Transaction (ER): Commit](https://solscan.io/tx/5GiFGyrnJPkEQbhE8EHVYczoj2RPGe1YSnoq1DzcUHAxpyzMUKtxG2Tc7TLkxtcCHr72ftnvmkAVMfecTaf6TCK8?cluster=custom\&customUrl=https://devnet.magicblock.app)
> >
> > Inspect transaction details on Solana Explorer
>
> > [card] [Transaction (Base layer): Commit](https://solscan.io/tx/5fHBADq99LAEBzGoeDXGtN3ut8RBf2s5UhbDM1N6TMTpvADNeYLz8e8vinNWj1VhLhrR7UxFoW7bo2u6pBR3YRjj?cluster=devnet)
> >
> > Inspect transaction details on Solana Explorer
>
> ```
> ```
>
> ```
> ```
>
> [⬆️ Back to Top](#code-snippets)

> [tab] 4. Анделегировать
>
> ### Test `undelegation` transaction
>
> Create a instruction with the right order and attributes of accounts, and the instruction discriminator for `undelegation` of your program. Send the transaction with the instruction to ER network.
>
> > [card] [Transaction (ER): Undelegate](https://solscan.io/tx/bMN6AhXrGH93Uc6ALibGgjnE39hcnY57mBhYkZ8TRaKxNRvyFaweaQPBmDxPv81cgR47WTTzzhfziTUEgAT8Y5m?cluster=custom\&customUrl=https://devnet.magicblock.app)
> >
> > Inspect transaction details on Solana Explorer
>
> > [card] [Transaction (Base layer): Undelegate](https://solscan.io/tx/8JafYWiXmd4CHc2E97WKYnaNPmChZeg8aGYY7UUWaQ7Z54N5WoMcAVivyv2vdn9wKirMkR3y4UcmFPdXYqBtKAa?cluster=devnet)
> >
> > Inspect transaction details on Solana Explorer
>
> ```
> ```
>
> ```
> ```
>
> [⬆️ Back to Top](#code-snippets)

***

## Solana Explorer

Get insights about your transactions and accounts on Solana:

> [card] [Solana Explorer](https://explorer.solana.com/)
>
> Official Solana Explorer

> [card] [Solscan](https://solscan.io/)
>
> Explore Solana Blockchain

## Solana RPC Providers

Send transactions and requests through existing RPC providers:

> [card] [Solana](https://solana.com/docs/references/clusters#on-a-high-level)
>
> Free Public Nodes

> [card] [Helius](https://www.helius.dev/solana-rpc-nodes)
>
> Free Shared Nodes

> [card] [Triton](https://triton.one/solana)
>
> Dedicated High-Performance Nodes

## Solana Validator Dashboard

Find real-time updates on Solana's validator infrastructure:

> [card] [Solana Beach](https://solanabeach.io/)
>
> Get Validator Insights

> [card] [Validators App](https://www.validators.app/)
>
> Discover Validator Metrics

## Server Status

Subscribe to Solana's and MagicBlock's server status:

> [card] [Solana Status](https://status.solana.com/)
>
> Subscribe to Solana Server Updates

> [card] [MagicBlock Status](https://mgb-ru.mintlify.site/pages/overview/additional-information/server-status)
>
> Subscribe to MagicBlock Server Status

***


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.