Skip to content

Commit 7f72b14

Browse files
Nonnyjoeriseandshaheen
authored andcommitted
Mod(tutorials): Modified counter and marketplace tutorial to work with v1.5
1 parent a5f1bc2 commit 7f72b14

5 files changed

Lines changed: 336 additions & 277 deletions

File tree

cartesi-rollups_versioned_docs/version-1.5/tutorials/counter.md

Lines changed: 44 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,11 @@ cartesi build
112112
- Expected Logs:
113113

114114
```shell
115-
user@user-MacBook-Pro counter % cartesi build
116-
(node:4460) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
117-
(Use `node --trace-warnings ...` to show where the warning was created)
118-
✔ Build drives
119-
✔ Build drive root
115+
View build details: docker-desktop://dashboard/build/multiarch/multiarch0/vzzzuxvcznba66icpyk3wyde9
116+
117+
What's next:
118+
View a summary of image vulnerabilities and recommendations → docker scout quickview
119+
copying from tar archive /tmp/input
120120
121121
.
122122
/ \
@@ -132,14 +132,13 @@ user@user-MacBook-Pro counter % cartesi build
132132
[INFO rollup_http_server::http_service] starting http dispatcher http service!
133133
[INFO actix_server::builder] starting 1 workers
134134
[INFO actix_server::server] Actix runtime found; starting in Actix runtime
135-
[INFO actix_server::server] starting service: "actix-web-service-127.0.0.1:5004", workers: 1, listening on: 127.0.0.1:5004
136135
[INFO rollup_http_server::dapp_process] starting dapp: python3 dapp.py
137136
INFO:__main__:HTTP rollup_server url is http://127.0.0.1:5004
138137
INFO:__main__:Sending finish
139138

140-
Manual yield rx-accepted (1) (0x000020 data)
141-
Cycles: 8108719633
142-
8108719633: 107174e04a294787e22b6864c61fedd845833e5c8bc9a244480f2996ddabb3c7
139+
Manual yield rx-accepted (0x100000000 data)
140+
Cycles: 3272156820
141+
3272156820: 3903552ee499ef4a10b2c8ffba6b8d49088a0a8b9137b8d10be359910080432a
143142
Storing machine: please wait
144143
```
145144

@@ -154,22 +153,15 @@ cartesi run
154153
If the `run` command is successful, you should see logs similar to this:
155154

156155
```bash
157-
user@user-MacBook-Pro counter % cartesi run
158-
(node:5404) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
159-
(Use `node --trace-warnings ...` to show where the warning was created)
160-
WARNING: default block is set to 'latest', production configuration will likely use 'finalized'
161-
[+] Pulling 4/0
162-
✔ database Skipped - Image is already present locally
163-
✔ rollups-node Skipped - Image is already present locally
164-
✔ anvil Skipped - Image is already present locally
165-
✔ proxy Skipped - Image is already present locally
166-
✔ counter starting at http://127.0.0.1:6751
167-
✔ anvil service ready at http://127.0.0.1:6751/anvil
168-
✔ rpc service ready at http://127.0.0.1:6751/rpc
169-
✔ inspect service ready at http://127.0.0.1:6751/inspect/counter
170-
✔ counter machine hash is 0x107174e04a294787e22b6864c61fedd845833e5c8bc9a244480f2996ddabb3c7
171-
✔ counter contract deployed at 0x94b32605a405d690934eb4ecc91856febfa747cc
172-
(l) View logs (b) Build and redeploy (q) Quit
156+
Attaching to prompt-1, validator-1
157+
validator-1 | 2025-11-24 17-06-12 info remote-cartesi-machine pid:108 ppid:67 Initializing server on localhost:0
158+
prompt-1 | Anvil running at http://localhost:8545
159+
prompt-1 | GraphQL running at http://localhost:8080/graphql
160+
prompt-1 | Inspect running at http://localhost:8080/inspect/
161+
prompt-1 | Explorer running at http://localhost:8080/explorer/
162+
prompt-1 | Bundler running at http://localhost:8080/bundler/rpc
163+
prompt-1 | Paymaster running at http://localhost:8080/paymaster/
164+
prompt-1 | Press Ctrl+C to stop the node
173165
```
174166

175167
## Interacting with your Counter Application
@@ -181,59 +173,56 @@ Interacting with your Counter application could be achieved either through initi
181173
We start by querying the current count value, this is done by making an inspect request to the counter application running locally, to achieve this we run the below command in a new terminal:
182174

183175
```bash
184-
curl -X POST http://127.0.0.1:6751/inspect/counter \
185-
-H "Content-Type: application/json" \
186-
-d '{""}'
176+
curl http://localhost:8080/inspect/counter
187177
```
188178

189-
:::note Inspect endpoint
190-
Please note that if your application is running on a different port or your application is not named `counter` as in the guide, then you'll need to replace the inspect endpoint `http://127.0.0.1:6751/inspect/counter` with the endpoint provided after running the `cartesi run` command.
191-
:::
192-
193-
On success, we receive a confirmation response from the HTTP server, something similar to `{"status":"Accepted","reports":null,"processed_input_count":0}`, then on the terminal running our application when we press the `l` key to access our application logs we should get a log confirming that our application received the inspect call and should also contain a log of the current count value.
179+
On success, we receive a confirmation response from the HTTP server, something similar to `{"status":"Accepted","exception_payload":null,"reports":[],"processed_input_count":0}`, then on the terminal running our application we should get a log confirming that our application received the inspect call and should also contain a log of the current count value.
194180

