Querying Transactions in/within Executable Solidity Code

Vmusic2YaVmusic2Ya Member Posts: 2
edited August 2018 in Smart Contracts and Dapps
Hi,

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), that's a requirement - solidity code running or executing in a smart contract

The business example is a simple smart contract that is a banking deposit account: 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. Sorry for being insistent here, but the requirement is that the query or read of the tx must happen in the executable solidity code.

I've read somewhere that you can not query transactions in executable solidity code because of smart contract "state changes" - but that doesn't make sense.

I'm confused at how ANY/ALL transaction changes state of a smart contract. Again from a business perspective - I have a smart contract deposit bank account and I put a deposit transaction of 200 ether into it. The STATE or STATUS of my smart contract deposit account was "ACTIVE" before I put in the 200ETH deposit; and after the 200ETH deposit, is still "ACTIVE", nothing has changed the state or status.

It seems very odd, from a business perspective that solidity code can write transactions out onto the block chain, but it can't read or query them?? [Again - I want to query the transaction in solidity code running in my smart contract, and not outside of it, like web3.js or whatever..... i need to read tx in my solidity code]. From a business perspective, this is seems sooOOOOooo very basic.

My understanding is that the CONSTANT key word added to a function lets you pull or read ONLY THE MOST RECENT transaction posted on the block chain. Not quite a full function query function - but it is at least the ability read and retrieve the latest transaction. Is this understanding correct??

Here's a deep thought - why even keep a balance variable in my smart contract, shouldn't I be able to simply read all the transactions posted to my smart contract account and get a balance? Shouldn't the creators of a smart contract determine it's STATE or possible status values--- why does Ethereum think they know the possible "states" of my smart contract? A smart contract can be or do anything I (the code writer) wants it to be, and I alone should define the state or status of the contract based on business rules.

PLEASE - if anyone has seen examples of querying or reading blockchain transaction in solidity code........ or why this basic functionality is so forbidden (you can provide a link). I would greatly appreciate it.

Are there any plans to change or support this very basic functionality in the future?
Is there a comparable product, I won't mention names but it's three l-E-tter-OS..... that supports querying transaction written on the blockchain from within it's code??

Thank you so much for helping here.

KornFuzed in Columbus!
Post edited by Vmusic2Ya on
Sign In or Register to comment.