Skip to main content

Issuer

GitHub repository

Requirements

  1. cargo, with rustc 1.74 or newer
  2. docker

Prepare environment

  1. Generate contract bindings (to be done once or if contract change)
# assuming the mediterraneus-smart-contracts folder is located in the same root folder of mediterraneus-connector-rs
cd abigen
cargo run -- --contract Identity --abi-source "../../mediterraneus-smart-contracts/artifacts/contracts/Identity.sol/Identity.json"
  1. Create a .env file starting from .env.example and update the values accordingly to your development enviroment.
L2_PRIVATE_KEY='<issuer private key>'
NON_SECURE_MNEMONIC='<iota wallet mnemonic>'
KEY_STORAGE_MNEMONIC='<identity key storage mnemonic>'
IDENTITY_SC_ADDRESS='<address of the Identity smart contract>'

Running the Application

  1. Start up the database by running:
docker compose --profile dev up -d
  1. Run the issuer service
cd server
# For local node Provider
cargo run --release -- --rpc-provider "http://127.0.0.1:8545/" --chain-id 31337

# For Shimmer Provider
cargo run --release -- --rpc-provider "https://json-rpc.evm.testnet.shimmer.network" --chain-id 1073

# For Sepolia
cargo run --release -- --rpc-provider https://sepolia.infura.io/v3/<API_KEY> --chain-id 11155111

Run everything via Docker

Beware of the configuration of the environment variables. Note: Modify .env reasonably. (ADDR and PG.HOST must be changed for the deployment use case).

Copy the smart contract json files to create the Rust bindings (mandatory if the smart contracts change. There is already a copy in this repo).

# assuming the mediterraneus-smart-contracts folder is located in the same root folder of mediterraneus-connector-rs
cp ../mediterraneus-smart-contracts/artifacts/contracts/Identity.sol/Identity.json ./smart-contracts

Commands to build the app’s container image and launch the app container:

docker compose --profile deploy up -d