Checking blockchain data from a smart contract - General - Algorand

Checking blockchain data from a smart contract

post by Opeerah on Jun 26, 2024

Hello,

inspired by some Etherium DApps, an NFT owner can get benefits like DApp’s pricing reduction automatically, is that possible to be implemented by Algorand smart contracts keeping the absolute truth only on-chain ?

For example :

let’s say we have a smart contract that redirect each callback depending on transaction sender : if the sender is the owner of NFT “X” then he will get 2% instead of regular DApp fees 5%… so the question is how can the contract knows that, of course we can’t put all VIP addresses on the contract because of the huge size, so Iam looking to find an efficient way to do so.

Thank you for your help

post by scholtz on Jun 27, 2024

there are multiple NFT standards…

with arc72 you store onchain information who is the owner of the specific asset and can do some logic in some method where you resell the nft…

see our submission to the last hackathon for the ticketing application: shindg-contract/projects/shindg-contract/contracts/Shindg.algo.ts at main · scholtz/shindg-contract · GitHub

post by Opeerah on Jun 27, 2024

Amazing @scholtz, is that possible using Pyteal ?

post by Opeerah on Jun 28, 2024

Okay @scholtz I think I have understand the idea from Arc72, to be honnest I think that implementing NFTs within protocol layer as standard assets is much better, especially if trading them is an option, however the tickets example was so helpful.

post by scholtz on Jun 28, 2024

watch out… pyteal is old language which new projects should not use… púte python is now available… just run algokit init

post by Opeerah on Jun 28, 2024

Thank you @scholtz for the recommendation

post by Xxiled on Jun 28, 2024

You could use an oracle to supply the data feed within the contract.

With something like GORA network you could create the data feed which is then propogated to their nodes and then you could take that info in within the contract by interacting with GORA smart contracts.

We’re doing a similar thing at CompX - will be providing our pricing and ASA info from our database that’s off-chain as a data feed so we can use our data within the contracts

post by Opeerah on Jun 29, 2024

@Xxiled interesting, why should I do that instead of feeding my contract with just boxes ?

post by Xxiled on Jun 29, 2024

It depends - how are you going to update those boxes? If you expose any of the data you’re passing into your smart contract in web requests prior to sending via txn you open up an avenue for attack.

So oracles allow sensitive data to be transferred/read on chain without being exposed

post by Opeerah on Jun 29, 2024

@Xxiled I will update boxes manually each time NFTs collection will be changed, there is no risk at all because all what the contract should do is checking NFT’s validity from the box.