All - Activity - hungpq - Algorand

Overflow/underflow of [byte] integer operations

Thanks for your answer. My question is can the 128-byte output be used to store in scratch slot or global variable in the application (which type defined as bytes)? If not, what does this 128-byte output can be used?


Thanks for your answer. I have another question that needs to ask here for byte calculation here. Back to the scenario where I have BytesMul(a,b). If a*b exceeds 64 bytes and I store the result in scratch slot or global/local slot (which defined as bytes), will it work? If not, what does the result…


Hi, I’m writing test script for PyTeal application. I’m using sandbox GitHub - algorand/sandbox: Algorand node sandbox, but have some limitation. The block time seems too slow for running multiple scenarios/fixtures of testing. I did read in docs but seem no configuration for this.


Thanks for your answer. I did read it, but what I got is hex value, not base64 value. The hex value with the length of 64 and it does represent the address (58 length) I believe.


Hi everyone, I want to ask if there is a way to get the address (58 length) from hex value (64 length). The story is I got base64 input, then I decode it to hex (it does include padding hex of others values) and get the address in hex value (I believe that since when I paste it in the explorer, I…


Thanks Ben for your answer. It helped me a lot. What I want to ask here is up to 32 times, up to 1024 bytes in a single transaction/1 application call. Or it is a limit forever in an application? It can log up to 32 times for the entire life cycle of its, no matter how many transactions call to its app…


And speaking of log, I read this in the docs (Opcodes - Algorand Developer Portal) that have the limit MaxLogCalls params. Could you tell me more about this limit? Is that max number of logs in a transaction? Or an application can only log MaxLogCalls times, then it cannot emit logs anymore?


Ok, I’ll tell you more detail. I’m writing Log in the contract. Are there any best practices for this? As I know log only accepts log for 1 byte. So I have to put all parameters in a single byte. That’s why I asked this question. For example with the question I ask, I want to log the value 0000000000000…


Thanks for your answer. What is the difference between exp and expw? It would be great if you can give some examples. And also I want to know how to do bit shifts in teal? For example, I want to express the value 4 and 7 in a single byte, each value can have 64-bit length (ex: 000000000000000400000000…)


AVM currently now supports almost like other blockchain platforms so there are more and more defi apps to follow in the upcoming days. So I want to ask how to perform complex power math (with large numbers). I can see bytesadd, … but can’t seem to find with power calculation. If so, can you give me an example…


Or if the RekeyTo is set to non-zero in the txn call to the app (for example address A), the address A will be considered as the authorized sender account (like a set RekeyTo txn but it is in with the application call)?


Thanks, I can understand about CloseRemainderTo and AssetCloseTo. For RekeyTo, stand with stateful smart contract point of view (not the wallet or the dapp front end which builds txn), what really happens when this field is not a zero address? For what I understand, it can authorize for other accounts…


I’m implementing a stateful contract in teal version 6. This contract supports submitting inner txn/calling other applications, receiving assets/algo, transferring assets/algo to users, and of course have functions and methods for users to interact with. One thing here is that when a user submits txn, I see some spec…


Thanks for your help. Speaking to return values, are there any examples of calling inner txn, app call log, and getting the return value from that in PyTeal? This seems pretty new and gives more flexibility.


Hi, I want to ask if I can query other transaction properties in a group inner txn. For example 1 I got this group txn txn1: call to contract A, then A calls inner txn creating contract B txn2: call to contract C. In this contract, how can I get the address/appId of B? For example 2 I got this group txn…


I want to know if there is a secure way of deploying contracts in Algorand. For example in other chains, I can use a hardware wallet and some online IDE (like Remix for example) to have a secure wallet for deployment, rather than creating a private key locally and lack of security, then running scripts…


In PyTeal, is there any way to get the app address from a given app id? I see a similar method in the Python SDK but I can’t find it in PyTeal anyway. Or if it could, can that field be returned with CreatedApplicationID (something like CreatedApplicationAddress)? The scenario here is that I created an app…


Thanks for your answer. It helped me a lot. So any plan to see this upgrade in testnet or mainnet? If so, when does this likely happen? A month is good?


Very amazing and really want to use the new AVM version 1.1. Does any testnet available for teal version 6? I tried https://api.testnet.algoexplorer.io API ( v2 - Algorand Developer Portal) and https://node.testnet.algoexplorerapi.io but it seems like it can’t compile new opcode: HTTP Error 400: Bad Request…


Thanks for your answer.

Any docs or updates related to this?


Interesting here since in contract C, CallerApplicationID and CallerApplicationAddress could return B and B’s address. So it still means that (if all default, B does not change the sender group txn2) in contract C, get Txn.sender will return B’s address just like CallerApplicationAddress? So in C,…


And speaking to operation, I want to ask what exactly mulw, addw (Opcodes - Algorand Developer Portal) do? Can you give me some examples? Sorry for my bad understanding. Thanks.


Thanks for your answer. It helped me a lot. Just for clarity, for example with this PyTeal operation BytesDiv(BytesMul(a,b),c). If a*b exceeds 64 bytes, then the (a*b)/c will fail (since the left argument (a*b) exceeds 64 bytes)? The same thing happens with b*, b+, b-?


I still have some confusion when reading the doc. Sorry if I’m not getting it but I really want to understand this deeply.

With your answer, the byte integer operations b+ and b* do not overflow, so what happens with the return value (if the result is more than 64 bytes)? The docs say this l…


I want to ask about this field when submitting app call txn. When creating a contract, I can see this field is to extend contract size (this may lead to increase the maximum balance of the creator). But when submitting a transaction to the app, I can see this field Transaction reference - Algorand Developer Portal ExtraProgramPages…


I did read about byte operation here Opcodes - Algorand Developer Portal. So I think if I need a large result number, I should use bytes instead of uint64 (due to the value). But I want to know what if the +, * failed on overflow or - operation failed on underflow for bytes (I see in uint operations…


Hi, I have a question related to Algo reward. What I know is holding Algo can get Algo reward automatically. So this leads to some special handling at the smart contract level. What I want to ask here is whether the method Balance(address) or balance opcode in PyTeal and teal returns the pending reward also…


I have this question for ASA. Per ASA design, we can submit a number of decimal places that we want to use. But I saw that the get balance opcode returns uint64. So assume that the decimal is 18 then for the balance larger than 20, it won’t work? (20*1e18 > 2^64) Is that the limitation that almost tokens in…


Talking about smart contracts and future plans, there are some things that Algorand different from others is that it does not have read functions (like other VMs). These read functions are specially used for defi apps since they do not rely on backend or centralized calculation. Does AVM have plans to support t…


By "the amount of storage cannot change," I believe that it means that the contract cannot add or remove global or local variables. The number of global and local variables must be the same. It also means that it cannot change global to local or a global variable to some other global one (different name, different type).


Thanks again, it was really a great help for me. I come back with another question here.

First thing, I want to apply contract upgradeable in Algorand. I know Algorand supports this, but does it have any limitations (like upgrade in EVM, the storage variable slot must be in order)? Per Algor…


Thanks for your answer. It helped me a lot. I got another one. For contract calls (pay, transfer assets from contract), these fees of the transaction must be paid by the contract. Therefore I must design a funding amount in a group txn in the group txn of interacting with the contract. Is there any better design…


And another thing, I read about stateful and stateless smart contracts in Algorand. For developing dapps, I see stateful has all the things that stateless smart contracts do have. So why do some dapps (like Tiny Man) still use stateless smart contracts (smart signatures) in their contract design?…


One more thing. In other blockchains, there is a concept in smart contracts called factory (a contract can create another contract). Can smart contracts in Algorand do the same (for stateful smart contracts)?


Thanks everyone, I got the overall idea. One more question, does Algorand contract have something similar to event in other blockchains? And any idea of browsing event in block based? Like querying events in some specific range of blocks?


Thanks Fabrice, it was a great help for me. One more question: when I send a failed transaction to the app, it appears to show an error code like assert failed pc=800. So do you have any idea where to find exactly the line of code to validate the error or something like that, please let me know.


Thanks for your answer. It makes more sense to me now. So do you know how to calculate the minimum algo for a given address? I mean the steps and the fields needed to use. For example, using the SDK or API to get user info and use which field of that user info to multiply and add each other to sum up to…


GM, I’m currently developing some applications on Algorand. There are some points I want to discuss while I’ve finished reading docs and researching about Algorand contracts: minimum account balance (for account and smart contract addresses also): how is it calculated through querying the info of the account….