Skip to content

Commit

Permalink
docs(filters): added parse_cbor
Browse files Browse the repository at this point in the history
  • Loading branch information
paulobressan committed Aug 9, 2023
1 parent 2bdae0f commit d1660ea
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/pages/v2/filters.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ _Filters_ are intermediate steps in the pipeline that process events as they tra

These are the existing filters that are included as part the main _Oura_ codebase:

- [Fingerprint](filters/fingerprint.md): a filter that adds a (probably) unique identifier (fingerprint) to each event.
- [Selection](filters/selection.md): a filter that evaluates different built-in predicates to decide which events should go through the pipeline.
- [ParseCbor](filters/parse_cbor.mdx): a filter that maps cbor transactions to a data structure.

### Legacy V1
- [Fingerprint](filters/fingerprint.mdx): a filter that adds a (probably) unique identifier (fingerprint) to each event.
- [Selection](filters/selection.mdx): a filter that evaluates different built-in predicates to decide which events should go through the pipeline.

New filters are being developed, information will be added in this documentation to reflect the updated list. Contributions and feature request are welcome in our [Github Repo](https://github.com/txpipe/oura).
60 changes: 60 additions & 0 deletions docs/pages/v2/filters/parse_cbor.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Parse CBOR filter

The `parse_cbor` filter aims to map cbor transactions to a structured transaction.

However, the filter will only work when the record received in the stage is CborTx in other words a transaction in Cbor format that was previously extracted from a block by another stage, otherwise, parse_cbor will ignore and pass the record to the next stage. When the record is CborTx, parse_cbor will decode and map the Cbor to a structure, so the next stage will receive the ParsedTx record. If no filter is enabled, the stages will receive the record in CborBlock format, and if only the parse_cbor filter is enabled in `daemon.toml`, it will be necessary to enable the [split_cbor](split_block.mdx) filter for the stage to receive the CborTx format.

## Configuration

Adding the following section to the daemon config file will enable the filter as part of the pipeline:

```toml
[[filters]]
type = "ParseCbor"
```

The next pipeline will receive a record ParsedTx with the block transactions structured, for example:

```json
{
"inputs": [
{
"txHash": "RJxOGh8tYw2zJEM4IOe1UyJLgmLzirUeNJyD3WXw0Fs="
},
{
"txHash": "D5zaREMo+A23Fd6mEHYxnf5VwWi1x7AyRZi8rMKyOqQ=",
"outputIndex": 1
}
],
"outputs": [
{
"address": "AR3DnbkA7SpK3ebbYyrOhMQuofbn5bSErXkHS+Rg1t2/czYqcTheAgzPiEIF5fA/z5vj3ZBY3WuF",
"coin": "1717921431"
},
{
"address": "AbUagvWOR+HK85VJqlYyfWgevTEW57nBukEYOPjlTVqn9KaKp7fM4lwUjem4RcV4wgsyFpDgkdlU",
"coin": "7195641470"
}
],
"witnesses": {
"vkeywitness": [
{
"vkey": "gEV61C5PJwtPKv5U+Ha2f1n4cU/axSaa2EXYCQoa71w=",
"signature": "ogVM0RwQZklGjquCWeZdNv5DZDAAHqRxpjKNcaRLv79hDDdyA4+4YQ2f2Mu+svY/BwnIxS65iuhapiITHtvBDg=="
},
{
"vkey": "z+mF66iNeVqtMqfiC7H1F95lvz/JOO00Jmhg+91t3Gs=",
"signature": "ogVM0RwQZklGjquCWeZdNv5DZDAAHqRxpjKNcaRLv78+MW9TxnabFVGgbBO/lttg8NvNAra4VAzUUrhfYcIvBQ=="
}
]
},
"collateral": {},
"fee": "176061",
"validity": {
"start": "52365819",
"ttl": "100045133"
},
"successful": true,
"auxiliary": {}
}
```

0 comments on commit d1660ea

Please sign in to comment.