I need to code something quite complex compared to my experience. Just for academic purpose, I'm supposed to have a lightweight blockchain that connects a group of nodes; in this blockchain every node ask and send informations to each other through a smart contract. By ignoring the problem of how to set up this kind of blockchain, my only duty is to program a test code for the smart contract and the Client (using Python) that will be run by every node.
My problems start when i have to ask informations to a node from the smart contract:
Let's suppose that our contract has a function "getDataFrom(address)
" which can be called by a node when he needs to get specific data from another node.
How will this code be structured? The only thing that comes to my mind is to make a transaction from the smart contract to the address, but even in this case how much ETH should be used? Then, if this approach is correct, i think that in the Client code there will be a function that handles a received transaction and then calls a "returnData(data)
" from the smart contract, right?
I don't know if that's correct or not, so please i'd be very grateful if someone can help me. Another thing i wanted to ask, is if exists some way to make the Client functions usable from the Smart Contract without sending a generic transaction, i think that this would stop all of my problems.