Custom token creation.
On-chain UI: None yet.
To test the project locally, use the following commands:
# Set rust backtrace to get more useful debug info when things go wrong
export RUST_BACKTRACE=full
# Starts the replica, running in the background
dfx start --clean --background
# Deploys the canisters to the replica and generates the candid interface
dfx deploy
Once the job completes, the application will be available at http://localhost:4943?canisterId={asset_canister_id}
.
Additionally, if you are making frontend changes, you can start a development server with
npm start
Which will start a server at http://localhost:8080
, proxying API requests to the replica at port 4943.
- Find out your principal id:
dfx identity get-principal
- Save it somewhere.
e.g. My principal id is: gbdev-tyqsv-hnvqv-7mgz4-4kcfl-wbv6x-6khez-y56gq-uohqs-quomc-uqe
- Format and store it in a command line variable:
OWNER_PUBLIC_KEY="principal \"$( \dfx identity get-principal )\""
- Check that step 3 worked by printing it out:
echo $OWNER_PUBLIC_KEY
Should give somethine like: jxic7-kzwkr-4kcyk-2yql7-uqsrg-lvrzb-k7avx-e4nbh-nfmli-rddvs-mqe
- Check the owner's balance:
dfx canister call dtoken_backend balanceOf "( $OWNER_PUBLIC_KEY )"
- Check canister ID:
dfx canister id dtoken_backend
- Save canister ID into a command line variable:
CANISTER_PUBLIC_KEY="principal \"$( \dfx canister id dtoken_backend )\""
- Check canister ID has been successfully saved:
echo $CANISTER_PUBLIC_KEY
- Transfer half a billion tokens to the canister Principal ID:
dfx canister call dtoken_backend transfer "($CANISTER_PUBLIC_KEY, 500_000_000)"
- Create and deploy canisters:
dfx deploy --network ic
- Check the live canister ID:
dfx canister --network ic id dtoken_backend
- Save the live canister ID to a command line variable:
LIVE_CANISTER_KEY="principal \"$( \dfx canister --network ic id dtoken_backend )\""
- Check that it worked:
echo $LIVE_CANISTER_KEY
- Transfer some tokens to the live canister:
dfx canister --network ic call dtoken_backend transfer "($LIVE_CANISTER_KEY, 50_000_000)"
- Get live canister front-end id:
dfx canister --network ic id dtoken_frontend
- Copy the id from step 6 and add .raw.ic0.app to the end to form a URL. e.g. zdv65-7qaaa-aaaai-qibdq-cai.raw.ic0.app
If you are hosting frontend code somewhere without using DFX, you may need to make one of the following adjustments to ensure your project does not fetch the root key in production:
- set
NODE_ENV
toproduction
if you are using Webpack - use your own preferred method to replace
process.env.NODE_ENV
in the autogenerated declarations - Write your own
createActor
constructor
- Check on-chain balance:
dfx wallet --network=ic balance
- Get principal ID:
dfx identity get-principal
-
- Format and store it in CLI:
OWNER_PUBLIC_KEY="principal \"$( \dfx identity get-principal )\""
- Format and store it in CLI:
-
- Check it worked:
echo $OWNER_PUBLIC_KEY
- Check it worked:
-
- Check owner balance:
dfx canister call dtoken_backend balanceOf "( $OWNER_PUBLIC_KEY )"
- Check owner balance:
- Get ledger ID:
dfx ledger account-id
- Get on-chain wallet ID:
dfx identity --network=ic get-wallet