当前位置:网站首页>Dfinity (ICP) deployment and development-2
Dfinity (ICP) deployment and development-2
2022-06-13 07:58:00 【Boiled soybeans in brine】
Dfinity Deployment and development
Download and install
at present ,DFINITY Canister SDK Only when equipped with macOS or Linux Running on a computer with an operating system !
Prerequisite installation nodejs
Directly from the terminal on the local computer shell Download the latest version of DFINITY Canister Software development kit (SDK)
sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
This command prompts you to install... On your local computer DFINITY Execute the command line interface (CLI) And its dependencies
type y
And press Return continue installation
verification SDK Ready to use
dfx
By running the following command , Check that you have installed DFINITY Execute the command line interface (CLI) And the executable file is in your PATH Available in the
dfx --version
# The command shows dfx The version information of the command line executable , Similar to :
dfx 0.7.2
dfx --help
# The command shows dfx Usage information of the parent command and its child commands
Create application examples
adopt dfx Command to create a file named hello Project
dfx new hello
The dfx new hello
Command to create a new... For your project hello
Project directory 、 Template file and a Git The repository
Start the local network
Use the project directory as the... In both terminals Current working directory
Run the start command :
dfx start
Keep the terminal running , Open the second terminal window
register 、 Build and deploy applications
node
You have to , Ensure that the module is available in your project directory by running the following command
npm install
Register by running the following command 、 Build and deploy your first application
dfx deploy
dfx deploy
Output display information about the operation it performs . for example , This step registers two network specific identifiers —— One for the hello
The main program , One for the hello_assets
Front end user interface —— And installation information similar to the following :
Creating the "default" identity. - generating new key at /Users/pubs/.config/dfx/identity/default/identity.pem Created the "default" identity. Creating a wallet canister on the local network. The wallet canister on the "local" network for user "pubs_user_id" is "rwlgt-iiaaa-aaaaa-aaaaa-cai" Deploying all canisters. Creating canisters... Creating canister "hello"... "hello" canister created with canister id: "rrkah-fqaaa-aaaaa-aaaaq-cai" Creating canister "hello_assets"... "hello_assets" canister created with canister id: "ryjl3-tyaaa-aaaaa-aaaba-cai" Building canisters... Building frontend... Installing canisters... Creating UI canister on the local network. The UI canister on the "local" network is "r7inp-6aaaa-aaaaa-aaabq-cai" Installing code for canister hello, with canister_id rrkah-fqaaa-aaaaa-aaaaq-cai Installing code for canister hello_assets, with canister_id ryjl3-tyaaa-aaaaa-aaaba-cai Authorizing our identity (pubs_user_id) to the asset canister... Uploading assets to asset canister... /index.html 1/1 (472 bytes) /index.html (gzip) 1/1 (314 bytes) /index.js 1/1 (260229 bytes) /index.js (gzip) 1/1 (87771 bytes) /main.css 1/1 (484 bytes) /main.css (gzip) 1/1 (263 bytes) /sample-asset.txt 1/1 (24 bytes) /logo.png 1/1 (25397 bytes) /index.js.map 1/1 (842559 bytes) /index.js.map (gzip) 1/1 (228432 bytes) /index.js.LICENSE.txt 1/1 (499 bytes) /index.js.LICENSE.txt (gzip) 1/1 (285 bytes) Deployed canisters.
When first deployed ,dfx
Will create a default
Identity and one by your default
Identity controlled local loop wallet . The cycle wallet is a special type of container , Allows you to transfer cycles to other containers .
To deploy this sample application locally , You don't need to know about the default developer identity 、 Use the cycle wallet or manage any information about the cycle . We will cover these topics later , But now , Note that these themes are automatically created for you
Call... By running the following command hello
Containers and predefined greet
function
dfx canister call hello greet everyone
- The
dfx canister call
The command requires you to specify the container name and the method or function to call . hello
Specifies the Containers The name of .greet
Specifies the... To be called in the container function The name ofhello
.everyone
It's to pass on togreet
The text data type parameter of the function .
Verify command display greet
The return value of the function
("Hello, everyone!")
Stop the network
Stop local Internet computer network , So that it will not continue to run in the background
To stop the local network :
In the terminal that displays the network operation , Press Control-C Interruptible local network processes .
Stop the local... Running on the local computer by running the following command Internet computer network :
dfx stop
边栏推荐
- 21 | pipeline oriented instruction design (Part 2): How did Pentium 4 fail?
- 免费文件服务器储存技术
- 6. fabric2.2 stop clustering and delete data (use the official demo)
- 本地靶场2-文件上传漏洞(三)-网络安全
- 19 | 建立数据通路(下):指令+运算=CPU
- 1. fabric2.2 comprehensive learning - Preface
- Give code vitality -- the way to read code neatly
- 钉钉小程序 父子传参数对象 子组件页面不更新?
- 19 | establish data path (bottom): instruction + operation =cpu
- [introduction to flirting with girls on Valentine's day -- 63 lines of code to win]
猜你喜欢
Redis Cluster - the bottom principle of building clusters
Practice makes sense -- your byte alignment and stack cognition may be wrong
Remote office solution under epidemic situation
Redis learning journey master-slave replication
[problem record] taberror: inconsistent use of tabs and spaces in indentation
19 | 建立数据通路(下):指令+运算=CPU
24 | 冒险和预测(三):CPU里的“线程池”
Advanced MySQL: how to learn MySQL source code
Tidb certification guide PCTA Pctp
Structural analysis of hyperledger fabric (I)
随机推荐
Redis master-slave replication - mentality detection mechanism
IIS中的网站访问excel
24 | 冒险和预测(三):CPU里的“线程池”
Install cuda+cusp environment and create the first helloword starter project
24 | adventure and prediction (III): thread pool in CPU
[deep learning]: introduction to pytorch to project practice (XII) convolutional neural network: padding and stride
Openharmony notes ----------- (I)
[problem record] taberror: inconsistent use of tabs and spaces in indentation
21 | pipeline oriented instruction design (Part 2): How did Pentium 4 fail?
Index invalidation caused by inaccurate MySQL statistics
[introduction to flirting with girls on Valentine's day -- 63 lines of code to win]
Selenium reports an error deprecationwarning: executable_ path has been deprecated, please pass in a Service object
Win10系统如何修改桌面路径
IDS persistence ---rdb
Tidb source code series: immersive compilation of tidb
[redis problem] record a big key problem handling
Data warehouse data processing and data flow
P7712 [Ynoi2077] hlcpq
Leetcode 163 Missing interval (June 12, 2022)
How app inventor accesses resource files in assets directory