# Smart Contract for fetching transaction note field

**URL:** <https://forum.algorand.co/t/smart-contract-for-fetching-transaction-note-field/1355>\
**Category:** Uncategorized\
**Created:** [February 9, 2020, 10:00pm UTC](https://forum.algorand.co/t/smart-contract-for-fetching-transaction-note-field/1355 "2020-02-09T22:00:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anupcoded](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.algorand.co/anupcoded/32/340_2.png) [@anupcoded](https://forum.algorand.co/u/anupcoded)\
**Post date:** [February 9, 2020, 10:00pm UTC](https://forum.algorand.co/t/smart-contract-for-fetching-transaction-note-field/1355/1 "2020-02-09T22:00:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Maugli](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.algorand.co/maugli/32/907_2.png) [@Maugli](https://forum.algorand.co/u/Maugli)\
**Post date:** [February 10, 2020, 9:18am UTC](https://forum.algorand.co/t/smart-contract-for-fetching-transaction-note-field/1355/2 "2020-02-10T09:18:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anupcoded](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.algorand.co/anupcoded/32/340_2.png) [@anupcoded](https://forum.algorand.co/u/anupcoded)\
**Post date:** [February 11, 2020, 8:50pm UTC](https://forum.algorand.co/t/smart-contract-for-fetching-transaction-note-field/1355/3 "2020-02-11T20:50:47Z")

</div>

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??

---

<div class="post-metadata">

**Author:** ![Maugli](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.algorand.co/maugli/32/907_2.png) [@Maugli](https://forum.algorand.co/u/Maugli)\
**Post date:** [February 12, 2020, 9:37am UTC](https://forum.algorand.co/t/smart-contract-for-fetching-transaction-note-field/1355/4 "2020-02-12T09:37:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anupcoded](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.algorand.co/anupcoded/32/340_2.png) [@anupcoded](https://forum.algorand.co/u/anupcoded)\
**Post date:** [February 17, 2020, 8:51am UTC](https://forum.algorand.co/t/smart-contract-for-fetching-transaction-note-field/1355/5 "2020-02-17T08:51:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![fabrice](https://avatars.discourse-cdn.com/v4/letter/f/5fc32e/32.png) [@fabrice](https://forum.algorand.co/u/fabrice)\
**Post date:** [February 18, 2020, 1:38am UTC](https://forum.algorand.co/t/smart-contract-for-fetching-transaction-note-field/1355/6 "2020-02-18T01:38:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anupcoded](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.algorand.co/anupcoded/32/340_2.png) [@anupcoded](https://forum.algorand.co/u/anupcoded)\
**Post date:** [February 20, 2020, 7:11pm UTC](https://forum.algorand.co/t/smart-contract-for-fetching-transaction-note-field/1355/7 "2020-02-20T19:11:09Z")

</div>

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
