1
1
---
2
- title : 10 Minute Quickstart
3
- description : Learn Kadena’s core concepts & tools for development in 10 minutes
4
- menu : Quickstart
5
- label : 10 Minute Quickstart
6
- order : 1
2
+ title : 10 minute quickstart with Kadena
3
+ description : Kadena makes blockchain work for everyone.
4
+ menu : undefined
5
+ label : 10 minute quickstart with Kadena
6
+ order : 0
7
+ editLink : https://github.com/kadena-community/kadena.js/edit/main/packages/./.tempimport/kadena-community/getting-started/README.md
7
8
layout : full
8
- tags : [devnet, chainweaver, tutorial, docker, transactions]
9
+ tags : [devnet,chainweaver,tutorial,docker,transactions]
10
+ lastModifiedDate : Thu, 19 Oct 2023 13:23:55 GMT
9
11
---
10
-
11
12
# 10 minute quickstart with Kadena
12
13
13
14
Welcome to the world of Kadena, a powerful blockchain platform that combines
@@ -21,25 +22,25 @@ blockchain in 10 minutes
21
22
22
23
## Start fat-container ` kadena/devnet `
23
24
24
- 1 . Create docker volume
25
+ 1 . Create docker volume
25
26
26
- ``` shell
27
- docker volume create kadena_devnet
28
- ```
27
+ ``` shell
28
+ docker volume create kadena_devnet
29
+ ```
29
30
30
- 2 . start kadena-devnet fat-container
31
+ 2. start kadena-devnet fat-container
31
32
32
- ``` shell
33
- docker run -it -p 8080:8080 -v kadena_devnet:/data --name devnet kadena/devnet
34
- # restart with
35
- docker start devnet
36
- ```
33
+ ` ` ` shell
34
+ docker run -it -p 8080:8080 -v kadena_devnet:/data --name devnet kadena/devnet
35
+ # restart with
36
+ docker start devnet
37
+ ` ` `
37
38
38
39
# # Monitor the blockchain
39
40
40
41
In the fat-container we expose an explorer that connects to the devnet
41
42
42
- 1 . Go to http://localhost:8080/explorer/
43
+ 1. Go to http://localhost:8080/explorer/
43
44
44
45
Here you can see the blocks that are mined, and the transactions that are
45
46
executed
@@ -49,28 +50,28 @@ workflow, the devnet mines a block in 5 seconds.
49
50
50
51
# # Chainweaver wallet
51
52
52
- 1 . Use Chainweaver
53
- 1 . Download and install from
54
- https://github.com/kadena-io/chainweaver/releases
55
- 2 . Or, use the web version: https://chainweaver.kadena.network
56
- 2 . Launch Chainweaver and create your mnemonic key
53
+ 1. Use Chainweaver
54
+ 1. Download and install from
55
+ https://github.com/kadena-io/chainweaver/releases
56
+ 2. Or, use the web version: https://chainweaver.kadena.network
57
+ 2. Launch Chainweaver and create your mnemonic key
57
58
58
59
# # Add devnet to Chainweaver
59
60
60
- 1 . Click "Settings" tab in the bottom left
61
- 2 . Select "Network"
62
- 3 . Fill in the network name: "Devnet"
63
- 4 . Open the network you created "> Devnet"
64
- 5 . Add a node: "127.0.0.1:8080", the red dot on the right, should become green
65
- now.
61
+ 1. Click " Settings" tab in the bottom left
62
+ 2. Select " Network"
63
+ 3. Fill in the network name: " Devnet"
64
+ 4. Open the network you created " > Devnet"
65
+ 5. Add a node: " 127.0.0.1:8080" , the red dot on the right, should become green
66
+ now.
66
67
67
68
# # Create keys to sign transactions
68
69
69
- 1 . Go to "Keys" on the left and click "+ Generate" on the top-right. This is
70
- your first key-pair.
71
- 2 . To show the balance of this account, click "Add k: Account".
72
- 3 . Go back to the "Accounts" tab on the left. Notice that the "Balance (KDA)"
73
- says "Does not exist".
70
+ 1. Go to " Keys" on the left and click " + Generate" on the top-right. This is
71
+ your first key-pair.
72
+ 2. To show the balance of this account, click " Add k: Account" .
73
+ 3. Go back to the " Accounts" tab on the left. Notice that the " Balance (KDA)"
74
+ says " Does not exist" .
74
75
75
76
In Kadena, keys and accounts do not represent the same thing. An account needs
76
77
to be created before it can be used.
@@ -82,8 +83,8 @@ to be created before it can be used.
82
83
> [install with ` n` ](https://github.com/tj/n#readme)) and run ` npm install` in
83
84
> the root of this project
84
85
>
85
- > 1 . install nodejs
86
- > 2 . run ` npm install `
86
+ > 1. install nodejs
87
+ > 2. run ` npm install`
87
88
88
89
Before we can create an account, you need to have KDA to pay for the gas-fees
89
90
(transaction fee).
@@ -95,16 +96,28 @@ In this process, we’ll submit a transaction that creates an account based on t
95
96
" keys" and " predicate" that you supply. The combination of ` keys` + ` predicate`
96
97
makes a ` keyset` , which is used to ` guard` your account.
97
98
98
- 1 . Send money from "sender00" to your account. Copy your account name from the
99
- "Accounts" tab and fill it in the command
99
+ 0. Clone the repository. It has scripts to make your life easier
100
+
101
+ ` ` ` shell
102
+ git clone https://github.com/kadena-community/getting-started.git
103
+ # or
104
+ git clone [email protected] :kadena-community/getting-started.git
105
+ # and install dependencies (you need to have nodejs preinstalled)
106
+ cd getting-started
107
+ npm install
108
+ ` ` `
109
+
110
+ 1. Send money from " sender00" to your account. Copy your account name from the
111
+ " Accounts" tab and fill it in the command
112
+
113
+ ` ` ` shell
114
+ npm run start -- fund --keys " <your-key>" --predicate " keys-all"
115
+ ` ` `
100
116
101
- ``` shell
102
- npm run start -- fund --keys " <your-key>" --predicate " keys-all"
103
- ```
117
+ 2. Open the Block Explorer http://localhost:8080/explorer/ to monitor the
118
+ transaction
104
119
105
- 2 . Open the Block Explorer http://localhost:8080/explorer/ to monitor the
106
- transaction
107
- 3 . In Chainweaver, click "Refresh" to update the account balances
120
+ 3. In Chainweaver, click " Refresh" to update the account balances
108
121
109
122
# # Deploy a contract
110
123
@@ -126,21 +139,21 @@ run the following command. Make sure to have Chainweaver open, as it's required
126
139
to sign with your private key.
127
140
128
141
** Important** : the web version of Chainweaver does not have an automated signing
129
- flow. Use the ** Chainweaver Web** command. ** _ Follow the instructions in the
130
- terminal _ ** .
142
+ flow. Use the ** Chainweaver Web** command. *** Follow the instructions in the
143
+ terminal * ** .
131
144
132
145
Once you run the command you' ll see a modal open in Chainweaver. This modal
133
146
shows a few things:
134
147
135
- 1 . Transaction metadata like who pays for the transaction, etc.
136
- 2 . The "code" that's executed when the transaction
137
- 3 . The "data" that's available for the functions that are executed (in this case
138
- nothing)
139
- 4 . The "signers" needed to sign for the transaction
140
- In this example we have an "unscoped signer" as for deploying a smart
141
- contract, there are no "capabilities" that scope what your signature can be
142
- used for (read more about this in our
143
- [ Step-By-Step Guide to Writing Smart Contracts] ( https://docs.kadena.io/build/guides#capabilitiesh-1323277354 ) )
148
+ 1. Transaction metadata like who pays for the transaction, etc.
149
+ 2. The "code" that' s executed when the transaction
150
+ 3. The " data" that' s available for the functions that are executed (in this case
151
+ nothing)
152
+ 4. The "signers" needed to sign for the transaction\
153
+ In this example we have an "unscoped signer" as for deploying a smart
154
+ contract, there are no "capabilities" that scope what your signature can be
155
+ used for (read more about this in our
156
+ [Step-By-Step Guide to Writing Smart Contracts](https://docs.kadena.io/build/guides/a-step-by-step-guide-to-writing-pact-smart-contract#capabilities ))
144
157
145
158
```shell
146
159
npm run start -- deploy --keys "<your-key>" --predicate "keys-all"
@@ -160,11 +173,11 @@ Now you can interact with the smart contract
160
173
161
174
## Interacting with a smart contract
162
175
163
- 1 . Open Chainweaver
164
- 2 . Navigate to the "Contracts" on the left
165
- 3 . Open the "Module Explorer"-tab on the right
166
- 4 . Search in "Deployed Contracts" for the ` hello-world ` contract
167
- 5 . Click the "View" button to show details of the smart contract
176
+ 1. Open Chainweaver
177
+ 2. Navigate to the "Contracts" on the left
178
+ 3. Open the "Module Explorer"-tab on the right
179
+ 4. Search in "Deployed Contracts" for the `hello-world` contract
180
+ 5. Click the "View" button to show details of the smart contract
168
181
169
182
If everything went correctly, you should be able to see the smart contract and
170
183
its details.
@@ -183,12 +196,12 @@ deployed. Write it in the left side of your Chainweaver inside "Contracts" page.
183
196
(free.hello-world.say-hello " Albert" )
184
197
` ` `
185
198
186
- 1 . Click the "deploy" button on the top right.
187
- 2 . Click next twice
188
- 3 . You'll get an error "A 'Gas Payer' has not been selected for this
189
- transaction. Are you sure this is correct?", but you can ignore that since
190
- you're executing a read-only command.
191
- 4 . Scroll to the bottom. Here you'll see the "Raw Response"
199
+ 1. Click the " deploy" button on the top right.
200
+ 2. Click next twice
201
+ 3. You' ll get an error "A ' Gas Payer' has not been selected for this
202
+ transaction. Are you sure this is correct?", but you can ignore that since
203
+ you' re executing a read-only command.
204
+ 4. Scroll to the bottom. Here you' ll see the "Raw Response"
192
205
193
206
> "Hello, Albert!"
194
207
@@ -222,7 +235,7 @@ npm run start -- deploy \
222
235
You' ll walk through the same process as before in Chainweaver.
223
236
224
237
> Yes you read that correctly. **You can redeploy and update a smart
225
- > contract!**
238
+ > contract!**\
226
239
> This is one of the many cool features of Pact and Kadena, however, you cannot
227
240
> change the schema (yet)
228
241
@@ -250,19 +263,28 @@ We also created a function that allows you to write to the schema:
250
263
251
264
### Executing a write function
252
265
253
- 1 . Go to the "contracts" page in Chainweaver
254
- 2 . Write the following snippet
255
- ``` lisp
256
- (free.hello-world.write-hello "Albert")
257
- ```
258
- 3 . Click "Deploy"
259
- 4 . Select Chain ID "0"
260
- 5 . In "Transaction Sender" select "Account" that corresponds with the account
261
- that you funded. It should be ` k:<public-key> `
262
- 6 . Other settings should be correctly filled in as default
263
- 7 . Click "next"
264
- 8 . In "Unrestricted Signing Keys" select the ` public-key ` of your account
265
- 9 . Click "next"
266
+ 1. Go to the "contracts" page in Chainweaver
267
+
268
+ 2. Write the following snippet
269
+ ```lisp
270
+ (free.hello-world.write-hello "Albert")
271
+ ```
272
+
273
+ 3. Click "Deploy"
274
+
275
+ 4. Select Chain ID "0"
276
+
277
+ 5. In "Transaction Sender" select "Account" that corresponds with the account
278
+ that you funded. It should be `k:<public-key>`
279
+
280
+ 6. Other settings should be correctly filled in as default
281
+
282
+ 7. Click "next"
283
+
284
+ 8. In "Unrestricted Signing Keys" select the `public-key` of your account
285
+
286
+ 9. Click "next"
287
+
266
288
10. You' ll see a Notice:
267
289
268
290
> A ' Gas Payer' has not been selected for this transaction. Are you sure
@@ -281,26 +303,24 @@ Execute the following function, and deploy to read the keys from the table.
281
303
> ** Note:** this function costs a lot as this is not something you' d usually do
282
304
> in a regular transaction.
283
305
284
- 1 . Paste the snippet in the editor
285
- ``` lisp
286
- (map (read free.hello-world.hello-world-table) (keys free.hello-world.hello-world-table))
287
- ```
288
- 2 . Click "deploy"
289
- 3 . Change the Chain ID to 0 (as we only deployed the contract on Chain 0)
290
- 4 . Change the gas limit to ` 99999 `
291
- 5 . Click next to the end
292
- 6 . In "Raw Response" you should be able to see
293
- ```
294
- [{"text": "Hello, Albert!"}]
295
- ```
306
+ 1. Paste the snippet in the editor
307
+ ```lisp
308
+ (map (read free.hello-world.hello-world-table) (keys free.hello-world.hello-world-table))
309
+ ```
310
+ 2. Click "deploy"
311
+ 3. Change the Chain ID to 0 (as we only deployed the contract on Chain 0)
312
+ 4. Change the gas limit to `99999`
313
+ 5. Click next to the end
314
+ 6. In "Raw Response" you should be able to see
315
+ [{"text": "Hello, Albert!"}]
296
316
297
317
## Further reading
298
318
299
319
Get started with the basics of Pact by reading the
300
320
[Welcome to Pact](https://docs.kadena.io/learn-pact/beginner/welcome-to-pact)
301
321
docs.
302
322
303
- [ Reference documentation of Pact] ( /pact/reference )
323
+ [Reference documentation of Pact](https://docs.kadena.io /pact/reference)
304
324
305
325
A very good and complete tutorial on learning pact, with real world scenario' s,
306
326
is the
0 commit comments