Deploy Smart Contracts to MainNet

To Share and +4 nLEARNs

Once you are ready to deploy your smart contract to MainNet
you’ll need to change your network by prepending NEAR_ENV=mainnet
to all near-cli commands.

  1. Start off by logging into the account you want to deploy your contract
    to:
NEAR_ENV=mainnet near login
  1. Next deploy your contract:
NEAR_ENV=mainnet near deploy --accountId YOUR_CONTRACT_ACCOUNT.near --wasmFile out/YOUR_CONTRACT.wasm
  1. Finally, you can call any initialization contract methods:
NEAR_ENV=mainnet near call YOUR_CONTRACT_ACCOUNT.near init '{}' --accountId YOUR_CONTRACT_ACCOUNT.near
Generate comment with AI 2 nL
Scroll to Top
Report a bug👀