Script Network Documentation
  • Getting Started Guides
    • How to Sign Up + Sign In to Script TV
    • Using the Live TV player
    • Navigating the Script TV Dashboard (Test Phase)
    • Testnet, Explorer + Creating a Wallet (Test Phase)
    • Reward System: Script Points, Zealy, Galxe + more
  • ScriptGLASS - How to mint
  • 🎬About Script Network
    • Introduction
    • Products
    • Why Script TV?
    • How it works
    • Understanding the Script Blockchain
    • Script TV + Web3
    • Market Strategy
    • Benefits
    • Comparison
  • 🗺️Roadmap
  • 🪙Script Tokens
    • SCPT
      • Detailed SCPT Tokenomics
    • SPAY
      • 💰SPAY Tokenomics
        • 🕶️ScriptGLASS explained
          • Economics
        • Allowable/Earnable Watch Time
      • Mechanism Design of Glasses
        • Glass Types
        • Glass Payouts
          • Durability
        • Gems
        • Levels
        • Recharge Vouchers
        • Recharge Voucher Mechanism
        • Recharge Costs
        • Glass Minting
        • Game Theory
  • 🦸For Users
    • ⛓️Blockchain Integration
      • Installation guide for Script Node setup for Win , Mac and Linux
      • Build and Install
      • Run Unit Tests
      • Launch Script Node
      • Command Line Tool
      • Steps To Upgrade The Chain
      • Account/Wallet Management
      • Call Smart Contract
      • Turing-Complete Smart Contract Support
    • Basic Concept
    • Tokens
    • Script NFTs
    • Transactions
    • Script Wallet
    • Faucet (Technical)
    • Smart Contracts
  • 🌐Script Network Explorer
    • Block APIs
    • Transaction APIs
    • Account APIs
    • Stake APIs
  • 🔯Nodes
    • Node Token Emissions
    • Lightning Node Overview
      • Validator / Lightning Node Setup
        • Steps To Change Node Password
        • Stake to the Lightning node
    • Lightning Staking Process
      • Lightning Stake Withdrawal Process
        • Staking through Web Wallet
  • 💠Validators
    • Block Settlement
    • Steps To Migrate Lightning/Validator
  • 📒Edge Documentation
    • Introduction
    • What is Edge
    • How it works
    • Edge Uses
    • Possibilities with Edge
    • Edge Features
    • Benefits
    • Use Cases
  • 🔗Smart Contract Development
    • 💻 How to quickly deploy a smart contract on Script Blockchain
  • Smart Contract & App Development
    • Turing-Complete Smart Contract
    • Ethereum RPC API support
    • Setup the ETH RPC Adaptor for the Script Testnet
    • Metamask
    • Truffle
    • Hardhat
    • Remix
    • Web3.js
    • Explorer Tools for DApp Development
    • Script Blockchain SRC20 Token Integration Guide
  • 📔API References
    • Metamask Script Network RPC Details (Testnet)
    • RPC API Reference
      • Examples
      • GetBlock
        • Transaction Types
        • Request
        • GetBlockByHeight
      • GetTransaction
        • GetPendingTransactions
    • Tx APIs
      • Broadcast Raw Transaction
      • BroadcastRawTransactionAsync
    • ScriptCli APIs
      • Account APIs
        • NewKey API
        • ListKeys
        • UnlockKey
        • LockKey
        • IsKeyUnlocked
      • Tx APIs
        • Send
        • Configuration for the Script Blockchain Node
  • 🤝Referrals/Network Effects
  • 🛡️ Audits
  • 📊Script Network Blockchain Summary
  • Disclaimer
  • Frequently Asked Question
    • To resolve the block height issue
    • Update seed peer to resolve connectivity issue
Powered by GitBook
On this page

Was this helpful?

  1. Smart Contract & App Development

Hardhat

To demonstrate how to develop DApps on Script using the Hardhat suite (https://hardhat.org/hardhat-runner/docs/getting-started#overview). This guide will walk you through the steps to deploy and test on Script using Hardhat and ethers.js (https://docs.ethers.org/v6/).

Setup the Hardhat project

Fund the test accounts with some SPAY

Execute the two commands below to fun the test accounts with some SPAY:

export SEQ=scriptcli query account --address=0x2E833968E5bB786Ae419c4d13189fB081Cc43bab | grep sequence | grep -o '[[:digit:]]\+'

scriptcli tx send --chain="scriptnet" --from=0x2E833968E5bB786Ae419c4d13189fB081Cc43bab --to=0x19E7E376E7C213B7E7e7e46cc70A5dD086DAff2A --spay=1000 --password=qwertyuiop --seq=$(($SEQ+1))

scriptcli tx send --chain="scriptnet" --from=0x2E833968E5bB786Ae419c4d13189fB081Cc43bab --to=0x1563915e194D8CfBA1943570603F7606A3115508 --spay=1000 --password=qwertyuiop --seq=$(($SEQ+2))

Deploy the contract to the script testnet

First, edit the hardhat.config.js file, replace "11...1" with the actual private key of the deployer wallet (should delete the key after use, do NOT commit the private key to GitHub):

...

script_testnet: {

url: https://testeth-rpc-api.script.tv/rpc,

accounts: ["1111111111111111111111111111111111111111111111111111111111111111"],

chainId: 742,

gasPrice: 4000000000000 }, ...

Next, go to the repository's root folder and run this to deploy your contract:

npx hardhat run scripts/deploy.js --network script_testnet

Special Notes on Testing with the Ethers.js+Waffle framework

Note 1: Currently the RPC Adaptor does NOT support non-standard methods such as evm_snapshot, evm_revert, and evm_mine. Thus, test cases using Fixtures (e.g. waffle.loadFixture()) are expected to fail when running against the Script blockchain.

Note 2: Currently the RPC Adaptor returns a generic "evm: execution reverted" messages in most case when the Script EVM execution fails. Some test cases may check the EVM errors with code like this:

await expect(this.bar.leave("200")).to.be.revertedWith("ERC20: burn amount exceeds balance")

To make these test pass, for now we need to replace the expected error message with "evm: execution reverted" as shown below:

await expect(this.bar.leave("200")).to.be.revertedWith("evm: execution reverted")

PreviousTruffleNextRemix

Last updated 1 year ago

Was this helpful?