Deploy Contract

At the software level, deploying to the Sonic testnet is the same as deploying to the current Opera mainnet or any other compatible network.

The only difference is which network you connect to. Use our open Web3 API balancer at https://rpc.testnet.soniclabs.com/ as the connection endpoint. The number of requests is limited, so please do not overload the connection.

You can use the Sonic testnet dashboard to obtain an initial amount of S to execute transactions on the network.

Here is an example configuration for Hardhat:

require("@nomicfoundation/hardhat-toolbox");

// Replace this private key with your Sonic account private key
const SONIC_PRIVATE_KEY = "YOUR SONIC TEST ACCOUNT PRIVATE KEY";

module.exports = {
  solidity: "0.8.19",
  networks: {
    sonic: {
      url: "https://rpc.testnet.soniclabs.com",
      accounts: [SONIC_PRIVATE_KEY]
    }
  }
};

Please use Solidity build target London (Solidity version 0.8.19 or lower).

To deploy, execute npx hardhat run scripts/deploy.js --network sonic.

Please note that the Sonic testnet is a testing playground designed to showcase technology capabilities. The data stored on the network might eventually be deleted, with or without notice.

Last updated

© 2024 Sonic Labs