# Getting Started

### 1. `git clone` the [Demo Issuer ](https://github.com/0xPolygonID/demo-issuer)Repository

The prerequisites necessary to run the Demo Issuer are:

* [Golang](https://go.dev/doc/install)
* [Ngrok ](https://ngrok.com/download)&#x20;

### 2. Setup a Public URL&#x20;

To run the demo issuer we need to set up a publicly accessible URL. For that, we use ngrok

```bash
ngrok http 8001 
```

```
# Output -> https://ecd9-49-207-208-41.in.ngrok.io
```

### 3. Setup the config

Add the following variables inside the config file

&#x20;`demo-issuer/issuer/issuer_config.default.yaml`:

* `log_level` parameter controls the amount of messages that are generated when running the issuer.
* `db_file_path` is the path to the DB file where the state of the issuer is stored (or will be stored)
* `reset_db` will reset the DB state of issuer on boot.
* `node_rpc_url`is the url of an RPC endpoint that operates on Mumbai Test Network. You can generate one using [Infura](https://app.infura.io) or [Alchemy](https://www.alchemy.com/)
* `publishing_private_key` is the private key of the wallet that will be used to execute any on-chain transactions. Ensure that the account associated with this private has enough test MATIC tokens.

{% hint style="info" %}
You can use [Metamask](https://metamask.io/) to create a new Wallet and use these Faucets ([1](https://mumbaifaucet.com/) and [2](https://mumbaifaucet.com/)) to get MATIC tokens for free by entering your address
{% endhint %}

* `publishing_contract_address` is the address of the contract that manages the state of the identity (in our case the demo-issuer)&#x20;
* `circuits_dir` is the directory which all the required data related to zkp operations (proving/verification) is stored
* `local_url` is the url the HTTP API of the demo-issuer will run locally
* `public_url` is the ngrok public url **obtained from the previous step**

{% code title="demo-issuer/issuer/issuer\_config.default.yaml" %}

```
log_level: TRACE   # TRACE/DEBUG/INFO

# DB
db_file_path: issuer.db
reset_db: true

# On-chain interaction
node_rpc_url: <mumbai-node-rpc>
publishing_contract_address: 0x46Fd04eEa588a3EA7e9F055dd691C688c4148ab3
publishing_private_key: <mumbai-private-key>

# Protocol specific information
circuits_dir: keys
ipfs_url: ipfs.io

# Hosting
local_url: 'localhost:8001'
public_url: https://cb4d-46-121-236-63.eu.ngrok.io
```

{% endcode %}

### 4. Start the Demo Issuer &#x20;

Run the `main.go`file to start the Demo Issuer

```
cd issuer
go run cmd/main.go
```

```
INFO[0000] boot up issuer service                       
INFO[0000] loading Configuration                        
INFO[0000] using config file: /Users/enricobottazzi/Documents/GitHub/demo-issuer/issuer/issuer_config.default.yaml 
INFO[0000] issuer config: &{INFO issuer.db keys https://a0cb-88-147-75-172.eu.ngrok.io localhost:8001 {30237d5b882221685f2926361ca7e81f1235d5faef02bcfbf99f459718bfd952 32} ipfs.io} 
INFO[0000] setting up logger                            
INFO[0000] creating DB                                  
INFO[0000] creating identity state                      
INFO[0000] processing secret key                        
INFO[0000] creating Identity                            
INFO[0000] spining up API server @localhost:8001        
INFO[0000] starting HTTP server (address: localhost:8001) 
```
