Skip to content

Agent009/bc-ic-hello

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hello

See src/hello_backend and src/hello_frontend. Based on the official tutorial. Contains a single canister callable function called greet.

On-chain UI: https://uv34l-oaaaa-aaaap-qa4ua-cai.ic0.app/

Running the project locally

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.

Note on frontend environment variables

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:

  • setNODE_ENV to production 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

Deploy on the IC network

Deploy local build

  • Run: dfx deploy --network ic

Deploy canisters individually

  • Create canister on the IC network: dfx canister --network ic create hello_backend --with-cycles 1000000000000
  • Build WebAssembly module: dfx build --network ic hello_backend
  • Install WebAssembly module inside the canister: dfx canister --network ic install hello_backend
  • Call canister method: dfx canister --network ic call hello_backend greet '(" world")'

Useful commands

  • Check on-chain balance: dfx wallet --network=ic balance
  • Get principal ID: dfx identity get-principal
  • Get ledger ID: dfx ledger account-id
  • Get on-chain wallet ID: dfx identity --network=ic get-wallet

Resources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published