I want to store a transaction on the ethereum blockchain with someText
attached to it:
{
from,
to,
value,
data: someText
}
I later wish to retrieve that transaction and read the text that was attached to it.
But actually, I do not want to retrieve someText
as it was originally stored in the transaction. I want to retrieve someText
with someExtraText
appended to it.
someExtraText
should be generated and appended to someText
dynamically, every time I request that transaction. Its value will not be fixed. It will be different every time.
The logic that generates someExtraText
and appends it to someText
before it is sent to me, should not reside on my server. It should also reside on the blockchain.
I know that there is a clear API on how to send transactions to the blockchain and how to retrieve them, using web3.js:
web3.eth.sendTransaction({
from,
to,
value,
data: someText
})
web3.eth.getTransaction(transactionHash)
But they will obviously not provide me with what I want.
Question: Is what I am describing a custom smart contract that I will need to build or is what I'm describing not possible at all, even through the use of a smart contract?
I understand that the role of smart contracts is to generate transactions whereas I'm thinking of a smart contract that would use an existing transaction and attach some data to it before it is sent back to me.
If it is possible, and since I don't have any experience with smart contracts, could you give me some starting points? Not as to how to build a smart contract, I know there are tutorials for that, but as to how to start building this particular smart contract. I'm not asking for the actual code but more of a high level explanation if possible so that I can somewhat visualise its structure/logic and use it as a blueprint. Again, I understand that this might not be possible at all :)
Please note that even though my use case might sound weird I don't want to go into too many details that could sidetrack the main objective of the post.
I'm basically looking for a way to retrieve transactions I've created but also attach some extra dynamic information to them at the moment of retrieval. That information will obviously not be stored in the transactions as they are immutable. It will be information that will be lost as soon as I read it and created anew the next time I request that transaction.