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

How to configure Oura to filter specific event and publish them Kafka #15

Closed
miracatici opened this issue Dec 28, 2021 · 4 comments
Closed
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@miracatici
Copy link

miracatici commented Dec 28, 2021

Hello, I would like to use Oura to watch chain for the only specific events. I think that I build-up key elements. I mean, I set up a kafka broker with zookeper and oura process. My deamon.toml configuration is added below. I wrote a Python consumer for kafka topic. My kafka message is also added below. I ask two question:

  1. How to configure oura to publish the only specific events (i.e only mints)?
  2. How to get details of transactions that are consumed in the script?

daemon.toml

[source]
type = "N2N"
address = ["Tcp", "relays-new.cardano-mainnet.iohk.io:3001"]
magic = "mainnet"

[sink]
type = "Kafka"
brokers = ["kafka:9092"]
topic = "cardano-events"

example message

{
    "context": {
        "block_number": 6686920,
        "slot": 49161756,
        "timestamp": 1640728028,
        "tx_idx": 11,
        "tx_hash": "e93f6d1de091a7c8fc1b8621ffa6f2f3a360d7844294eb7c48d5d07d008e471a",
        "input_idx": 2,
        "output_idx": null
    },
    "tx_input": {
        "tx_id": "827a7da3adb5a7a9cbbbf8f007eb6620037ef18f63858ebdefa8f42d208fc367",
        "index": 1
    }
}

@scarmuega
Copy link
Member

hi @miracatici, thanks for reporting. This is being addressed in #18. Hopefully, a few hours away of being merged. I'll post instructions on how to apply your required filtered once it's done.

@miracatici
Copy link
Author

Hi, @scarmuega great work! How about the second question? Is there any option to gather full details of a tx? Especially tokens and assets in tx.

@scarmuega
Copy link
Member

@miracatici a new version has been released which I think addresses both of your requirements (v0.3.8).

  • the new Selection filter allows you to filter particular events using different predicates. You can read more about filters in the corresponding docs section: https://txpipe.github.io/oura/filters/selection.html
  • there's a new option in the N2N source config that will instruct Oura to include all of the details inside a Transaction type of events. These details include: tx inputs, tx outputs, metadata, mint, etc. Check the docs to see how to enable that flag: https://txpipe.github.io/oura/sources/n2n.html

With the above features available, I think that your use-case can be solved with a configuration similar to the following:

[source]
type = "N2N"
address = ["Tcp", "relays-new.cardano-mainnet.iohk.io:3001"]
magic = "mainnet"

[source.mapper]
include_transaction_details = true

[[filters]]
type = "Selection"

[filters.check]
predicate = "variant_in"
argument = ["Transaction"]

[sink]
type = "Kafka"
brokers = ["kafka:9092"]
topic = "cardano-events"

Please let me know how it goes, your use-case sounds very interesting.

@scarmuega scarmuega self-assigned this Dec 31, 2021
@mark-stopka mark-stopka added the documentation Improvements or additions to documentation label Jan 9, 2022
@miracatici
Copy link
Author

Hi @scarmuega, as you can see I did it with your guidance. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants