# Deploy a Smart Contract on Volta with Remix

Below are steps to deploy a [smart contract](https://ethereum.org/en/developers/docs/smart-contracts/) on the [Volta Test Network](testnet-and-mainnet) (the test network for the [Energy Web Chain](..)) using [Remix](https://remix.ethereum.org). Remix is a web application used to compile, deploy and test smart contracts on Ethereum networks.&#x20;

In order to deploy a smart contract to the Energy Web Chain Main Network, rather than the Volta Test Network, the steps are identical, except that you will connect your MetaMask to the Energy Web Chain rather than to Volta. We recommend that you always deploy and test your smart contracts to Volta first to make sure they behave as expected.&#x20;

Once your smart contract is deployed, you can use the contract's ABI and address on the blockchain to interact with its public methods. For more information on how to interact with smart contracts, go [here](interacting-with-a-smart-contract).&#x20;

### 1. Configure MetaMask to connect to the Volta Test Network

You can see steps for doing this  are [here](connect-to-energy-web-chain-main-network-with-metamash). If you do not have a MetaMask installed, you can do so [here](https://metamask.io/).&#x20;

### 2. Get Volta Tokens

You will need [Volta tokens](../../../community-resources/using-the-energy-web-chain/volta-testnet-token) to to pay for the transaction fee for deploying the smart contract to the blockchain. For directions on how to get Volta Tokens, go [here](../../../community-resources/using-the-energy-web-chain/volta-testnet-token). To learn more about what transaction fees are, you can go [here](../../../foundational-concepts/ethereum/transaction-costs).&#x20;

\*Note that if you are deploying to the Energy Web Main Network, you will need to have [EWT](../../energy-web-token#get-ewt).&#x20;

### 3. Navigate to [remix.ethereum.org ](https://remix.ethereum.org)

### 4. Navigate to the "Deploy and Run Transactions" icon on the left panel (shown below).

In the "Environment" dropdown, selected "Injected Web3". Notice that when you select this, "Custom (73799) network shows up. 73799 is the Volta Test Network - this confirms that we are connected to the Volta network via MetaMask.&#x20;

![](https://2400236058-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_pXALj14Egb-5Bal_p%2F-Mkj6eybvHAJX3g7nu1U%2F-Mkj9x355v97MmqFaRlR%2FScreen%20Shot%202021-09-28%20at%209.27.40%20PM.png?alt=media\&token=1df9f678-078f-4cb2-830b-2351fbe4872d)

### 5. Confirm the connection on MetaMask

You will need to confirm the connection to MetaMask.

### 6. Create a simple smart contract

Go to the  file explorer panel (select the first icon on the left panel). Add a new .sol file in the 'Contracts' folder. Below it is called VoltaContract.sol.

![](https://2400236058-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_pXALj14Egb-5Bal_p%2F-Mkj6eybvHAJX3g7nu1U%2F-MkjAg3h22aSI9JIegR8%2FScreen%20Shot%202021-09-28%20at%209.31.24%20PM.png?alt=media\&token=cda4601e-5323-48a4-9e89-78fe1540861f)

In the .sol file, add the following code:

```
pragma solidity >=0.4.0 <0.7.0;

contract SimpleReturn {
    function get() public pure returns (string) {
        return "Volta";
    }
}
```

### **7. Compile the smart contract**

If there are no errors, click "Compile VoltaContract.sol" (make sure that the 'Language' selected is 'Solidity').

![](https://2400236058-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_pXALj14Egb-5Bal_p%2F-Mkj6eybvHAJX3g7nu1U%2F-MkjK6E6C45srw9me5cn%2FScreen%20Shot%202021-09-28%20at%2010.13.10%20PM.png?alt=media\&token=d13c5d06-ca86-436e-b6ce-323d87578204)

### **8. Copy the deployed contract's** [**ABI**](https://docs.soliditylang.org/en/v0.5.3/abi-spec.html) **(Application Binary Interface)**

If you want to interact with your contract in the future using an API client, you will need the contract's ABI. The ABI is in the bottom right hand corner of the Solidity Compiler page after it is compiled.&#x20;

![](https://2400236058-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_pXALj14Egb-5Bal_p%2F-Mkj6eybvHAJX3g7nu1U%2F-MkjKO51NuZLdjsWsezu%2FScreen%20Shot%202021-09-28%20at%2010.14.53%20PM.png?alt=media\&token=b12d108f-be04-4e2a-8b41-8c77f31e4c37)

### **9.** Deploy the smart contract

Click 'Deploy' to deploy the contract to Volta Test Network.

![](https://2400236058-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_pXALj14Egb-5Bal_p%2F-Mkj6eybvHAJX3g7nu1U%2F-MkjD9seEi8k4VfqE_Gw%2FScreen%20Shot%202021-09-28%20at%209.40.11%20PM.png?alt=media\&token=eed6cd99-24f3-4c21-870f-8921400ea840)

Confirm the transaction in MetaMask. **Make sure that you have some gwei as a gas price by doing the following**:

Select **EDIT**

![Select Edit](https://2400236058-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_pXALj14Egb-5Bal_p%2F-Mkj6eybvHAJX3g7nu1U%2F-MkjDp50m19_4eZ8uigs%2FScreen%20Shot%202021-09-28%20at%209.46.16%20PM.png?alt=media\&token=05b528e8-c123-4e2b-abce-f4a3821d20fa)

Select "Edit suggested gas fee"

![](https://2400236058-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_pXALj14Egb-5Bal_p%2F-Mkj6eybvHAJX3g7nu1U%2F-MkjFhu4GhGbeHZD8bln%2FScreen%20Shot%202021-09-28%20at%209.54.19%20PM.png?alt=media\&token=1f0fed5d-4298-4c46-98db-6f450e9cec69)

**Make sure you have a Gas price of 6e-8 GWEI (this should be autofilled)**

![](https://2400236058-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_pXALj14Egb-5Bal_p%2F-Mkj6eybvHAJX3g7nu1U%2F-MkjFlwHk_P6gtdsh6RS%2FScreen%20Shot%202021-09-28%20at%209.54.25%20PM.png?alt=media\&token=0b648230-a81f-4cc0-a70a-2cf942fe1c40)

Confirm the transaction in MetaMask

### 10. See and test the deployed transaction

Once your contract is deployed, you can see it in the **"Deployed Contracts**" section of the same page ("Deploy and Run Transactions")

![](https://2400236058-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_pXALj14Egb-5Bal_p%2F-Mkj6eybvHAJX3g7nu1U%2F-MkjGAgjQLdWpgW0Nm0k%2FScreen%20Shot%202021-09-28%20at%209.55.35%20PM.png?alt=media\&token=cd9b0eed-8657-422d-9f41-615ef07d0f28)

Click on "get" to test our contract's functionality. Remember from the code that is should just return a string "Volta".&#x20;

![Returns string "Volta"](https://2400236058-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_pXALj14Egb-5Bal_p%2F-Mkj6eybvHAJX3g7nu1U%2F-MkjGR9oTo6O7BSxIgBB%2FScreen%20Shot%202021-09-28%20at%209.55.55%20PM.png?alt=media\&token=d5a11899-520c-4166-aea2-12269bd15ddd)

### 11. See deployed contract on the Volta Block Explorer

Copy the address of the contract by clicking the copy icon.

![](https://2400236058-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_pXALj14Egb-5Bal_p%2F-Mkj6eybvHAJX3g7nu1U%2F-MkjH9nvrr8SGzS9IRtC%2FScreen%20Shot%202021-09-28%20at%2010.00.34%20PM.png?alt=media\&token=cb9428a3-920d-4b70-a1dd-898675621a31)

Go to the [Volta Block Explorer (volta-explorer.energyweb.org)](https://volta-explorer.energyweb.org). If you are deploying to the main network, the block explorer is [explorer.energyweb.org](https://explorer.energyweb.org).&#x20;

Paste the contract address in the search bar at the top right:

![](https://2400236058-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_pXALj14Egb-5Bal_p%2F-Mkj6eybvHAJX3g7nu1U%2F-MkjIh2EWFZjDtXtQjz5%2FScreen%20Shot%202021-09-28%20at%2010.07.28%20PM.png?alt=media\&token=05ba3c41-2090-4ee3-b01f-8c844ac65561)

You can see the smart contract address details, the block it was created in, and the byte code. The block explorer contract details from the example above is [here](https://volta-explorer.energyweb.org/address/0x7D6FA5708aa3AcFf1A22f864d3a4809B6EaAEAB5/transactions).&#x20;

![Block explorer details for contract created](https://2400236058-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_pXALj14Egb-5Bal_p%2F-Mkj6eybvHAJX3g7nu1U%2F-MkjIC-vg8rAX6MXPrPC%2FScreen%20Shot%202021-09-28%20at%2010.05.15%20PM.png?alt=media\&token=3d4c4113-4162-49f6-8d0e-db2ccf8801e5)

### 12. Use your smart contract in dapps

Now that you have your smart contract's address on the blockchain and its ABI, you can use an Ethereum API client to interact with your contract in your decentralized applications. For a tutorial on how to do this, go [here](interacting-with-a-smart-contract).&#x20;

{% content-ref url="interacting-with-a-smart-contract" %}
[interacting-with-a-smart-contract](interacting-with-a-smart-contract)
{% endcontent-ref %}

