xspaceprotocol
  • Xspace Protocol
  • Getting Started
    • Whitepaper
      • Introduction
      • Architecture
      • RWA Integration
      • GLXYC The Native Token
      • Urbanization
      • Ecosystem Use Cases
      • Technical
      • Challenges
    • Developer Docs
      • Introduction
      • Architecture
      • Setting Up
      • Smart Contract
      • Tokenization Framework
      • Validator Setup
      • (DeFi) Development
      • Galaxy City Integration
      • API and SDK
      • Governance and DAO
      • Advanced Topics
      • FAQs and Troubleshooting
      • Community and Support
    • Vision
    • Roadmap
    • Tokenomics
    • Token Growth Projection
    • Team
Powered by GitBook
On this page
  • Prerequisites
  • Installation Guide
  • Connecting to the XSPACE Testnet
  1. Getting Started
  2. Developer Docs

Setting Up

Setting Up Your Development Environment

To start developing on the XSPACE Protocol, you need to set up a development environment tailored to interact with the blockchain, deploy smart contracts, and build decentralized applications (dApps). This guide covers the prerequisites, installation steps, and how to connect to the XSPACE Testnet for development.


Prerequisites

1. Tools and Technologies

  • Operating System: Windows, macOS, or Linux.

  • Programming Languages:

    • Solidity: For smart contract development.

    • JavaScript/TypeScript: For dApp frontends and blockchain interactions.

  • Development Frameworks:

    • Hardhat (Recommended): A popular Ethereum-compatible development environment.

    • Truffle: An alternative for contract compilation, testing, and deployment.

  • Node.js and npm: Required for managing dependencies and running JavaScript-based tools.

2. Knowledge Requirements

  • Basic understanding of blockchain concepts (e.g., transactions, wallets, smart contracts).

  • Familiarity with Ethereum-compatible development tools like Web3.js or Ethers.js.


Installation Guide

Step 1: Install Node.js and npm

Node.js is essential for running JavaScript tools and interacting with blockchain APIs.

  1. Check if Node.js is installed:

    node -v
    npm -v
  2. If not installed, download and install Node.js:

  3. Verify installation:

    node -v
    npm -v

Step 2: Install Hardhat

Hardhat is the recommended tool for developing, testing, and deploying smart contracts on XSPACE.

  1. Create a project directory:

    mkdir xspace-dev && cd xspace-dev
  2. Initialize a new Node.js project:

    npm init -y
  3. Install Hardhat:

    npm install --save-dev hardhat
  4. Create a new Hardhat project:

    npx hardhat
    • Choose "Create a basic sample project" when prompted.


Step 3: Install XSPACE CLI

The XSPACE CLI is a command-line tool for interacting with the blockchain, managing accounts, and deploying smart contracts.

  1. Install globally using npm:

    npm install -g xspace-cli
  2. Verify the installation:

    xspace --version

Step 4: Install Wallet

You’ll need a wallet to manage GLXYC tokens and interact with smart contracts:

  • Recommended: Metamask (browser extension or mobile app).

  1. Configure Metamask to connect to the XSPACE Testnet (details below).


Connecting to the XSPACE Testnet

The XSPACE Testnet allows developers to test smart contracts, transactions, and applications in a sandbox environment without using real GLXYC tokens.

Testnet Configuration

  1. RPC URL: https://testnet.xspaceprotocol.io/rpc

  2. Chain ID: 80001

  3. Currency Symbol: GLXYC


Step 1: Add the Testnet to Metamask

  1. Open Metamask and go to Settings > Networks > Add Network.

  2. Enter the following details:

    • Network Name: XSPACE Testnet

    • RPC URL: https://testnet.xspaceprotocol.io/rpc

    • Chain ID: 80001

    • Symbol: GLXYC


Step 2: Get Testnet GLXYC Tokens

  1. Enter your wallet address and request tokens.


Step 3: Configure Hardhat for XSPACE Testnet

Update the hardhat.config.js file to include the XSPACE Testnet configuration:

require("@nomiclabs/hardhat-waffle");

module.exports = {
  solidity: "0.8.0",
  networks: {
    xspaceTestnet: {
      url: "https://testnet.xspaceprotocol.io/rpc",
      chainId: 80001,
      accounts: ["YOUR_PRIVATE_KEY"]
    }
  }
};

Replace "YOUR_PRIVATE_KEY" with the private key of your wallet.


Step 4: Deploy a Smart Contract

  1. Create a new Solidity contract in the contracts folder, e.g., HelloXSPACE.sol:

    pragma solidity ^0.8.0;
    
    contract HelloXSPACE {
        string public message = "Hello, XSPACE!";
    }
  2. Write a deployment script in the scripts folder, e.g., deploy.js:

    async function main() {
        const HelloXSPACE = await ethers.getContractFactory("HelloXSPACE");
        const contract = await HelloXSPACE.deploy();
        console.log("Contract deployed to:", contract.address);
    }
    main().catch((error) => {
        console.error(error);
        process.exitCode = 1;
    });
  3. Deploy the contract:

    npx hardhat run scripts/deploy.js --network xspaceTestnet
  4. Verify deployment:

    • Check the contract address in the XSPACE Testnet Explorer.


Step 5: Interact with the Contract

Use Hardhat to call functions in your deployed contract:

  1. Open a Node.js REPL:

    npx hardhat console --network xspaceTestnet
  2. Load your contract:

    const contract = await ethers.getContractAt("HelloXSPACE", "DEPLOYED_CONTRACT_ADDRESS");
    const message = await contract.message();
    console.log(message); // Outputs: Hello, XSPACE!

Next Steps

  • Experiment with deploying and interacting with more complex smart contracts.

  • Build dApps using Web3.js or Ethers.js to connect to the XSPACE blockchain.

  • Explore staking, tokenization, and DeFi integrations using the XSPACE CLI and SDK.

This comprehensive setup ensures you’re ready to start building on XSPACE.

PreviousArchitectureNextSmart Contract

Last updated 5 months ago

Visit the and download the LTS version.

Install Metamask from .

Explorer URL:

Explorer:

Visit the Testnet Faucet to request free GLXYC tokens for testing: .

Node.js website
https://metamask.io
https://testnet-explorer.xspaceprotocol.io
https://testnet-explorer.xspaceprotocol.io
https://testnet-faucet.xspaceprotocol.io