Questions tagged [events]

Questions that relate to pallets and disptachables that emit specific events, including decoding events.

Filter by
Sorted by
Tagged with
5 votes
2 answers
120 views

Large event payloads unsafe?

Premise Substrate will, by default, store every event in a block in a storage value Event of type Vec<EventRecord> in the system module, which involves reading & writing this full vector ...
0 votes
1 answer
56 views

GSRPC: Check transaction failed?

Context: We are using GSRPC for interacting with a Polkadot Node. We are sending transactions using SubmitAndWatchExtrinsic. Question: How can I detect if the transaction failed? Note: I am aware ...
2 votes
1 answer
137 views

Emit Events from hooks like on_initialize()

Is it okay to emit event from hooks like on_initialize()? For example, I have ~1000 items in storage and in a loop in on_initialize() I want to emit an event if certain process is completed, then is ...
1 vote
1 answer
52 views

List all balance changes of an account on a Substrate-based chain

My goal is to list all balance changes for an account on a Substrate-based chain like Acala. I assumed that on Substrate-based chains all incoming and outgoing values to and from an account would be ...
1 vote
1 answer
68 views

Querying events from storage migration

I'm currently attempting to perform a migration process that involves querying events emitted from a specific pallet. The objective of this migration is to extract relevant data from these events and ...
2 votes
1 answer
40 views

How use Metadata deocde Vec::<EventRecord<Event, H256>>

first get the system eventData state_getStorage api now i need to decode the system eventData by metadata is there some example how to decode it ? for some reaseon ,only rust worker it ,thanks
1 vote
0 answers
17 views

How to Securely Notify Users of New Messages in a Substrate-based Chat Application?

I'm developing a chat application using Substrate and facing a specific issue regarding user notifications. My application needs to notify users when they have a new message in a chat channel. ...
3 votes
1 answer
80 views

How to filter the subscribed contracts events with their topics?

