arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

Deploy Contracts

At the software level, deploying to Sonic is the same as deploying to any other EVM network.

The only difference is which network you connect to. Use https://rpc.testnet.soniclabs.comarrow-up-right as the connection endpoint for the Sonic testnet or https://rpc.soniclabs.comarrow-up-right for the mainnet.

For the Sonic testnet, you can use the Sonic testnet dashboardarrow-up-right to obtain an initial amount of S to execute transactions on the testnet.

Here are example configurations for Hardhat to deploy on the Sonic mainnet or testnet:

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

// Replace this private key with your Sonic account private key
const SONIC_PRIVATE_KEY 

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

// Replace this private key with your Sonic account private key
const SONIC_PRIVATE_KEY 

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

circle-info

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.

=
"YOUR SONIC TEST ACCOUNT PRIVATE KEY"
;
module.exports = {
solidity: "0.8.26",
networks: {
sonic: {
url: "https://rpc.soniclabs.com",
accounts: [SONIC_PRIVATE_KEY]
}
}
};
=
"YOUR SONIC TEST ACCOUNT PRIVATE KEY"
;
module.exports = {
solidity: "0.8.26",
networks: {
sonic: {
url: "https://rpc.testnet.soniclabs.com",
accounts: [SONIC_PRIVATE_KEY]
}
}
};