Zeeve Documentation
  • Zeeve Platform
    • Manage Your Account
    • Manage Workspaces
    • Technical Support
  • Rollups
    • Polygon CDK zkRollups
      • Introduction
      • Quick Start Guide
        • Purchase Subscription
        • Create your zkRollup Chain
      • Manage CDK zkRollups
      • Demo Network
        • Details
        • Bridge
        • RPC Access
        • Deploy Contract
    • zkSync Hyperchain
      • Introduction
      • Quick Start Guide
        • Setup zkSync Hyperchain
      • Manage zkSync Hyperchain
      • Demo Network
        • Details
        • Bridge
        • Deploying Contract
        • Faucet
      • RPC Access
    • OP Stack
      • Introduction
      • Quick Start Guide
        • Setup OP Stack
      • Manage OP Stack
      • RPC Endpoints
      • Demo Network
        • Details
    • Arbitrum Orbit
      • Introduction
      • Quick Start Guide
        • Setup Arbitrum Orbit
      • Manage Arbitrum Orbit
      • RPC Endpoints
      • Demo Network
        • Details
  • Traceye
    • Shared Indexing
      • Hosted Subgraphs
        • Quick Start Guide
          • Purchase Subscription
        • Manage Hosted Subgraphs
          • Webhook
          • Settings
      • Hosted SubQuery
        • Quick Start Guide
          • Purchase Subscription
        • Manage Hosted SubQuery
          • Settings
    • Dedicated Indexing
      • Graph Nodes
        • Quick Start Guide
          • Purchase Subscription
        • Graph Node Manual
          • Deploy Graph Node
          • View Analytics
          • Manage Addon Services
          • Ledger Data Pruning
        • Subgraph Manual
          • Manage Subgraph
          • Webhook Management
          • Index Data Pruning
          • Settings
          • Substreams-Powered Subgraphs
      • Subquery Nodes
        • Quick Start Guide
          • Purchase Subscription
        • Subquery Node Manual
          • Deploy Subquery Node
          • View Analytics
          • Manage Addon Services
        • Subquery Manual
          • Manage Subquery
          • Settings
  • RPC Nodes
    • Deploy Your RPC Node
    • Manage Your RPC Node
      • Manage Node
      • Delete Node
  • Archive Nodes
    • Deploy Your Archive Node
    • Manage Your Archive Node
      • Manage Node
      • Delete Node
  • Validator Nodes
    • Deploy Your Validator Node
    • Manage Your Validator Node
      • Manage Node
    • Coreum
      • Deploy Coreum Validator Node
      • Manage Coreum Validator Node
        • Edit Validator Details
        • Unbound Token
        • Withdraw Reward and Commission
        • Change Reward Wallet
        • Enable Restake
        • Delete Node
    • Shido
      • Deploy Shido Validator Node
      • Manage Shido Validator Node
        • Analytics
        • Edit Validator Details
        • Unbound Tokens
        • Withdraw Reward and Commission
        • Change Reward Wallet
        • Delete Node
    • Beam L1
      • Deploy Beam L1 Validator Node
      • Manage Beam L1 Validator Node
Powered by GitBook
On this page

Was this helpful?

  1. Rollups
  2. Polygon CDK zkRollups
  3. Demo Network

Deploy Contract

PreviousRPC AccessNextzkSync Hyperchain

Last updated 1 year ago

Was this helpful?

Deploying and compiling the contract is different for the Polygon CDK, here we discuss the steps to deploy your first contract in the Polygon CDK network.

Step 1: Get the RPC URL - follow the instructions on the page to get the RPC endpoints.

Step 2: Get ABI and bytecode - Deploying a contract in polygon CDK is the same as deploying a contract in the Ethereum network. You can compile the contract code in bytecode and abi normally as you would do for Ethereum and then can use it in the next step.

Step 3: Replace Values - Replace RPC_URL, contractAbi, contractBytecode and privateKey. once you replace those values with valid values, you can run the file with ts-node filename.ts

import { ethers } from "ethers";

async function deployContract() {
    // Replace with your Ethereum node's RPC endpoint
    const RPC_URL = "https://demouser:demopass@rpcnode.demo-vali-02aa6b.zeeve.net/rpc";
    // Connect to your Ethereum node
    const provider = new ethers.JsonRpcProvider(RPC_URL);

    // Replace these values with your contract's ABI and bytecode
    const contractAbi = []; // Your contract's ABI as an array
    const contractBytecode = ""; // Your contract's bytecode as a hex string

    // Set the account that will deploy the contract
    const privateKey = ""; // Replace with the private key of the account deploying the contract
    const wallet = new ethers.Wallet(privateKey, provider);
    console.log(`wallet address: ${wallet.address} bal: ${await provider.getBalance(wallet.address)}`);

    // Create a contract factory
    const MyContractFactory = new ethers.ContractFactory(contractAbi, contractBytecode, wallet);
    console.log("contract ready to deploy");

    // Deploy the contract
    const MyContract = await MyContractFactory.deploy(10);

    // Wait for the contract to be mined
    await MyContract.waitForDeployment();
    console.log("contract deployed");

    console.log(`Contract deployed successfully at address: ${await MyContract.getAddress()}`);
}

deployContract();

Step 4: Contract Address - Once it runs successfully you will get a contract address.

RPC Access
Success Message