I want to open a Crowdloan and read current contributions as they come to my crowdloan to offer a special reward mechanism for early contributors. What's the best way to get the information on what addresses are contributing? I'd like to know the block height and the amount.

1 Answer 1


The best thing for this would be to track events in previous blocks on your chain.

From the Crowdloan Pallet:

/// Contributed to a crowd sale. `[who, fund_index, amount]`
Contributed(T::AccountId, ParaId, BalanceOf<T>),

The pseudo code:

  1. For each block
  2. Get all events for that block
  3. Find all Crowdloan.Contributed events for that block
  4. From those events, extract:
    • The block number
    • The user contributing
    • The parachain being contributed to
    • the amount being contributed
  5. Accumulate your data.

You could also make a service which tracks this live by listening for new blocks and events.

  • So in order to get all the crowdloan participants i need to iterate through every block from beginning of crowdloan to end of crowdloan. Commented Jun 21, 2022 at 14:58
  • No. There is a merkle trie which is in storage that contains all of the existing crowdloan contributions and you can ready one time to get all of the final contributions. This question was asking about getting such updates live, which would require the use of events and stuff like that.
    – Shawn Tabrizi
    Commented Jun 21, 2022 at 15:30
  • How do you access this merkle tree ? I couldn't find it, i'm itterating through every blocks with api_at.events.crowdloan.Contributed.is() api, it's taking a very long time
    – Nathan
    Commented Jun 22, 2022 at 13:34
  • 1
    Please take a look at existing answers like: stackoverflow.com/questions/69130031/… and substrate.stackexchange.com/questions/1693/…
    – Shawn Tabrizi
    Commented Jun 22, 2022 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.