Smart Contract for fetching transaction note field

Hi All,

I am a newbie to TEAL and smart contracts on Algorand. After reading through the documentation I have some fair idea about how the ASC1 works. So the question would be, I am designing a smart contract system where all the nodes create a transaction with their own separate hash value(hash value to some important data) in the note field which could to be fetched later by other nodes. Later for a node other than the transaction creator to fetch this data in the note field I want to create a contract which checks the cost set by the transaction creator and pays them to receive this data.

I am not aware if we can have such a complex logic build into TEAL. It’s more of a vending system where the nodes pay to receive this data from the transactions created by the owners. And if possible not to pay twice if the data is already paid for.

Thanks

I don’t think it is possible, because ASC1 can’t access the transaction data already on the blockchain.
Best regards,
Maugli

Hey Maugli. Thanks for the response . I also thought the same but I read about attaching contracts to transaction somewhere.

I was wondering If you know a better way to solve such a problem. Since TEAL will not support the purpose. Any suggestions??

You can submit more than one transaction together, executed together, that is true.
This is how atomic swap contract was done, a very elequent example of TEAL.
But the data already on the blockchain cannot be accessed using ASC1, i.e. TEAL

I wonder what will ASC2 look like, and when will the Algorand developers unveil it.

And a roadmap with dates would also be very useful, e.g. when will they introduce
Vault, ASC2, sharding, subchains, ZEC-like anonymous transfer of value, etc.

The atomic swap is a good choice. With the new developer documentation pages it makes it better to understand these concepts.

Even with Turing-complete smart contracts, it would be difficult to implement such a use-case without heavy cryptographic tools (such as zkSNARG). The issue is that in all the public blockchains that I am aware of, smart contract data is public. So if you want a smart contract to be able to provide a document to another party, this document essentially would need to already be publicly accessible on the blockchain.

Note that this is contrast to oracles that you can do with Algorand. Oracles allow other smart contracts to access information from the outside world. These other smart contracts may need to pay to access to the oracle. However, the difference is that the information is public from the start. What an oracle provides is a way to make this information available to smart contracts on the blockchain.

Hi fabrice,

You are right about the information being public from the start . I was thinking about using cryptographic tools for securing this bit of data. It’s only a hash value that I would like to trade and maybe using atomic transfer. But my confusion is where to store this hash on a transaction and provide it later when the atomic transfer is complete. Initially I was thinking creating assets with the hash value in the note field. When someone requests for this asset then we group 3 transactions based on atomic transfer to have a trade :
first ,an opt in transaction by the receiver for receiving the asset
second, a transaction for giving the asset with the hash value from the creator to the receiver
third, a transaction from the receiver to the creator with the amount for the hash value

But things like hash value of the data , fee for the data and trying to hide this hash value are my concerns at the moment. Any ideas??

Thanks