Emit Events

Each transaction processed by Pontem network can have events.

You can see events in UI when transaction processed or in block explorer: choose Network in the top header menu, and then click on Explorer in dropdown, find block contains events.

Also you can see events using CLI, when your transaction is processed.

To emit new event use Event module. Let's write new script firing event:

script {
use 0x01::Event;
fun emit(account: &signer, value: u128) {
Event::emit(account, value);

Also you can emit events with complex types, even with resources or structs:

module MyEmitter {
use 0x01::Event;
struct Foo { x: u64, y: bool }
public fun emit_event(account: &signer, x: u64, y: bool) {
let foo = Foo { x , y };
Event::emit(account, foo);

Write script for new module:

script {
use {{sender}}::MyEmitter;
fun emit(account: &signer, x: u64, y: bool) {
MyEmitter::emit_event(account, x, y);

Build module and script:

dove build
dove ct 'emit(1000, true)'

After deploy module and execute new script (replace <seed> with your seed):

pontem-cli tx.mvm.publishModule @./target/modules/0_MyEmitter.mv 100000 --seed <seed>
pontem-cli tx.mvm.execute @./target/transactions/emit.mvt 1000000 --seed <seed>

Example event output:

"method": "Event",
"section": "mvm",
"index": "0x0800",
"data": [
"address": "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty",
"name": "MyEmitter"

See data array and parameters by indexes:

  • 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty - account emitted event.

  • 0x078eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48244d79456d69747465720c466f6f00 - is TypeTag value, describes Foo structure.

  • 0xe80300000000000001 - event data, it's indeed our u64 1000 and boolean true value encoded in LCS.

The data placed in the events encoded in (Libra Canonical Serialization). There is a community description of how it works.

You can use several libraries to parse events results: