# Get Started

### Overview

Welcome to the [Sahara](https://saharaai.com/) Blockchain developer quickstart guide. This guide will walk you through setting up your development environment and deploying your first smart contract on the Sahara Testnet.

### Prerequisites

Before starting, ensure you have:

* Node.js v16 or higher
* A code editor (VS Code recommended)
* MetaMask or another Web3 wallet
* Basic Solidity knowledge
* Git installed

### Network Details

The Sahara Testnet is our development environment with the following specifications:

Network Configuration:

```
Network Name: Sahara Testnet
RPC URL: https://testnet.saharalabs.ai
Chain ID: 313313
Currency Symbol: SAHARA
Block Explorer: https://testnet-explorer.saharalabs.ai
```

Chain Specifications:

```
Cosmos Chain ID: sahara-test-1
Ethereum Chain ID: 313313
Native Token: SAHARA
Bech32 Prefix: sah
```

### Step-by-Step Setup

#### 1. Create Project Directory

First, create and initialize your project:

```
mkdir my-sahara-project
cd my-sahara-project
npm init -y

```

#### 2. Install Dependencies

Install Hardhat and required packages:

```
npm install --save-dev hardhat @nomiclabs/hardhat-ethers ethers dotenv
```

#### 3. Configure Hardhat

Create a .env file in your project root:

```
PRIVATE_KEY=your_private_key_here 
SAHARA_TESTNET_API_KEY=your_api_key_here
```

Create hardhat.config.js with the following configuration:

```
require("@nomiclabs/hardhat-ethers");
require("dotenv").config();

const config = {
  solidity: "0.8.24",
  networks: {
    saharaTestnet: {
      chainId: 313313,
      url: "https://testnet.saharalabs.ai",
      accounts: [process.env.PRIVATE_KEY],
      timeout: 60000
    }
  },
  etherscan: {
    apiKey: {
      saharaTestnet: process.env.SAHARA_TESTNET_API_KEY
    },
    customChains: [
      {
        chainId: 313313,
        network: "saharaTestnet",
        urls: {
          apiURL: "https://testnet-explorer.saharalabs.ai/api",
          browserURL: "https://testnet-explorer.saharalabs.ai/"
        }
      }
    ]
  }
};

module.exports = config;
```

#### 4. Create Sample Contract

Create contracts/HelloSahara.sol:

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

contract HelloSahara {
    string public message;
   
    constructor(string memory _message) {
        message = _message;
    }
   
    function updateMessage(string memory _newMessage) public {
        message = _newMessage;
    }
}
```

#### 5. Create Deployment Contract

Create scripts/deploy.js:

```
async function main() {
    const HelloSahara = await ethers.getContractFactory("HelloSahara");
    const hello = await HelloSahara.deploy("Hello, Sahara AI!");
    await hello.waitForDeployment();
   
    console.log("HelloSahara deployed to:", await hello.getAddress());

    // Wait for confirmations for verification
    await hello.deploymentTransaction().wait(5);

    // Verify contract
    await hre.run("verify:verify", {
        address: await hello.getAddress(),
        constructorArguments: ["Hello, Sahara AI!"],
    });
}

main()
    .then(() => process.exit(0))
    .catch((error) => {
        console.error(error);
        process.exit(1);
    });
```

#### 6. Get Testnet Tokens

Visit[ https://faucet.saharalabs.ai](https://faucet.saharalabs.ai) and request test SAHARA tokens for deployment.

#### 7. Deploy Contract

Run the deployment script:

```
npx hardhat run scripts/deploy.js --network sahara_testnet
```

### **Common Issues & Solutions**

**Timeout Errors**

```
// Increase timeout in your config
networks: {
  sahara_testnet: {
    timeout: 120000 // 2 minutes
  }
}

```

**Transaction Failures**

* Double-check gas settings
* Ensure proper nonce management
* Verify RPC endpoint status

**Verification Errors**

* Wait for sufficient block confirmations
* Ensure constructor arguments match exactly
* Double-check API key configuration

#### Next Steps

After successful deployment:

1. Interact with your contract through the block explorer
2. Test different contract interactions
3. Begin integrating AI assets using Sahara's specialized features

Need help? Join our[ Discord](https://discord.gg/sahara) or email[ ](https://docs.saharalabs.ai)<support@saharalabs.ai>


---

# 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://docs.saharaai.com/blockchain-developer-docs/basics/editor.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.
