Quickstart

Welcome to Via Network developer documentation!

VIA Network is a fork of ZKsync Era, inheriting its core technology and developer tooling. This means all ZKsync-compatible tools work seamlessly on VIA with minimal configuration changes. This documentation mirrors ZKsync's Hardhat setup but tailored for VIA Network.

Prerequisites

Before proceeding, ensure you have the following installed:

  • Node.js (v18+ recommended),

  • Yarn or npm,

  • A wallet with testnet tokens (for gas fees), you can bridge BTC to Via Network chain using the bridge UI,

  • Basic knowledge of Solidity and Hardhat.

Setting Up the Example Project

Clone the via-playground project and install dependencies:

git clone https://github.com/vianetwork/via-core.git
cd via-core/via-playground
yarn install

Configuring Hardhat for Via Network

The hardhat.config.ts file contains the network configuration. Ensure it includes the Via Network RPC endpoint and your wallet's private key (for deployment).

module.exports = {
  defaultNetwork: 'via-testnet',
  solidity: "0.8.27",
  networks: {
    via-testnet: {
      url: "https://via.testnet.viablockchain.dev" // VIA testnet RPC endpoint
      chainId: 25223, // Via testnet chainId
      accounts: [process.env.PRIVATE_KEY],
    },
  },
};

Note: Store private keys in .env (use dotenv package for security).

Writing & Compiling the Smart Contract

The contracts/ directory contains example contracts (e.g., CrowdfundingCampaign.sol).

Compile the contract

Deploying the Contract to Via Network

Deploy the CrowdfundingCampaign using the following command:

The amount flag is the initial amount deposited in the campaign.

Expected Output: CrowdfundingCampaigndeployed to: 0x123...abc

Interact with the CrowdfundingCampaign contract

Let's now create some transactions to interact with the deployed contract

Happy Building on Vianetwork! 🚀

Last updated