Learn to write a hello world program on a local setup of Internet Computer Protocol (ICP)
Learn to write a hello world program on a local setup of Internet Computer Protocol (ICP)
Step 1: In this exercise, we will learn to create and deploy Hello World program on local Internet Computer (ICP) setup.
Step 2: Create a new project named 'hello' by using dfx. dfx is is the command-line interface for the IC (Internet Computer) SDK
Step 3: Change the directory to 'hello'.
Step 4: Start a local instance of IC to test and deploy program. The --background flag runs the IC in the background.
Step 5: Ensure that node modules are available in your project directory.
Step 6: Register, build, and deploy your first dapp on local IC instance.
Step 7: Deployment registers two identifiers i.e. hello_backend main program and hello_frontend frontend user interface.
Step 8: Switch to VS Code view by clicking the 'VS Code' button. And inspect the contents of 'hello' directory.
Step 9: The 'src' sub-directory of the 'hello' directory, contains two sub-directories i.e. 'hello_backend' and 'hello_frontend'. The backend motoko program is located in 'hello/src/hello_backend' directory. The frontend HTML and JavaScript files are located in 'hello/src/hello_frontend/src' directory.
Step 10: In backend code, we can observe function 'greet'. Let's call the 'greet' function of the 'hello_backend' canister, with 'everyone' as the argument.
Step 11: After you are done with the exercise, stop the local IC instance.
Step 12: This way, we can develop, deploy and test our programs on local IC instance.