Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1313 - Contract-level events #1339

Merged
merged 96 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
fd89a60
bugfixing search bar
guidoviani Aug 28, 2023
a6d1b04
quick fix search svg
guidoviani Aug 28, 2023
94faa1a
fix navbar
guidoviani Aug 29, 2023
a6bef00
Merge branch 'casper-network:dev' into dev
msalmeron Aug 29, 2023
0c845f6
add tabindex in theme switch
guidoviani Aug 29, 2023
c684596
Merge branch 'dev' of https://github.com/MiracleDevs/casper-docs into…
guidoviani Aug 29, 2023
fcd9bdf
delete desktop class
guidoviani Aug 29, 2023
0fb6d4b
add desktop class
guidoviani Aug 29, 2023
22a8086
Loading fix when search value changes.
lucasarceMD Aug 29, 2023
ab4641c
Merge branch 'dev' of https://github.com/MiracleDevs/casper-docs into…
lucasarceMD Aug 29, 2023
a3a762c
Clarifying
ACStone-MTS Oct 24, 2023
70129a0
Update serialization-standard.md
ACStone-MTS Oct 24, 2023
48c527f
Update serialization-standard.md
ACStone-MTS Oct 24, 2023
6b61b2c
remove bond from moving-node
Jiuhong-casperlabs Oct 25, 2023
a8939d9
Merge pull request #1312 from Jiuhong-casperlabs/update-moving-node.md
Jiuhong-casperlabs Oct 26, 2023
43a538c
Apply suggestions from code review
ACStone-MTS Oct 26, 2023
f0ab0f3
Update serialization-standard.md
ACStone-MTS Oct 26, 2023
754dc7b
Merge pull request #1311 from ACStoneCL/1307_URef_Access_Rights
ACStone-MTS Oct 26, 2023
f40bbc7
Adding Token Standard Docs
ACStone-MTS Oct 27, 2023
1482e7f
JS Tutorial addition
ACStone-MTS Oct 27, 2023
25b5324
Slug add
ACStone-MTS Oct 27, 2023
27df0c8
Link Test
ACStone-MTS Oct 27, 2023
df55a40
Link Fixes
ACStone-MTS Oct 27, 2023
669a10b
Last link fix
ACStone-MTS Oct 27, 2023
491d3d0
Incorporating Feedback
ACStone-MTS Oct 27, 2023
5589b39
Merge pull request #1316 from ACStoneCL/1315_Casper_Token_Standards
ACStone-MTS Oct 27, 2023
9396692
URef AccessRights Clarification Tutorial
ACStone-MTS Nov 1, 2023
3ad8102
Link Fix
ACStone-MTS Nov 1, 2023
c13dd46
Merge pull request #1319 from ACStoneCL/1310_URef_Tutorial
ACStone-MTS Nov 6, 2023
87f6233
Updating CEP-18 docs.
ACStone-MTS Nov 6, 2023
b5c0fea
Merge pull request #1326 from ACStoneCL/CEP18_Update
ACStone-MTS Nov 6, 2023
7adb20b
Redelegation Clarification
ACStone-MTS Nov 9, 2023
24444b6
Update redelegate.md
ACStone-MTS Nov 9, 2023
7f7a1f0
Update source/docs/casper/developers/cli/redelegate.md
ACStone-MTS Nov 9, 2023
a069f2c
Merge pull request #1327 from ACStoneCL/Redelegate_Hotfix
ACStone-MTS Nov 9, 2023
fc0b1d0
OpCode Documentation
ACStone-MTS Nov 9, 2023
d410d3d
Update source/docs/casper/developers/cli/opcode-costs.md
ACStone-MTS Nov 13, 2023
60b4347
Adding information about enabling contracts.
ACStone-MTS Nov 16, 2023
af04ae6
Update links
ipopescu Nov 18, 2023
0731ab5
Merge pull request #1332 from casper-network/1331_updated_links
ipopescu Nov 20, 2023
740271d
Readme refactoring
ipopescu Nov 20, 2023
5a983e2
Updated technology stack
ipopescu Nov 20, 2023
12f0df4
add query data
guidoviani Nov 24, 2023
4031a69
Changes in navbar
guidoviani Nov 24, 2023
5a722cc
Changes in footer
guidoviani Nov 24, 2023
621c3ef
fix dropdown sidebar
guidoviani Nov 24, 2023
40d70c6
fix styles to dropdowns
guidoviani Nov 24, 2023
f63446f
Merge pull request #1328 from ACStoneCL/Updating_OpCode_Costs
ACStone-MTS Nov 27, 2023
81e97db
Merge pull request #1330 from ACStoneCL/1325_Enable_Contracts
ACStone-MTS Nov 27, 2023
4a96d66
Merge pull request #1334 from ipopescu/1284_update_readme
ipopescu Nov 27, 2023
78a9671
quick fix min-width navbar
guidoviani Nov 28, 2023
dc063a4
NavTree plugin data cleanup
lucasarceMD Nov 28, 2023
d20adf1
delete log
guidoviani Nov 28, 2023
4e2081e
Merge remote-tracking branch 'upstream/dev' into dev
msalmeron Nov 29, 2023
8c253a4
Merge pull request #1337 from MiracleDevs/dev
bradjohnl Nov 30, 2023
589b840
NavItems query removed.
lucasarceMD Nov 30, 2023
61a35cb
Merge pull request #1338 from MiracleDevs/dev
bradjohnl Nov 30, 2023
10d360a
Initial content
ipopescu Dec 1, 2023
ca86cd2
Add content and examples
ipopescu Dec 1, 2023
1fd4bb4
Update the chai-spec.md file
ipopescu Dec 1, 2023
3a7ddd2
Add space and cross links
ipopescu Dec 2, 2023
b74b35a
Add more sample queries
ipopescu Dec 2, 2023
3af7d9b
Final content and image
ipopescu Dec 6, 2023
5d7704e
Updated explanation re. keys
ipopescu Dec 6, 2023
6e5d722
Use blake2b instead of BLAKE2b
ipopescu Dec 7, 2023
a3b4608
Add missing period
ipopescu Dec 7, 2023
4d75c59
Merge branch 'casper-network:dev' into 1313_contract_events
ipopescu Dec 16, 2023
2b181ff
Add info on Rust crates and documentation
ipopescu Dec 16, 2023
81d370a
Use actions/upload-artifact@v4
ipopescu Dec 19, 2023
afdf742
Merge pull request #1343 from ipopescu/1238_rust_links
ipopescu Dec 19, 2023
6cb82ed
Merge branch 'casper-network:dev' into 1313_contract_events
ipopescu Dec 19, 2023
32b59e4
Content was added back; remove the TODO
ipopescu Dec 19, 2023
3d2e417
Remove duplicate links in left nav
ipopescu Dec 19, 2023
0766643
Merge branch 'dev' into 1344_navigation
ipopescu Dec 19, 2023
a8a50fb
Merge pull request #1345 from ipopescu/1344_navigation
ipopescu Dec 19, 2023
92c0d52
Remove 2 additional duplicate links
ipopescu Dec 19, 2023
fcc3ca9
Add index pages to improve navigation
ipopescu Dec 19, 2023
6076ad9
Merge pull request #1346 from ipopescu/1344_navigation
ipopescu Dec 20, 2023
89560d1
Remove empty pages
ipopescu Dec 22, 2023
52a6c27
Remove Signer-related pages
ipopescu Dec 22, 2023
cc82fdf
Remove comment linking to a removed page
ipopescu Dec 22, 2023
d131466
Remove another empty page
ipopescu Dec 22, 2023
81bec0d
Use more descriptive titles
ipopescu Dec 22, 2023
073689b
Merge pull request #1347 from ipopescu/1092_empty_pages
ipopescu Dec 22, 2023
d02cb7c
Merge pull request #1348 from ipopescu/1093_HTML_titles
ipopescu Dec 22, 2023
7b7dceb
Highlight ways to contribute to the docs
ipopescu Dec 22, 2023
2ed03d3
Merge pull request #1349 from ipopescu/927_contribute
ipopescu Dec 27, 2023
0a90e31
TTL Update
ACStone-MTS Jan 2, 2024
7510e12
Merge pull request #1352 from ACStoneCL/TTL_Update
ACStone-MTS Jan 2, 2024
456c272
Fix broken link for package required for compatibility with Ubuntu 22.04
jdpinedac Jan 4, 2024
d16842c
Merge pull request #1 from Pyxis-Portal/fix-broken-pkg-url
jdpinedac Jan 4, 2024
b9aee51
Improved Explanation Wording
jdpinedac Jan 4, 2024
9507c8b
Merge pull request #1353 from Pyxis-Portal/dev
ipopescu Jan 9, 2024
e291f25
Merge branch 'casper-network:dev' into 1313_contract_events
ipopescu Jan 12, 2024
26326f3
Clarify pruning with an example
ipopescu Jan 12, 2024
394fb7c
Merge branch '1313_contract_events' of https://github.com/ipopescu/do…
ipopescu Jan 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/sidebar.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ module.exports = {
"developers/writing-onchain-code/contract-vs-session",
"developers/writing-onchain-code/writing-session-code",
"developers/writing-onchain-code/testing-session-code",
"developers/writing-onchain-code/emitting-contract-events",
"developers/writing-onchain-code/contract-hash-vs-package-hash",
"developers/writing-onchain-code/best-practices",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

# Monitoring and Consuming Events

<!-- TODO This entire file needs to be updated for 2.0 and for integrating with the Sidecar. For example, the events have been renamed from DeployAccepted to TransactionAccepted. The stream URLs might have also changed. The contract-level events are posted as part of the TransactionAccepted (=DeployAccepted) events.-->

The Casper platform uses event streaming to signal state changes in smart contracts and nodes. Using Casper's client-side SDKs, dApps actively listening for emitted events can consume these events and perform actions based on event data.

Each Casper node streams events through the SSE (Server Sent Event) server via the port specified as the `event_stream_server.address` in the node's *config.toml*. This port is by default `9999` for nodes on [Testnet](https://testnet.cspr.live/tools/peers) and [Mainnet](https://cspr.live/tools/peers).
Expand All @@ -12,9 +14,11 @@ Events are divided into three categories and streamed on their respective endpoi
- **Finality Signature events** - Emitted when a block has been finalized and cannot be altered. The URL to consume finality signature events on Mainnet and Testnet is `http://<HOST>:9999/events/sigs/`.
- **Main events** - All other events fall under this type, including: `BlockAdded`, `DeployProcessed`, `DeployExpired`, `Fault`, `Step`, and `Shutdown` events. The URL to consume these events on Mainnet and Testnet is `http://<HOST>:9999/events/main/`.

An `ApiVersion` event is always emitted when a new client connects to a node's SSE server, informing the client of the node's software version.

:::note

An `ApiVersion` event is always emitted when a new client connects to a node's SSE server, informing the client of the node's software version.
Smart contracts can emit contract-level events as explained [here](../writing-onchain-code/emitting-contract-events.md). DApps can consume these events by listening to the event stream, detecting [TransactionProcessed](#deployprocessed) events, and parsing the `messages` array storing String-representations of the emitted events.

:::

Expand Down Expand Up @@ -392,6 +396,10 @@ The `Shutdown` event is emitted when the node is about to shut down, usually for
</details>


## Detecting Contract-Level Events

The SSE endpoint of a node streams messages emitted by a contract in a human-readable format. These messages are visible as part of the `TransactionProcessed` event after the corresponding block is processed and added to the blockchain. For more details, see [Verifying a Topic](../writing-onchain-code/emitting-contract-events.md#verifying-a-topic) and [Verifying a Message](../writing-onchain-code/emitting-contract-events.md#verifying-a-message).

## Reacting to Events

An application may parse each event needed for its use case and respond accordingly. The dApp may act on some events and not others, or it may act upon them all, depending on its use case. Each event type contains additional data that might help in deciding whether or not to take an action. For example, `DeployAccepted` events contain the account's public key that submitted the deploy, the contract address, and more. This information can help determine how to proceed or whether or not to react.
Expand Down
Loading