I need to subscribe to my smart-contract events (#[ink(event)]). So I state_subscribeStorage to "System.Events" storage key. But then I get all system events of all smart contracts in my ...
1 vote
2 answers
445 views

How to query events?

I need to get a list of all events of a specific custom type. In the documentation, it said that I can query the System pallet's storage for events. I am looking for an example (in Rust) of how to ...
1 vote
0 answers
64 views

From the parachain, how to read the relay chain events of a current block?

From this comment and this question, There's a function for runtime-benchmarks to get all the events(). And I want something similar that can be accessed from the parachain. Just events from the relay ...
0 votes
1 answer
52 views

How to trace XCM messages for all parachains

Is it possible to trace XCM messages (origin para and account id, destination para and account id, instruction and parameters) just utilizing the relay chain storage? If not, what is the simplest way ...
3 votes
1 answer
132 views

Problem running assert_last_event in tests.rs

As the title suggests, I've been trying to call assert_last_event on the tests.rs class without success. The problem first happened when developing the kitties tutorial and after several toolchain ...
7 votes
2 answers
106 views

How to verify upward teleport on Relay Chain?

I performed an upward teleport from Encointer-Parachain to Kusama- Relay Chain. The parachain confirmed the XCM extrinsic polkadotXcm.limitedTeleportAssets and an Event was disposed: polkadotXcm....
3 votes
1 answer
93 views

How to emit events from inner contracts

let's say we have a contract which calls other contract's function that emits an event. What is the approach to emit the event coming from the inner contract's message? Currently, there is only an ...
2 votes
2 answers
43 views

How to ensure a call is the first to execute in a block?

As the title mention, I would like to know what would be the best way to ensure that an extrinsic can be executed only if it's the first call in the block (ignoring timestamp). It also need to work ...
1 vote
1 answer
35 views

Pallet extrinsic event not triggering when called through chain extension

When I call the pallet extrinsic bond_and_stake, the Event BondAndStake gets triggered. But when I call it through the chain extension method from my ink smart contract message, the event does not ...
0 votes
1 answer
27 views

Do data in events increase the size of the block?

On one hand, if we emit extrinsic event with no data and other hand we emit the extrinsic event with data. Will the second option will increase the block size or on both cases the block-size will be ...
0 votes
0 answers
28 views

How to log events on frontend dapp from emit_event of smart contract?

I'm currently struggling on obtaining logs of the events emitted from my smart contract on the frontend dapp. The smart contract code itself should work just fine as it emits the event perfectly fine ...
1 vote
1 answer
53 views

How to get the contract address for a events

I am using github.com/centrifuge/go-substrate-rpc-client And able to get list of events from each block and also able to filter it out but is there a way to identify which contract triggered the event....
5 votes
1 answer
118 views

How to identify received contract event?

My contract emits several [ink(event)] events. My application subscribes to the events and receives Contracts_ContractEmitted data (from centrifuge go-substrate-rpc-client). How may I understand which ...
4 votes
2 answers
44 views

DispatchError::Other(_) always being mapped to DispatchError::Other("")

I'm trying to pass some custom error messages to the frame_system::note_applied_extrinsic() but it seems to be ignoring my message and always using an empty string "". Adding this test to ...
1 vote
1 answer
52 views

polkadot.js | SignAndSend SuccessResponse does NOT contain all events emitted in tx

SignAndSend SuccessResponse that is a result of a contract call does NOT contain all events that are emitted during tx execution. The Object contains only events emitted from the contract that is ...
3 votes
1 answer
50 views

nextAuthorities() output clarification from Babe storage event

Good evening, I am trying to parse the output hash of nextAuthorities details retrieved by storage function. I would like to know how to parse the output sent per validator, is it an hashproof ...
3 votes
1 answer
69 views

Should events be taken into account if their extrinsic fails?

If the System.ExtrinsicFailed event was emitted within a given extrinsic, does it mean that all other events that were also emitted within it can be considered invalid and should not be taken into ...
1 vote
1 answer
160 views

the trait `std::clone::Clone` is not implemented for `Nominations<T>`

I was making a new event in the function nominate of Staking pallet which is going to show when the nominator is going to be added. But i facing one issue #[pallet::call_index(5)] #[pallet::weight(...
2 votes
1 answer
153 views

Need Help Understanding ink! Contract Storage And Data Access

There are some aspects of ink! contract storage and data access that I cannot find the answers to in the documentation or by experimentation. Here are my questions... Is it true that there can be ...
1 vote
1 answer
46 views

Ink Contracts: What Data Structures/Situations Are Best Suited To Contract Storage vs Events?

Using events to write data to the chain is great for registering information to the chain, especially information that you want a permanent record of. So my question is: under what circumstances ...
0 votes
1 answer
19 views

Unexpected Events from parainherit(enter) extrinsic

Can anyone explain why this module call parainherent(enter) ended up emitting a BatchCompleted and a couple ItemCompleted events? I'm unable to find any similar cases in westend.
1 vote
1 answer
80 views

Event encoding in substrate pallet

Can two pallets have exactly same event name and event parameters. If yes then is there a way to distinguish the event came from which pallet in golang.
1 vote
1 answer
74 views

Subscribing events from Polkadot blockchain

I would like to ask you how to subscribe events from Polkadot blockchain? I am writing a rust application and I need this functionality there. Is the using Substrate the right direction to achieve ...
1 vote
1 answer
75 views

Is there a JSON-RPC method similar to `eth_getLogs`?

I was wondering if there is a JSON-RPC method similar to eth_getLogs. What I would like to accomplish is to query all the events that meet a certain criteria, and that happened after a certain block. ...
1 vote
1 answer
28 views

Why do are some events in a block missing an extrinsic_idx?

Using py-substrate-interface to parse block data, we noticed that some events return None for the extrinsic_idx parameter. Would someone please be so kind to explain why an event wouldn't have an ...
0 votes
0 answers
69 views

Indexing: big Events vs. storage lookup. Downsides of having big Events

Problem statement: While indexing it's impossible to extract information from the Extrinsic call when Extrinsic has optional parameters (default if none). Solutions: storage lookup (seems suboptimal ...
7 votes
2 answers
340 views

How to decode ink smart contract call and event data?

I want to decode the contract call data and event data saved in a block. How can I do that?
3 votes
1 answer
228 views

How to subscribe to contract events using RPC?

I'm looking to subscribe to events emitted from a contract. I am currently creating a storage key for System Events, subscribing to it and filtering the events to get the one emitted by the contract I ...
2 votes
2 answers
128 views

How to save decoded events using polkadot.js?

I am monitoring the events when calling a method from my contract and want to save the output of one of my custom events, to display it. The call of my method looks like this: contract.tx .method({ ...
1 vote
1 answer
300 views

How do I get the block hash of an event?

I am subscribing system events using the events api. After I got the specific event I am looking for, how should get the block hash of this event? Thanks api.query.system.events((events) => { ...
2 votes
2 answers
206 views

Why are events stored?

The documentation around emitting events states that events are written to storage, and then cleared next block. This has considerable costs You add extra db write/read overhead to practically every ...
4 votes
1 answer
434 views

Decoding events with Rust

If I make a request to get events in a particular block using web UI, I get a nice human-readable response: I've made an RPC call to get the same data { "id": 1, "jsonrpc":...
1 vote
0 answers
29 views

how to confirm a event type?

I query all events, and decode the event a known type, but maybe some write them cause error, how to parse the event pub fn decode_event(data: &str) -> Result<String> { let mut vec = ...
1 vote
2 answers
64 views

Parse block number from received system event

This seems very basic, but I'm unable to figure out at which block number an event was emitted. Specifically, I'm listening for Grandpa.NewAuthorities system event and just want to know at which block ...
1 vote
1 answer
15 views

Will the event pairs `NewMultisig` <> `Reserved` and `MultisigExecuted` <> `Unreserved` always be emitted during a multisig transaction?

I would like to correctly monitor the events that are related to multisig transactions and I was wondering if I should always expect the following event pairs : NewMultisig <> Reserved ...
2 votes
1 answer
58 views

How can a recoverable account get notified when someone is initiated a recovery for it?

One of the interesting features of (social) account recovery in Kusama is that "If some one tries to initiate recovery for your recoverable account, you can close the process and kind of punish ...
2 votes
1 answer
90 views

How can I access custom pallet Event data in a test?

I have an Event (ThingStored) that is deposited in a public function in my custom pallet. #[derive(Encode, Decode, PartialEq, Clone, RuntimeDebugNoBound, TypeInfo, MaxEncodedLen)] #[scale_info(...
3 votes
1 answer
165 views

Emiting events does not work with cross contract calling

When using cross contract calling on another contract which also emits events the events of the original contract do not work anymore. I get the following error. error[E0283]: type annotations needed ...
1 vote
1 answer
130 views

How to assert deposited event in pallet call?

In testing my pallet, I have some function that stores something and deposits an event. #[pallet::event] #[pallet::generate_deposit(pub(super) fn deposit_event)] pub enum Event<T: ...
2 votes
1 answer
38 views

How to recognise user behaviour data on substrate chains? (Events + Extrinsics)

Context: Specifically trying to measure user behaviour data on substrate chains. Questions: Is there any specific data that indicates whether a user triggered an extrinsic or an event? Do only ...
2 votes
1 answer
137 views

Filter events for specific account in Polkadot.js/api

I am trying to get list events by filter for specific account(validator, nominator). I can get list of events using api.query.system.events(). However, if I get events for a day, there will be much ...
3 votes
1 answer
242 views

Browse events in Polkadot.js/api

I want to get events list by using polkadot.js/api. I can see api.query.system.events() in docs. Docs: https://polkadot.js.org/docs/substrate/storage#eventcount-u32 However, this api lists events for ...
4 votes
2 answers
254 views

Events in Polkadot.js/api

I am trying to call api.events.staking.Withdrawn.is in polkadot.js/api. Docs: https://polkadot.js.org/docs/substrate/events#withdrawnaccountid32-u128 Code sandbox: https://codesandbox.io/s/hardcore-...