Quickstart (run the stack)¶
Using the tools you installed in Prerequisites (install tools), start the full hands-on environment together. Do this page after §1.1 of Part 1 of the hands-on.
Estimated time: approx. 15–30 min (the first run pulls Docker images and runs npm install).
This starts 6 kinds of processes. Because the contract deployment and each of the two mediators also take a terminal, you will open 7 terminals in total. Follow the steps in order.
Where this page belongs
- Do this page between §1.1 and §1.2 of Part 1 (Hands-on).
- Before you start, stop the publisher you started in §1.1 (or in §1.2 if you chose HA SSI Publisher). The publisher and the IPFS that this page starts both use port 8080. The command to stop it is in the warning in step 5.
- Previous page: Run the whole pipeline without hardware (HA Demo Simulator) (§1.1). If you pick Pull from Home Assistant (HA SSI Publisher) in §1.2, do this page after that page (§1.2)
- Next page: §1.2 of Hands-on (capture data from a device). If you already did HA SSI Publisher in §1.2, go to §1.3 of Hands-on (trade on the marketplace)
What you are starting — overview¶
flowchart TB
BR["Browser (Chrome etc.) — http://localhost:5173<br>MetaMask handles the purchase"]
UI["iot-market-ui (1)<br>Node.js<br>Svelte/Vite frontend"]
IM["iot-market (2)<br>Hardhat node<br>+ contracts"]
SS["simple-storage (3)<br>Rust<br>data store"]
IP["ipfs (4)<br>+ PostgreSQL<br>Docker"]
MO["mediator-owner<br>(5) Rust"]
MB["mediator-buyer<br>(6) Rust"]
BR --> UI
UI --> IM
UI --> SS
SS --> IP
IP --> MO
IP --> MB
(1) frontend, (2) blockchain, (3) data store, (4) distributed file store, (5)(6) mediators.
Startup order — top to bottom¶
Open seven terminals. Except for the deployment (terminal 2), each process stays running in its own terminal. macOS Terminal: ⌘+T. VS Code: "Split Terminal".
0. Move into the lesson repo¶
The course repository is assumed to be at ~/program/Blockchain_IoT_Marketplace (where you cloned it in Prerequisites (install tools)). A new terminal may open in a different folder, so each terminal moves there with an absolute path.
cd ~/program/Blockchain_IoT_Marketplace
0.5 Check the host name host.docker.internal¶
The mediators and the frontend connect to the name host.docker.internal. Check that this name resolves on your PC.
ping -c 1 host.docker.internal
If it prints cannot resolve or Unknown host, add the following line to your hosts file (administrator rights required).
127.0.0.1 host.docker.internal
- macOS / Linux:
/etc/hosts(e.g.sudo sh -c 'echo "127.0.0.1 host.docker.internal" >> /etc/hosts') - Windows:
C:\Windows\System32\drivers\etc\hosts(when working inside WSL2, the/etc/hostson the WSL2 side)
After adding it, confirm that ping now gets a reply.
1. Start the local blockchain¶
Terminal 1:
cd ~/program/Blockchain_IoT_Marketplace/iot-market
npm install
npx hardhat node
Expected output (excerpt):
Started HTTP and WebSocket JSON-RPC server at http://127.0.0.1:8545/
Accounts
========
WARNING: These accounts ... use only for testing.
Account #0: 0xf39F... (10000 ETH)
Private Key: 0xac09...
...
Account #2: 0x3C44... (10000 ETH)
Private Key: 0x5de4...
...
Don't close this terminal — the chain has to keep running.
The displayed Account #2 + Private Key will be imported into MetaMask shortly (the buyer-side mediator runs as Account #2). Keep them visible. This private key is a publicly known Hardhat test key. Never use it on a real network.
2. Deploy the contracts¶
Terminal 2:
cd ~/program/Blockchain_IoT_Marketplace/iot-market
npx hardhat run scripts/deployMerchandiseWithIoTMarket.ts --network localhost
On success, contract addresses are printed.
3. Start the frontend¶
Terminal 3:
cd ~/program/Blockchain_IoT_Marketplace/iot-market-ui
npm install
npm run dev
Expected output:
VITE v5.x ready in 500 ms
➜ Local: http://127.0.0.1:5173/
Open http://localhost:5173 in a browser. If the search screen titled "IoT データ検索" (IoT data search) appears, the frontend is running.
4. Start the storage server¶
Terminal 4:
cd ~/program/Blockchain_IoT_Marketplace/simple-storage
cargo run
The first run takes a few minutes to compile Rust crates.
When listening on 0.0.0.0:3000 appears, it has started.
5. Start IPFS + PostgreSQL (Docker)¶
If the publisher is running
If a publisher you started in Run the whole pipeline without hardware (HA Demo Simulator) or another page is still running, stop it first. IPFS and the publisher both use port 8080. The command below also stops Home Assistant and Node-RED started by the HA Demo Simulator.
cd ~/program/Blockchain_IoT_Marketplace
docker compose -f infra/docker-compose.yml --profile ha-demo --profile ha-demo-phase3 --profile nodered down
Terminal 5:
cd ~/program/Blockchain_IoT_Marketplace/ipfs
docker compose up -d
-d runs detached. Check status:
docker compose ps
If the STATUS column of the rows whose SERVICE is ipfs and postgres starts with Up, they are running.
6. Start the mediators (owner + buyer)¶
Terminal 6 (owner):
cd ~/program/Blockchain_IoT_Marketplace/mediator-owner
cargo run -- settings/owner_1.yaml
Terminal 7 (buyer):
cd ~/program/Blockchain_IoT_Marketplace/mediator-buyer
cargo run --bin mediator-b
Both have started when they print the following (the first run takes a few minutes to compile).
Pubkey uploaded successfully
====================
Initialization complete!
====================
...
====================
Starting blockchain watch
====================
The owner side then prints Watching raw_data/output for new event files and registers event files written to that folder as merchandise.
Pubkey uploaded successfully means the mediator registered its public key in the PubKey contract. A purchase requires the buyer's public key to be registered. The buyer-side mediator runs as Account #2, so import Account #2 into MetaMask as well.
Verify operation¶
-
Open http://localhost:5173. A search screen titled "IoT データ検索" (IoT data search) appears.

