Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Profile picture
Behrang Norouzinia
0 Questions, 44 Answers
  Active since 31 December 2022
  Last activity 4 months ago


539 + 10 this June 1 68

Badges 5

Editor Freshman Enthusiast Scholar Supporter
0 How to send bounceable transaction? OR transaction spent the sender's entire balance!

TLDR: For external messages to wallets, don't set the +16 flag, instead set the +2 flag.

The meaning of +16 flag: If there was an error in processing the action, bounce the message in addition to rolling back the transaction. This has no use in external messages, because there is no sender to receive the bounced message.

The meaning of +2 flag: If there was an error in processing the action, don't rollback the transaction and ignore it. This is very important in external messages to wal...

3 months ago
0 What is the best way to understand the & and opcode transit in TEP?

Hex digit 0xF has the binary representation 1111. Anything that is & with it will remain the same.

Hex digit 0x7 has this binary representation: 0111. Anything that is & with it will lost the first bit, or the first bit becomes zero.

In your first example, 0x5... & 0x7... remains 0x5... because 5 has binary represenation 0101 and the first bit is already 0.

In your second example, 0x8... & 0x7... changed to 0x0... because 8 has binary representation 1000...

4 months ago
1 Standard method for defining opcodes in func?

Newer versions of FunC compiler added support for const, so in newly written code, you may use this feature, or use the old approach. Both are supported.

The const way of defining a constant is similar to other programming languages, so it can make your code easier to understand for readers.

6 months ago
1 Inactive wallet

Send any amount from your wallet.

You don't need to worry about it bein inactive. The first time that you send an outgoing transaction, your wallet software will deploy your wallet on chain and then sends the specified amount from it.

6 months ago
1 Inconsistent slice when calling my_address() in different contexts

The CS{Cell{...} bits: 0..267; refs: 0..0} is the string representation of a slice. A slice is a structure for reading a cell.

In your example, depending on the context, 2 different cells where returned and converted to slices. The first one has 267 bits, and the second has 268 bits, but also starts from bit 1.

That is, even though these cells are different, because slices are starting at different indexes, they represent the same thing at the end, and as you said, after parsing them ...

8 months ago
0 What would happen if someone tried to send Toncoins from mainnet to testnet?

Your transfer happens on mainnet, and will be sent to the address you specified. What happens will depend on a few factors:

  1. If you (or your wallet) disable bounce flag, the TON amount will be sent and will remain at the recipient's account.

  2. If you (or your wallet) keep the bounce flag, then it depends on the recipient account:

    A. If there is no smart contract at the destination, it will bounce back.

    B. If there is a smart contract, it will depend on its behavior, and ...

9 months ago
0 Can a FunC variable store the result of a logical expresson?

Yes, it's supported, and your code is valid. enough? will be an integer, with value -1.

9 months ago
0 How to optimize gas usage in a smart contract?

There is a page on ton.org that presents some best practices for optimizing gas:


9 months ago
0 How to measure the length of a Lisp-style list?

Finding the length of a lisp-style list is a manual process. You have to traverse the list. As such, it most likely doesn't worth it in a smart contract context, so it's better to keep a separate counter variable, whenever you're going to need to use length.

9 months ago
0 What numbers mean "true" and "false" in FunC?

false is zero. true is -1. All other non-zero integers are also like a boolean true.

9 months ago
1 Convert public key of validator to correct format

Validators create a new keypair for each round of validation, and use that to participate in elections and create blocks. They may also change their ADNL address on each round, but that's not what they usually do.

If you want to look at their wallets on TON blockchain explorers, you have to first find the controlling wallet, that is the wallet that sends TON to participate in elections.

This information can be looked up by running the get method participant_list_extended and it only r...

10 months ago
0 How to compare two slices for equality?

Looks like it is removed to force developers to use equal_slice_bits function. This function name is better in that it highlights the fact that only bits are compared and not references.

This is the old definition of both:

;;; Checks whether the data parts of two slices coinside
int equal_slice_bits(slice a, slice b) asm "SDEQ";
int equal_slices(slice a, slice b) asm "SDEQ";

So these were both equal functions.

10 months ago
1 Are the gas fees the same for mainnet and testnet?

Gas prices are calculated by looking at config params 20 (for masterchain) and 21 (for basechain). As long as they are the same, the calculated gas fees will be the same.

I checked it and currently on the basechain they're equal, but on the masterchain, they're not.

Also storage fees are dependent on the runtime state of each account, so they'll surely be different, although usually it's a very small fee.

There is also a forward fee which might differ depending on the blockchain conf...

10 months ago
0 How to make a new address on TON active?

