Does solidity have the ability to query transactions it puts on the blockchain, based on data in the transaction? By query I mean within solidity code running inside a smart contract (not web3.js running outside a smart contract)
So yesterday my contract executed a down payment transaction, today I want to query any/all blockchain transactions for this smart contract with a transaction type of "dp" or down payment? I want this query code to run or execute inside my smart contract.
I am not after a tx hash, I want the entire tx data for a specific transaction or transactions based on parameters, like transaction type, from address or date/time, etc.
NOTE: I want to query these transactions by executing solidity code inside my smart contract. I DO NOT WANT to use web3.js - please, please, please don't provide an answer with web3.js --- the querying has to be done inside the smart contract in solidity code. I appreciate your help - but if you answer is web3.js then you're really not helping
PLEASE - if anyone has seen examples of querying blockchain transaction in solidity code, please post a link or mention it. It seems very odd that you can post transactions to the BC, but there's not a get or retrieve or query function built into solidity. That seems, well to be honest, so basic.
I found out that while solidity can do event logging, such that all tx's are logged into a special area in the BC -- SADLY -- solidity code executing within a smart contract CAN NOT read these logs https://www.bitdegree.org/learn/solidity-events/
I just don't get it......why, why, why would you have a language that creates transactions but can't read them or query them. It just doesn't make sense to me.
I greatly appreciate answers from those knowledgeable in solidity!! Thank You Vmusic
This is not possible. Contracts cannot query arbitrary state within the blockchain history.
Your only options are:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With