Skip to content

Latest commit

 

History

History
69 lines (58 loc) · 1.79 KB

File metadata and controls

69 lines (58 loc) · 1.79 KB

Deploying OpenKeyHub Dapp on Internet Computer Local Replica (Testnet)

1. Install DFINITY SDK

sh -ci "$(curl -fsSL https://smartcontracts.org/install.sh)"
dfx --version

If not installed, run the above commands.

2. Start Local Replica

dfx start --background

Make sure no other dfx process is running. If port conflicts, stop previous dfx or use another port.

3. Prepare Project

cd ~/ai-bot-project

Check your dfx.json and ensure canisters are defined. If not, run:

dfx canister create <your_canister>

4. Build Canisters

dfx build

If you see errors, check your Motoko/JS source and dependencies.

5. Deploy to Local Testnet

dfx deploy

This deploys all canisters to your local replica (cost-free). To deploy a single canister:

dfx deploy <canister_name>

6. Access Frontend Locally

Start your frontend (e.g., Vite/Next.js):

pnpm dev
# or
npm run dev

Open your browser to the displayed local address (e.g., http://localhost:5173). If port is busy, check for other processes or change the port.

7. Test Interactions

  • Interact with your canister through the frontend.
  • For backend testing:
dfx canister call <canister_name> <method> <args>

Create mock users/data as needed. Use dfx-generated identities for wallet simulation.

8. (Optional) Deploy to Official IC Testnet

9. Clean Up

dfx stop

Stop the local replica when finished. To reset state, delete the .dfx directory.


For cost-free deployment, always use the local replica (dfx start). Official testnets may require ICP tokens.