Skip to content

Add support for various reducers - #11

Merged
scarmuega merged 10 commits into
txpipe:mainfrom
matiwinnetou:total-transactions-reducers
May 27, 2022
Merged

Add support for various reducers#11
scarmuega merged 10 commits into
txpipe:mainfrom
matiwinnetou:total-transactions-reducers

Conversation

@matiwinnetou

@matiwinnetou matiwinnetou commented May 22, 2022

Copy link
Copy Markdown
Collaborator

Introduces PNCounter and

  • total_transactions
  • total_transactions_by_epoch
  • transactions_count_by_contract_address
  • transactions_count_by_contract_address_by_epoch
  • total_transactions_count_by_contract_addresses

@matiwinnetou
matiwinnetou requested a review from scarmuega as a code owner May 22, 2022 21:32
@matiwinnetou
matiwinnetou force-pushed the total-transactions-reducers branch from 6bffe91 to 73a1f3c Compare May 22, 2022 21:34
@matiwinnetou matiwinnetou changed the title Add support for total transactions count reducer Add support for various reducers May 24, 2022
&mut self,
tx: &alonzo::TransactionBody,
) -> Result<(), gasket::error::Error> {
let is_smart_contract_transaction = tx.iter()

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scarmuega is there any more clever way to check if a transaction is in fact smart contract transaction?

Right now I am checking if any of the output addresses is in fact smart contract type of address, there could be a more clever way I guess..

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this:

pub enum TransactionBodyComponent {
    Inputs(MaybeIndefArray<TransactionInput>),
    Outputs(MaybeIndefArray<TransactionOutput>),
    Fee(u64),
    Ttl(u64),
    Certificates(MaybeIndefArray<Certificate>),
    Withdrawals(KeyValuePairs<RewardAccount, Coin>),
    Update(Update),
    AuxiliaryDataHash(ByteVec),
    ValidityIntervalStart(u64),
    Mint(Multiasset<i64>),
    ScriptDataHash(Hash<32>),
    Collateral(MaybeIndefArray<TransactionInput>),
    RequiredSigners(MaybeIndefArray<AddrKeyhash>),
    NetworkId(NetworkId),
}

ScriptDataHash -> will this be empty if this is not smart contract transaction?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depends on what you mean by "Smart contract transaction". If you are looking for transactions that execute scripts, then you need to look at input-related components, since script execution only takes place when you're consuming a UTxO that's sitting on a script address. A way of doing this is checking for redeemers in the witness set.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to count all interactions with a smart contract address:
e.g.

addr1w999n67e86jn6xal07pzxtrmqynspgx0fwmcmpua4wc6yzsxpljz3

https://cardanoscan.io/address/addr1w999n67e86jn6xal07pzxtrmqynspgx0fwmcmpua4wc6yzsxpljz3

Transaction Count |   | 3372792

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants