Skip to content
blockmart

How it works

BlockMart is a demo of an online shop that has no private database. Here is what happens behind the buttons.

  1. 1

    The shop is a smart contract

    A normal shop keeps prices, stock and orders in a database only the owner can see or change. BlockMart keeps them in a small program on a blockchain. Anyone can read it, and it follows the same rules for everyone.

  2. 2

    You pay with MART coins

    A second contract is the coin. It sells MART at a fixed price of 0.0001 test ETH each, so the exchange rate cannot be quietly changed.

  3. 3

    Checkout is one transaction

    When you pay, the shop contract checks every item is in stock, takes the coins, lowers the stock and files your order, all in one step. If any part fails, none of it happens and you are not charged.

  4. 4

    Your wallet is your account

    There is no sign-up or password. Your orders are stored against your wallet address, so they show up wherever you connect that wallet.

  5. 5

    Everything is on the ledger

    Each purchase gets a transaction ID. Open it on the Ledger page to see who paid, what was bought, in which block, and what the network fee was.

What is real and what is pretend

Real

  • The contracts are real Solidity code running on an Ethereum-compatible chain.
  • Every purchase is a signed transaction, mined into a block.
  • Stock really runs out, and the contract really refuses orders you cannot pay for.
  • MetaMask works with it, like on any other network.

Pretend

  • The chain is a private test network that this site runs for itself. It is not Ethereum mainnet.
  • Test ETH and MART coins are free and have no value.
  • The products are made up. Nothing is shipped.
  • The chain may be reset now and then, which clears balances and orders.

Under the hood

Contracts
Solidity 0.8, tested with Foundry
Website
Next.js, TypeScript, Tailwind CSS, viem
Demo wallet
A key made in your browser. It signs transactions locally and never leaves your device
Coin contract
0xa5d0366fb983ca7c55b132b2b144027b42df9c4e
Shop contract
0x2cbf915968be45f1cad16ea9d6c103f872ec29d3

The source code is on GitHub.