Testnet Deployment

Testnet permissionless contract deployment guide

This guide will walk you through deploying a smart contract on the Injective EVM Testnet network.

You can request EVM testnet funds here

Requirements

  1. The guide uses foundry for deployments. Install it by running:

curl -L https://foundry.paradigm.xyz | bash

To verify the installation:

forge --version
  1. Add Injective EVM to your foundry.toml

[rpc_endpoints]
injectiveEvm = "https://k8s.testnet.json-rpc.injective.network/"

Deploying

Due to the EVM-equivalence of Injective, foundry commands should work as expected. The major difference is the network URL. In most cases, using --rpc-url injectiveEvm is sufficient.

cd path/to/your/project

Deploying a smart contract

Your private key should have INJ on the Injective network. A transaction will be created which requires a gas fee. You can request EVM testnet funds here

This command creates a transaction and submits it to the network. If the transaction is successful, the smart contract will be deployed, and the address it is deployed at will be output.

# Broadcasting
forge create \
  src/{YourContract}.sol:{ContractName} \
  --rpc-url injectiveEvm \
  --legacy \
  --private-key {YourPrivateKey} \
  --broadcast

Be sure to copy the address at which the smart contract was deployed, as you will need to use it in subsequent commands.

Verifying on Blockscout

After the deployment is completed, if you visit a network explorer, such as Blockscout, and search for the address of the smart contract, you will see that it has bytecode.

However, to see aditional details, you need to verify the contract.

forge verify-contract \
  --rpc-url injectiveEvm \
  --verifier blockscout \
  --verifier-url 'https://testnet.blockscout-api.injective.network/api/' \
  {SmartContractAddress} \
  src/{YourContract}.sol:{ContractName}

After that, you can navigate to the contract address in Explorer to see the code, the ABI, parsed logs, and callable methods (example).

You can read more about foundry deploying here, or you can check other deployment options here. You can also read more about forge verify-contract here.

Last updated