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
Answered
TON supports multiple workchains - which one should I use in my code?

According to TON whitepaper, the TON blockchain network supports multiple chains.

What's the differences between these and which workchain should I use when deploying contracts or reading data from contracts?

When deploying my contract I must to specify which workchain I’m working on, I’m not sure which value to put there:

import { contractAddress } from "ton";

const workchain = ?;
const newContractAddress = contractAddress({ workchain, initialData: initDataCell, initialCode: initCodeCell });
2
2
Posted 2 years ago
Edited 2 years ago
Tal Kol
359 × 3 Administrator
Votes Newest

Answers


TLDR

For regular user work, always use workchain 0 - which is the workchain with workchain_id = 0

What are the different chains in TON?

  • One master chain - the special unique workchain with workchain_id = -1

    Mostly used by network validators for running the PoS elections contracts, regular users don't normally send transactions on this chain.

  • Up to 2^32 workchains - today there's only one with workchain_id = 0 but possibly more in the future

    99.9% of user transactions on TON take place on workchain 0, this is where you should work unless you know exactly what you're doing.

  • Up to 2^60 shardchains per each workchain (they all have the same workchain_id)

    This is an internal implementation detail of TON's infinite sharding (autoscaling). If any of the workchains is under heavy load, it will be split automatically to two shardchains and when the load is reduced, it will be merged back. You would normally not care about this, it happens under the hood. When you deploy contracts or send transactions you don't need to specify the shardchain you're working on, it's calculated by the system automatically.

3
3
Posted 2 years ago
Tal Kol
359 × 3 Administrator
22K Views
1 Answer
2 years ago
2 years ago
Tags