When you create a smart contract on TON (such as a wallet), its address is pre-calculated, even before being deployed. You can start sending it money and messages, and if the sent messages are non-bounceable, the balance of the account on-chain will be increased. In this case, you will see the account is still uninitialized and not activated, but it has a positive TON balance.

To activate it, you have to deploy the smart contract. If this is a wallet smart contract, it will automatically g...

one year ago
2 Is it more cost-effective to use Fift instead of FunC?

You can do it, and it probably helps your smart contract to consume less gas, however, it makes it more difficult to read it and check it for security reasons, and also makes maintenance of it harder.

I guess it doesn't worth it to save some gas in the TON ecosystem, because gas prices are fixed, and they're very cheap.

one year ago
0 What's the difference between addresses that start with EQ and those that start with UQ?

Address that start with EQ are bounceable addresses, and those that start with UQ are non-bounceable addresses. These are only a hint to the wallet software that you want the sent message to be able to bounce or not.

When an error occurs in the target smart contract, usually a bounced message will return to the sender. In some cases you don't want the error message to be generated and also you don't want the transferred TON to be returned.

One such case is when you want to deploy a smar...

one year ago
0 Does TON config update process require any action from the node owners?

TON configuration is the data for the Configuration smart contract. When an election is held and the vote to change a configuration is in support of the change, the config smart contract automatically changes the configuration data.

There is no need for any action from node owners. However, they might need to update their software from time to time, before an election is held which relies on the updates software.

one year ago
1 Should a P2E game has its own custom token (Jetton)?

Consider using TON Payments to minimize fees for lots of transactions:


one year ago
2 How to run integration tests without testnet?

You can use Sandbox to deploy multiple smart contracts and do the integration test.


one year ago
1 In FunC, is there an equivalent to Solidity's mapping?


Dicts can be used to store a map of keys to values. However, in TON, it's recommended to avoid storing unbounded dicts. That is dicts that grow dynamically as time passes. The use case that you described is a dynamic one. The reason to avoid it is that your storage grows, and as it grows you have to pay more and more to keep it on the blockchain.

To store a dynamic list, you have to break it into smaller parts. This is called sharding, and you can find more info about how to d...

one year ago
1 Can you explain the purpose of the "recv_internal" function in FunC? And what is the connection between FunC and Fift?

In TON, smart contracts are executed inside TVM (TON Virtual Machine). TVM expects instructions in a specific binary format, available here:


These binary instructions are like assembly code, and writing them by hand is very hard. At the beginning Fift was created as a scripting language to make it easier to write smart contract codes. It has a special syntax and working with it is easier than TVM instructions, but it's still very ...

one year ago
0 Is it possible to get server time in FunC?

If you mean the current transaction time when transaction is being processed and accepted in a block, then you can use now() in FunC.

one year ago
0 Why does FunC use ;; for comments?

I guess that's because of the way special characters like ?!:/ are accepted in variable and function names. If // was used for single line comments then at the end of lines without a semicolon, you had to put a space before them, or else they'd be treated as part of an identifier's name.

Semicolon is not allowed in identifier names and so it can be used without a problem as single line comments.

one year ago
0 How to check the current TPS on TON blockchain?

dton.io shows some stats on its homepage, including transactions per second.

one year ago
1 Is there a maximum storage limit for a smart contract?

Yes, the data should fit in the c4 register. c4 is limited to a depth of <= 512. Read more here:

If you use cells in a linear single ref tree, you are limited to 512 * 1023 = 523776 bits or near 64 KB. But if you use all cells to store data, it's a very huge tree with a lot of space. Only at the bottom layer it has 4 ** 511 cells.

one year ago
1 Why do some projects that accept TON coins require memo?

Sometimes, exchanges create a single wallet account, and use it to receive transfers of all their users. They need a way to distinguish between different users, and know who sent what fund to credit the correct account on their database. Memo is used here, and they assign a separate number to each user and ask them to use it when they transfer funds. Then they use this number to find the owner.

The other approach is to create a separate wallet for each user. This way, there is no need for ...

one year ago
1 What is considered "highload usage" for a wallet?

Regular wallets can send up to 4 transactions in each request. Since they need to sign seq_no, this limits them to 4 transactions every 5 seconds or so. If you need more bandwidth, for example a thousand transaction or more, you may use a highload wallet.

one year ago
1 Why are the highload wallets needed?

Regular wallets can send at most 4 transactions at once, and they need to sign the current seq_no. This in effect limits them to 4 transactions every 5 second, and this operation need to be serialized, meaning that there needs to be a single service sending these 4 transactions.

Highload wallets can send up to 254 transactions in a single request, and they don't need a seq_no. This way, they can send many transactions, multiple times without needing to wait between each batch, and ther...

one year ago
Show more results compactanswers