-
Open the page of an item deployed in step 2. You should see its description, price, and a "Purchase!" button.
http://localhost:5173/merchandise/0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9
-
Set up MetaMask (next section).
"Run Search" on the search screen lists only items whose video metadata mediator-owner registered in IPFS and PostgreSQL (the ipfs_records table). The 5 items registered by the deployment in step 2 and items created from event files do not appear in the search. Open the merchandise page URL (http://localhost:5173/merchandise/<item address>) directly. The addresses of the 5 deployed items are printed in step 2 (they are the same every time).
MetaMask local-chain setup¶
Connect MetaMask to the local Hardhat chain.
- Open the MetaMask extension
- Network selector → Add custom network
- Fill in:
- Network name:
Hardhat Local - RPC URL:
http://localhost:8545 - Chain ID:
31337 - Currency:
ETH - Save and switch to the new network
Import the Account #2 Private Key from step 1:
- MetaMask top-right icon → Import account
- Paste the private key (
0x+ 64 hex) - If the imported account shows a balance of about 10000 ETH, the import succeeded (slightly less, 9999.99…, because
mediator-buyerpaid gas to register its public key)
Reference (network add screen):

You can move on if…¶
- All terminals 1–7 are alive (no crash)
- http://localhost:5173 shows the search screen, and a merchandise page URL shows an item
- MetaMask is on the
Hardhat Localnetwork - The MetaMask account shows about
10000 ETH(9999.99… is fine)
All checked → go on to §1.2 of Part 1 in Hands-on, and after you finish one §1.2 page, go on to the listing and purchase in §1.3. If you did Pull from Home Assistant (HA SSI Publisher) before running Quickstart, go straight on to §1.3.
Pages that do not use Quickstart¶
The following pages do not use the Quickstart stack. Each page starts what it needs (such as the publisher) itself.
- Part 1 §1.1: Run the whole pipeline without hardware (HA Demo Simulator)
- Part 1 §1.2: Pull from Home Assistant (HA SSI Publisher)
- Part 2 §2.1–§2.3: Share detections, not raw frames, Share disaster events, Authenticate the data provider (Consent VC / Stage 1), Authenticate the viewer (Viewer VC / Stage 3), Authenticate machines (Service VC / Stage 4 prep)
- Part 2 §2.5: Tier the response by trust (DataUserVC / Stage T), Deliver images and video with tiered access (DataUserVC / Stage T), Tier by semantic level (VLM and semantic representation / Stage T), Prove where an image came from (C2PA / Stage P), Connect provenance to the publisher and the chain (C2PA / Stage P, P1 and P2), Trace a VLM summary back to the image (C2PA / Stage P, P3)
- Every page in Part 3
On pages that start the publisher, stop the Quickstart IPFS (step 5) first. IPFS and the publisher both use port 8080. To stop IPFS, run docker compose down in the ipfs directory.
Of the pages above, the ones that do not start the publisher are Prove where an image came from (C2PA / Stage P) (it runs only Python programs) and the Part 3 pages Run the regional safety assistant and Let an AI plan the steps (LLM Planner) (instead of the publisher, they start the assistant on port 8090 and related services).
Connect provenance to the publisher and the chain (C2PA / Stage P, P1 and P2) starts its own Hardhat node. If the Quickstart Hardhat node (terminal 1) is running, stop it first.
Common stumbles¶
| Symptom | Cause | Fix |
|---|---|---|
npx: command not found |
Node.js missing | revisit Node.js in Prerequisites (install tools) |
cargo: command not found |
Rust missing | revisit Rust in Prerequisites (install tools) |
Port 5173 is in use, trying another one... is printed and it starts on 5174 or another port |
Another app holds 5173 | stop that process and restart, or open the URL that is printed (such as http://127.0.0.1:5174/) |
| The IPFS container or the publisher does not start | The IPFS gateway and the publisher both use port 8080 | They cannot run at the same time. Before a hands-on that uses the publisher, run docker compose down in the ipfs directory |
A mediator stops with dns error or a connection error |
host.docker.internal does not resolve |
Do step 0.5 |
error connecting to docker |
Docker Desktop not running | start Docker Desktop |
| MetaMask "Nonce too high" | Chain restarted out of sync | Settings → Advanced → "Clear activity tab data" (or "Reset Account") |
MetaMask rejects localhost:8545 |
Typo in RPC URL | make sure http:// prefix is there |
Anything else: Troubleshooting, FAQ.
Words you'll learn here¶
| Term | Short meaning |
|---|---|
| Hardhat | Tool that runs an Ethereum-compatible local chain |
| Contract | Code that runs on the blockchain |
| Deploy | Place a contract onto the chain |
| Chain ID | Numeric ID of a network (Hardhat's default is 31337) |
| Vite | Fast frontend dev server |
More: Hardhat Basics (Blockchain Used in This Site), SSI / DID / VC Basics.