# Development



# Deploying a smart contract on BPX mainnet using Remix IDE

1. Open [Remix IDE](https://remix.ethereum.org).

[![remix1.png](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/scaled-1680-/izSr2bshAKWbnmqr-remix1.png)](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/izSr2bshAKWbnmqr-remix1.png)

2\. In our example, we will use one of the sample contracts from the IDE. This contract provides two functions: the first, `store`, allows you to save any number in the contract, while the second, `retrieve`, enables you to read the stored number. Open the `contracts/1_Storage.sol` file.

[![remix2.png](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/scaled-1680-/emlUI9RL3Z2VMrRL-remix2.png)](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/emlUI9RL3Z2VMrRL-remix2.png)

3\. Compile the contract by right-clicking on the file name and selecting **Compile**.

[![remix3.png](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/scaled-1680-/8aDKXISPP0mbZsBD-remix3.png)](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/8aDKXISPP0mbZsBD-remix3.png)

4\. When the source code is error-free and the compilation is successful, you will see a green success icon.

[![remix4.png](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/scaled-1680-/7Ti4VpcSIvpRlU6M-remix4.png)](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/7Ti4VpcSIvpRlU6M-remix4.png)

5\. Go to the **Deploy** tab.

[![remix5.png](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/scaled-1680-/5nrXlGqJA4xJFtc6-remix5.png)](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/5nrXlGqJA4xJFtc6-remix5.png)

6\. Expand the **Environment** list and select **Injected Provider - MetaMask**.

[![remix6.png](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/scaled-1680-/CahdOX6kYhQ1iqje-remix6.png)](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/CahdOX6kYhQ1iqje-remix6.png)

7\. Now MetaMask will prompt you for permission to connect to Remix IDE. Agree to the connection.

[![remix7.png](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/scaled-1680-/uhqiKHEpqPF1W9ti-remix7.png)](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/uhqiKHEpqPF1W9ti-remix7.png)[![remix8.png](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/scaled-1680-/ZO7wvczug8zXOHvl-remix8.png)](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/ZO7wvczug8zXOHvl-remix8.png)

8\. After successfully connecting, you should see your account address and its balance in the highlighted field.

[![remix9.png](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/scaled-1680-/i9mkkq84ELBg9sY6-remix9.png)](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/i9mkkq84ELBg9sY6-remix9.png)

9\. Click "**Deploy**" to begin deploying your contract. Confirm the suggested gas settings.

[![remix10.png](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/scaled-1680-/qDT5l3y7T7e7b8r0-remix10.png)](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/qDT5l3y7T7e7b8r0-remix10.png)

10.In the MetaMask popup window, change the gas settings by clicking on "**Site suggested**," then select the "**Market**" option. After that, confirm the transaction.

[![remix11.png](https://docs.bpxchain.cc/uploads/images/gallery/2024-11/scaled-1680-/X6od3Ux8ruO0NN3L-remix11.png)](https://docs.bpxchain.cc/uploads/images/gallery/2024-11/X6od3Ux8ruO0NN3L-remix11.png) [![remix12.png](https://docs.bpxchain.cc/uploads/images/gallery/2024-11/scaled-1680-/zLbksXNx8hBCMeUZ-remix12.png)](https://docs.bpxchain.cc/uploads/images/gallery/2024-11/zLbksXNx8hBCMeUZ-remix12.png) [![remix13.png](https://docs.bpxchain.cc/uploads/images/gallery/2024-11/scaled-1680-/uBwFAMI4BuMaVWVx-remix13.png)](https://docs.bpxchain.cc/uploads/images/gallery/2024-11/uBwFAMI4BuMaVWVx-remix13.png)

11\. Your contract is now deploying. If you open the MetaMask window, you should see a new pending transaction.

[![remix14.png](https://docs.bpxchain.cc/uploads/images/gallery/2024-11/scaled-1680-/hZFkqzqDbP6qVFjm-remix14.png)](https://docs.bpxchain.cc/uploads/images/gallery/2024-11/hZFkqzqDbP6qVFjm-remix14.png)

12\. Once the transaction is confirmed by the blockchain, you will see its confirmation and a new entry in the Deployed Contracts section. Your contract has been successfully deployed.

[![remix15.png](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/scaled-1680-/5pHV9aYO4r4SEkYY-remix15.png)](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/5pHV9aYO4r4SEkYY-remix15.png)

13\. You can use the highlighted button to copy the address of your new contract.

[![remix16.png](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/scaled-1680-/QgbC5WF9bRu1H8U4-remix16.png)](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/QgbC5WF9bRu1H8U4-remix16.png)

14\. You can interact with your contract directly from the IDE. Expand the list of contract methods to access them.

[![remix17.png](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/scaled-1680-/WNPKcrYHKHK08pNs-remix17.png)](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/WNPKcrYHKHK08pNs-remix17.png)

15\. Let's call the first function (`store`) to save a number in our sample contract. Enter a random number in the text field next to the "**store**" button, and then press the "**store**" button.

[![remix18.png](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/scaled-1680-/qib8GMYrxJykPx9O-remix18.png)](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/qib8GMYrxJykPx9O-remix18.png)

16\. Confirm the transaction in your wallet as you did when deploying the contract. Saving data to a smart contract requires a transaction on the blockchain.

17\. When the transaction is confirmed, call the second method (`retrieve`) to read the number stored in the smart contract. Click the "**retrieve**" button, and the blockchain will return the value stored in the contract.

[![remix19.png](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/scaled-1680-/gyTicg4MDqeOJPDd-remix19.png)](https://docs.bpxchain.cc/uploads/images/gallery/2023-06/gyTicg4MDqeOJPDd-remix19.png)