Skip to content

Quickstart: your first contract ​

This uses bkc-starter-hardhat, a ready Hardhat project with the BKC plugin wired in. Five minutes, start to verified contract.

Prerequisites ​

  • Node.js 22+
  • A terminal and git

1. Clone and install ​

bash
git clone https://github.com/bkc-network/bkc-starter-hardhat my-app
cd my-app
npm install
cp .env.example .env

2. Create an account ​

bash
npx hardhat bkc-new-account

It prints a 32-byte seed and the account's bkc1… and 0x… addresses. Put the seed in .env:

bash
# .env — gitignored; keep it that way
BKC_SEED=0x…                                # the seed bkc-new-account printed
BKC_EVM_RPC=https://rpc.bkc.network
BKC_COSMOS_RPC=https://comet-rpc.bkc.network
BKC_EXPLORER=https://explorer.bkc.network

Fund the address at the faucet.

The seed is not a private key

BKC keys are ML-DSA-65. The seed is what the key is derived from; a secp256k1 private key from MetaMask means nothing here. The BKC Wallet can export the same kind of seed.

3. Check everything ​

bash
npm run doctor
text
Ready to deploy.

  ok    EVM endpoint           https://rpc.bkc.network · chain 262144
  ok    Cosmos endpoint        https://comet-rpc.bkc.network · bkc-testnet
  ok    account                bkc1…
  ok                           0x…
  ok    balance                1 BKC
  ok    gas price              5000000bkc

Every failing line says what to do. A fresh, unfunded account fails balance.

4. Deploy ​

bash
npm run deploy
text
deploying from 0x…
Counter        0x268f598Cc797A9B1ed1E3eb3619F8ef59d288c76
increment()    0x…
value          1

next: npm run verify -- 0x268f598Cc797A9B1ed1E3eb3619F8ef59d288c76

scripts/deploy.js is ordinary Hardhat code:

js
const counter = await (await hre.ethers.getContractFactory("Counter")).deploy();
await counter.waitForDeployment();
await (await counter.increment()).wait();

5. Verify on the explorer ​

bash
npm run verify -- 0xYourContract

The source appears on explorer.bkc.network. With constructor arguments, pass them after the address. See Verify contracts for what Blockscout does differently.

6. Test against the chain ​

bash
npm test

Tests in test/ run against the live network through the same plugin.

What just happened ​

Nothing in your code mentions ML-DSA. The plugin intercepted the deployment's eth_sendTransaction, wrapped it in a MsgExecuteEvmCall, signed it with your seed and broadcast it through CometBFT RPC; the chain ran it in the EVM and returned an ordinary Ethereum hash and receipt. Details: Transactions & EVM calls.

Next: Hardhat plugin reference · JavaScript SDK

BKC testnet is unaudited. Do not hold value on it.