195181
```bash
196-
[INFO rollup_http_server::http_service] received new request of type INSPECT
197-
inspect_request.payload_length: 4
198-
[INFO actix_web::middleware::logger] 127.0.0.1 "POST /finish HTTP/1.1" 200 64 "-" "python-requests/2.31.0" 0.020096
199-
INFO:__main__:Received finish status 200
200-
INFO:__main__:Received inspect request data {'payload': '0x7b22227d'}
201-
INFO:__main__:Current counter value: 0
202-
INFO:__main__:Sending finish
203-
2025-11-09T17:47:44.661 INF Request executed service=inspect status=Accepted application=counter
182+
validator-1 | [INFO rollup_http_server::http_service] Received new request of type INSPECT
183+
validator-1 | [INFO actix_web::middleware::logger] 127.0.0.1 "POST /finish HTTP/1.1" 200 70 "-" "python-requests/2.31.0" 0.001536
184+
validator-1 | INFO:__main__:Received finish status 200
185+
validator-1 | INFO:__main__:Received inspect request data {'payload': '0x636f756e746572'}
186+
validator-1 | INFO:__main__:Current counter value: 0
187+
validator-1 | INFO:__main__:Sending finish
204188
```
205189

206-
As seen in the third to last line of our received log, we can see the `count value` returned to be `0`
190+
As seen in the second to last line of our received log, we can see the `counter value` returned to be `0`
207191

208192
### 2. Increase count value
209193

210194
Now that we've confirmed our count value to be zero (0), we would be sending an advance request using the CLI to increase the value of our counter by running the below command:
211195

212196
```bash
213-
cartesi send random_text
197+
cartesi send generic
214198
```
215199

216-
The above command sends an advance request with the payload "random_text" to our application, which ignores this payload then proceeds to increase out count value by `one (1)`, if this command is successful and our application process this request graciously, we should get a log similar to what's presented below on the terminal running our application:
200+
We then proceed by selecting Foundry and pressing Enter twice to accept the default RPC URL. Next, we choose Mnemonic as the authentication method and again press Enter twice to use the default mnemonic and wallet address. After that, we press Enter once more to confirm the application address.
201+
202+
Once the basics are set, we navigate to and select String encoding as the input format. Finally, we type any random string (e.g., increase), press Enter, and the CLI sends the request to the application.
203+
204+
The above process sends an advance request with the payload "increase" to our application, which ignores this payload then proceeds to increase out count value by `one (1)`, if this command is successful and our application process this request graciously, we should get a log similar to what's presented below on the terminal running our application:
217205

218206
```bash
219-
INFO:__main__:Received advance request data {'metadata': {'chain_id': 13370, 'app_contract': '0x9d40cfc42bb386b531c5d4eb3ade360f4105c4a3', 'msg_sender': '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', 'block_number': 630, 'block_timestamp': 1762711409, 'prev_randao': '0x63a2bb3993d9f9c371624f995a10a6f493e33c2535e62b32fee565f812b4c4ab', 'input_index': 0}, 'payload': '0x72616e646f6d5f74657874'}
220-
INFO:__main__:Counter increment requested, new count value: 1
221-
INFO:__main__:Sending finish
207+
validator-1 | [INFO rollup_http_server::http_service] Received new request of type ADVANCE
208+
validator-1 | [INFO actix_web::middleware::logger] 127.0.0.1 "POST /finish HTTP/1.1" 200 210 "-" "python-requests/2.31.0" 0.001664
209+
validator-1 | INFO:__main__:Received finish status 200
210+
validator-1 | INFO:__main__:Received advance request data {'metadata': {'msg_sender': '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', 'epoch_index': 0, 'input_index': 0, 'block_number': 2408, 'timestamp': 1764015746}, 'payload': '0x6f6b6179'}
211+
validator-1 | INFO:__main__:Counter increment requested, new count value: 1
212+
validator-1 | INFO:__main__:Sending finish
222213
```
223214

224215
The above logs prove that out application received the advance request, increased our count value, logs the updated count value then finishes that request successfully.
225216

226217
As seen in the second to last line of the log, our count value has been increased from 0 to 1. To confirm this increase, we can run an inspect request once more to verify the current count value, and on running the same inspect command as last time, we obtain the updated logs below.
227218

228219
```shell
229-
[INFO rollup_http_server::http_service] received new request of type INSPECT
230-
inspect_request.payload_length: 4
231-
[INFO actix_web::middleware::logger] 127.0.0.1 "POST /finish HTTP/1.1" 200 64 "-" "python-requests/2.31.0" 0.002048
232-
INFO:__main__:Received finish status 200
233-
INFO:__main__:Received inspect request data {'payload': '0x7b22227d'}
234-
INFO:__main__:Current counter value: 1
235-
INFO:__main__:Sending finish
236-
2025-11-09T18:22:45.142 INF Request executed service=inspect status=Accepted application=counter
220+
validator-1 | [INFO rollup_http_server::http_service] Received new request of type INSPECT
221+
validator-1 | [INFO actix_web::middleware::logger] 127.0.0.1 "POST /finish HTTP/1.1" 200 70 "-" "python-requests/2.31.0" 0.001280
222+
validator-1 | INFO:__main__:Received finish status 200
223+
validator-1 | INFO:__main__:Received inspect request data {'payload': '0x636f756e746572'}
224+
validator-1 | INFO:__main__:Current counter value: 1
225+
validator-1 | INFO:__main__:Sending finish
237226
```
238227

239228
From the latest application logs, it's now clear that the application's count value has been increased from 0 to one, and subsequent advance calls would further increase the count value.

0 commit comments

Comments
 (0)