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

Add support for various reducers #11

Merged
merged 10 commits into from May 27, 2022

Conversation

matiwinnetou
Copy link
Collaborator

@matiwinnetou matiwinnetou commented May 22, 2022

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 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
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
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
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
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.

None yet

3 participants