---
# System prepended metadata

title: 'Deploying a smart contract in Görli, step by step'

---

# Deploying a smart contract in Görli, step by step

This manual discribes the steps to be taken to deploy a contract in Görli. In particular, we will deploy the PriceFeed contract included in the example [witnet-goldprice-example](https://github.com/stampery-labs/witnet-goldprice-example).

## Connecting to the Görli node

The first thing we need to do is connect to the Görli node in order to be able to migrate the contracts.
Supposing we have the azure credentials, we just connect to the node using the following commands:

`cd .ssh`
`ssh -L 8545:127.0.0.1:8545 witnet@52.166.178.145 -i <publicKey>`

NOTE: 1. The port for the Görli network is the 8545, this can be found in the truffle configuration file. If we need to connect to other network, Rinkeby for instance, we just need to change the port.


## Migrating the contracts

Now that we are connected to Görli, we can migrate the GoldPrice contracts.

First we need to clone the [repository](https://github.com/stampery-labs/witnet-goldprice-example).

Then we compile the requests and the contracts:

```
cd witnet-goldprice-example
yarn compile-requests
yarn compile-contracts

```

finally we can migrate the contracts using the following command:

```
yarn migrate-flattened --network goerli
```


## Verifing the contract

If we want to interact with the contract first we need to verify the contract. To do so, we go to [Etherscan](https://goerli.etherscan.io/) and search the PriceFeed contract address. (In the contract's box, if there is no green check that means tht is not been verified). We click on the contract tab and then on __Verify and Publish Contract__. We add the following parameters (the information is described in the flattened configuration file):

![](https://i.imgur.com/Ziykb6X.png)

Optimization section: yes

![](https://i.imgur.com/UBdMuXv.png)

Copy the Flattened.sol in the section __Enter the Solidity Contract Code below__

![](https://i.imgur.com/27t5J9v.png)


Now we need to add the address needed in the constructor. This must be in a specific format:
Suppose the address is 0x996be500ebf09537edde024f70ffdfa55089e939, then we add 000000000000000000000000996be500ebf09537edde024f70ffdfa55089e939. 

We also add the Libraries that uses the contract, is our case just the Witnet library, here the address is just the same as in the migration file.

And this is it! When confirming the above message should appear

![](https://i.imgur.com/bvIzAke.png)

## Interacting with the contract

In this last section we'll see how to interact with the PriceFeed contract. First we search for the address in [Etherscan](https://goerli.etherscan.io/). It should apprear something similar to the next

![](https://i.imgur.com/4iakoBB.png)


When clicking on the contract section, we can read or write in the contract.

![](https://i.imgur.com/eOa5BxE.png)

We click on write contract, and select, for example, _requestupdate_ with _payableAmout_ 0.003 eth. In order to send this tx we need to connect to our metamask account, and confirm the tx.

![](https://i.imgur.com/ctg7gXz.png)

In the transactions section we can check that our tx has been included.