# Deploying a Smart Contract on Bellecour
This is my public notepad to document deploying a smart contract on iExec's Bellecour (a Sidechain that serves as the main blockchain used by NGI ONTOCHAIN). Feel free to edit & comment!
## Preparation
* install & configure [Metamask Plugin](https://github.com/MetaMask/metamask-extension/) on Firefox
* get your [address whitelisted by iExec](https://iexecproject.atlassian.net/servicedesk/customer/portals)
* have the source code for a smart contract ready: [Gist link](https://gist.github.com/fabianekc/b1ea60e79715ad9f3d4e0ea8665c57ca)
## Deployment
* use https://remix.ethereum.org
- in **Deploy & Run Transactions** select for *Environment*: "Injected Provider - Metamask"
- in **File Explorer** create a file with the [source code of the smart contract](https://gist.github.com/fabianekc/b1ea60e79715ad9f3d4e0ea8665c57ca), then right-click the file and select "Compile"
- in **Deploy & Run Transactions** click "Deploy" and note down *transaction hash*
for our example: `0x073091ead85dbc3a6aaa591bf7e9ad2b1136b637eac73254b908e8d57bc0c850`
- in **Solidity Compiler** click "Compilation Details" and copy "ABI"
- also note version of used compiler (here: `0.8.17+commit.8df..`)
* go to Bellecour BlockScout: https://blockscout-bellecour.iex.ec/
- search in the upper-right corner the transaction: 0x073..850 and get contract address
for our example: here [the link](https://blockscout-bellecour.iex.ec/tx/0x073091ead85dbc3a6aaa591bf7e9ad2b1136b637eac73254b908e8d57bc0c850/internal-transactions)
- click on the contract address (`0xF31..2AE`), and go to section "Code": here [the link](https://blockscout-bellecour.iex.ec/address/0xF31A125fb44E0c2dca45c2665F272e9fc09f92AE/contracts) and click: *Verify & Publish* (this step is optional)
- fill out Contract Name from smart contrcat source code (for our example: "LogStorage")
- set the compile version to the one used in Remix / Solidity Compiler (here: `0.8.17+commit.8df..`)
- enter the Solidity Contract Code: [paste source code](https://gist.github.com/fabianekc/b1ea60e79715ad9f3d4e0ea8665c57ca)
- leave all other fields with default values/empty
- make sure that optimization is turned off
- click "Verify & publish"
- there should be now a green check mark next to "Code"
[link to validated smart contract](https://blockscout-bellecour.iex.ec/address/0xF31A125fb44E0c2dca45c2665F272e9fc09f92AE/contracts)
## Execution
* use JavaScript
create an empty directory and use a JS file `alt.js`: [Gist link](https://gist.github.com/fabianekc/07ac542dfc662172ce049c1c39051eae)
```
npm init
npm i web3
node alt.js
```
* example transactions: https://blockscout-bellecour.iex.ec/address/0xF31A125fb44E0c2dca45c2665F272e9fc09f92AE/transactions