# Getting Started with edeXa (Developer Guide)

1\. Introduction

Welcome to edeXa! Whether you're building on the Testnet or Mainnet, edeXa offers developers a flexible, fast, and secure blockchain environment for your decentralized applications. Let’s get you started on the right foot.

#### 2. Step-by-Step Guide to Get Started

**Step 1: Set Up Your Development Environment**

To start developing on edeXa, you'll need a few basic tools:

* **Install edeXa Wallet** (recommended) or **MetaMask** (or another Ethereum-compatible wallet) to interact with the blockchain.
* **Set up Remix IDE** or your preferred development environment for smart contracts.\
  Open your browser and visit <https://remix.ethereum.org/>.\
  ![](/files/7gGaBp2mZYTdDNXHZ51Q)

<div align="left"><figure><img src="/files/qd5RsXWUC8IMybO0dOar" alt=""><figcaption></figcaption></figure></div>

**Step 2: Connect to edeXa Network**

To connect to the edeXa Testnet or Mainnet:

**RPC URLs for Testnet & Mainnet:**

* **Testnet**: <https://testnet.edexa.network/rpc>
* **Mainnet**: <https://mainnet.edexa.network/rpc>\
  You can also visit <https://chainlist.org/?search=edexa&testnets=true>

<figure><img src="/files/QmvLvQk6p5Mtxo4Mv3p5" alt=""><figcaption></figcaption></figure>

Use these URLs to configure your wallet or development tools like **Truffle** or **Hardhat** for seamless interaction with the network.

**Step 3: Access the edeXa Faucet**

Get **Testnet EDX tokens** for testing your contracts or transactions on Testnet:

**Faucet link**: [edeXa Testnet Faucet](https://faucet.edexa.com)

<figure><img src="/files/KeEViHTr4bafRnkiKOWX" alt=""><figcaption></figcaption></figure>

Get tokens to experiment with smart contract interactions or transactions.

**Step 4: Start Building Your Smart Contracts**

1. **Necessary Preparations:** Open your browser and visit [Remix IDE](https://remix.ethereum.org/).
   * Click the **File Explorer** icon in the left navigation bar of Remix.
   * Click the "+" icon to create a new workspace. Name your workspace (e.g., "edeXaWorkspace").
   * Create a new `.sol` smart contract, and name it something easy to remember like `MyContract.sol`.
2. **Basic Operations:** In your new `.sol` smart contract, import `edeXaApp.sol`. This will allow your smart contract to inherit from `edeXaApp` and access its functionality.

   For example:

   ```solidity
   solidityCopyEdit// SPDX-License-Identifier: MIT
   pragma solidity ^0.8.18;

   import "@edexa/contracts/edeXaApp.sol";  // Replace with actual edeXa contract path

   contract MyContract is edeXaApp {
       // Your contract code
   }
   ```

   * Override the `_edeXaReceive` function in your smart contract. This is a protected function that will be called when your contract receives a cross-chain message. You can customize this function to define how your contract will handle incoming messages.

   ```solidity
   solidityCopyEditfunction _edeXaReceive(
       bytes calldata data,
       bytes32 messageId,
       uint256 fromChainId,
       address fromSC
   ) internal override {
       // Custom handling for incoming message
   }
   ```
3. **Initialize Your Smart Contract:** When initializing your smart contract, call the `edeXaApp` initialize function. This function takes two parameters: the `admin` and the `_edeXaGateway` address.

   Example:

   ```solidity
   solidityCopyEditconstructor(address admin, address _edeXaGateway) edeXaApp() {
       initialize(admin, _edeXaGateway);
       // Your initialization code
   }
   ```
4. **Sending Cross-Chain Messages:** To send messages or contract calls to other chains, you can use the `_dispatchMessage` function provided by `edeXaApp`. This function allows you to send messages to any specified chain or contract.

   Example:

   ```solidity
   solidityCopyEditfunction sendMessage(
       uint256 toChainId, address toAddress, bytes memory msgData,
       uint256 feeAmount) public payable {
       _dispatchMessage(toChainId, toAddress, msgData, feeAmount);
   }
   ```
5. **Estimate Fees:** Use the `estimateFee` function to calculate the fee required to send a cross-chain message. This function takes two parameters: the target chain ID and the gas limit.

   Example:

   ```solidity
   solidityCopyEditfunction sendMessage(
       uint256 toChainId, address toAddress,
       bytes memory msgData, uint256 gasLimit) public payable {
       uint256 fee = estimateFee(toChainId, gasLimit);
       require(msg.value >= fee, "Insufficient fee");
       _dispatchMessage(toChainId, toAddress, msgData, msg.value);
   }
   ```

***

#### 3. Resources

* edeXa API Documentation
* [edeXa GitHub Repositories](https://github.com/devEdexa)
* [edeXa Smart Contract Templates](https://github.com/devEdexa/edexa.js)
* [edeXa Gas Tracker](https://explorer.testnet.edexa.network/gas-tracker)
* [edeXa Community](https://discord.com/invite/TKBQS9tZJY)

#### 4. Contact & Support

* **Join the Developer Community**: [Discord](https://discord.com/invite/TKBQS9tZJY)
* **Submit a Support Request**: <helpdesk@edexa.com>
* **Explore edeXa Labs**: [edeXa Labs Innovation Center](https://x.com/edeXaLabs)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://edexa-business-blockchain.gitbook.io/edexa-docs/basics/getting-started-with-edexa-developer-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
