Change Chain
  • Change Chain
  • Introduction
    • Introduction
    • Key Features
  • Architecture
    • Overview
    • Consensus
    • Transaction Processing
      • Transaction Lifecycle
      • High Throughput Mechanisms
    • Network Layers
    • Interoperability
    • Technical Specifications
  • Mining
    • Mining
      • Setting Up a Mining Node
      • Solo Miner
      • Pool Mining
      • System Requirements
      • Installation
      • Troubleshooting
    • Backup and Restore
    • Gas Model
    • Mining Rewards
    • Tokenomics
  • Ecosystem
    • Ecosystem Components
      • Wallets
      • Explorer
      • Governance
    • Change Chain vs. Layer 2
  • Roadmap
    • Roadmap
  • FAQ
    • FAQ
  • Developer Resources
    • Incentives and Support
    • Development Tools
      • CLI
      • Debugging Tools
      • Testing Framework
    • SDKs
    • Developing Smart Contracts
Powered by GitBook
On this page
  1. Developer Resources

SDKs

SDKs available in languages such as JavaScript

Using the JavaScript SDK (ChangeJS)

Example: Interacting with a Smart Contract

// const { ChangeChainProvider, Contract, Wallet } = require('changejs');
const provider = new ChangeChainProvider('https://node.changechain.org');

// ABI and Contract Address
const abi = [
  // ABI array of the contract
];
const contractAddress = '0xCONTRACT_ADDRESS';

// Initialize wallet and contract
const privateKey = '0xYOUR_PRIVATE_KEY';
const wallet = new Wallet(privateKey, provider);
const contract = new Contract(contractAddress, abi, wallet);

// Call a contract function
async function getValue() {
  const value = await contract.functions.getValue();
  console.log('Contract Value:', value);
}

// Send a transaction to the contract
async function setValue(newValue) {
  const tx = await contract.functions.setValue(newValue);
  await tx.wait(); // Wait for transaction confirmation
  console.log('Value Set Successfully');
}

getValue();
setValue(42);

PreviousTesting FrameworkNextDeveloping Smart Contracts

Last updated 7 months ago