Reputation
Badges 5
Editor Freshman Enthusiast Supporter NewbieThere are two parts to this question. The first is ensuring that you don't encounter the "out of gas" error.
You can try to estimate a transaction's gas fee by first calling the http-api's estimateFee endpoint. You can see how TON Center does it on their documentation site. Essentially, you want to provide details about the transaction that you will send to see how much gas the transaction could cost or if it will fail.
...
I believe this question was more or less answered in another question by
Vladimir Plotvinov. You can view it here:
https://answers.ton.org/question/1538089852979908608/
For sake of visibility, I'll repost his answer:
You recieve a "-13" exit code. API called lite-server and receive some result it's why you got 200 OK. -13 exit code I would say it means method_id not found on smartcontract (but I can't find this remark in documentation).
You can use send_raw_message(cell msg, int mode)
within the smart contract to act as the deletion of the smart contract.
This is because mode 128 will "carry all the remaining balance of the current smart contract instead of the value originally indicated in the message", essentially removing all of the TON from the smart contract. Mode 32 will cause the "current account must be destroyed if its resulting balance is zero", wh...
You can use the raw address: 0:0000000000000000000000000000000000000000000000000000000000000000
Just make sure that you turn off the bounce flag, whose address is: UQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJKZ
I used the TON address converter to help answer this question: https://ton.org/address/
A source of randomness is required, and there are plenty of ways to do it: https://docs.ton.org/ko/develop/smart-contracts/guidelines/random-number-generation
A basic version of a lottery script exists here, which uses the randomize_lt
function:
https://github.com/pyAndr3w/ton-lottery-smc/blob/main/func/code.fc
You can use store_ref(b, c)
: https://docs.ton.org/develop/func/stdlib/#store_ref
It stores a reference to cell c into builder b. You should be able to use references to store any amount of cells, but for a single cell there can only be 4 refs. This still allows for a tree of cells to read from.
https://answers.ton.org/question/1539108146436378624/does-store-slice-act-like-store-ref
If you mean the blockchain nodes themselves, then nodes will not display this data. This is really a market question, not a question that the blockchain protocol itself should answer. Every market has their own answer to what the price of TON is, and arbitrage will slowly balance it out.
There are services that aggregate many markets' prices together to get a simple answer for you, though. tonapi.io does allow for this:
https://tonapi.io/v2/rates?tokens=ton¤cies=usd
...
Yes, anyone can deploy a Jetton. Jettons are just smart contracts, similar to ERC-20s on Ethereum. The network wouldn't be very decentralized if that wasn't the case!
Technically, there is no "official" deployment of ETH because anyone can create their own bridge and their own ETH token. So it's up to you to do the research to figure out which Jetton smart contract is the best to use as your ETH representation. That being said, ton.org currently uses the [TON Bridge](https://bridge.ton.org...
That website has a good example of how to connect to multiple types of TON wallets, unfortunately the frontend is not open source!
By login, I assume you mean connecting to the site, not necessarily having a backend account system like you would in Web2. That is a different question that can be answered in a different way.
What you're looking for is likely TON Connect! They provide ways to connect wallets to a frontend through their SDK. You can connect...
Refer to TIP-62 and the get_nft_content
option which should return the "full" metadata:
This is the right track, you do need to check 0
. And you are loading in op
correctly. But the way that you work with the comment is incorrect.
The characters are coded within UTF-8, so using load_uint
will not work as expected, since it expects binary encoding.
Instead, you will have to parse it:
() recv_internal(int balance, int msg_value, cell in_msg_full, slice in_msg_body) {
int op = in_msg_body~load_uint(32);
if (op == 0) {
;; load in the first 8 bits b...
There is a difference between technically possible and realistically possible. As long as you fulfill all of the tech requirements of a validator, then yes you could technically run a validator.
However, a realistic long-term solution requires a proper server and a data-center. Consumer PCs are not designed for such workload and stability. You do not want to pay for downtime with your TON stake.
As of version 3.0:
- Go to the "Settings" menu
- Rapidly tap the "Version" value at the bottom of the settings. 5 quick taps should open up the Dev Menu.
- Click "Switch to Testnet"
- Select "TESTNET"
I believe the now
field will help you. For example:
const buyResult = await buyer.send({
to: sale.address,
value: price + toNano('1'),
sendMode: SendMode.PAY_GAS_SEPARATELY,
now: 1682370000
})
As a Solidity developer, one of the best articles for you to understand the differences between the EVM and the TVM is:
https://society.ton.org/six-unique-aspects-of-ton-blockchain-that-will-surprise-solidity-developers
This is a very good introduction. Afterwards, the whitepaper is where you will have to go along with the developer documentation.
Here is one example of how the Kotlin package does so:
import org.ton.crypto.base64
import org.ton.crypto.base64url
fun convert(address: String): String {
val raw = try {
base64url(address)
} catch (E: Exception) {
base64(address)
}
return raw;
}
While there isn't anything as robust as the tools that you've described, I do believe that there are a couple of tools that can help you along.
The first is ton-indexer, which doesn't have an official graphical interface yet but can be used for analyzing and querying blockchain data in a way that a typical endpoint cannot.
The next is Blueprint, which can act as your test environment to replay transacti...
As far as I am aware, FunC and the other languages do not have a logo yet. FunC is a very niche language that has a small community of developers, and has yet to adopt true branding.
All branding related to TON can be found on its website:
Non-bounceable messages will allow coins to stay on the contract's side. This is used on a wallet's deploy, when passing state initialization.
It depends on whether or not a transaction is internal or external.
If a transaction is internal, it depends on the bounce flag. If the address that the internal transaction is directed to is bounceable, then that 10 TON amount minus gas will be returned to the original address. The transaction will still be recoreded in the blockchain.
If a transaction is external, then it depends on the accept call in the code. If the t...
You are likely referring to the tondev
tool which has since been renamed to everdev
. While both Everscale and TON use the TVM, they are in reality different blockchains that have since gone their separate development paths. You cannot use the tondev
or everdev
tools to deploy a smart contract to TON.
I recommend using the Blueprint tool at ton-community/Blueprint...
If you are anonymous on Ethereum, then you can buy wrapped TON on Uniswap and bridge them over.
A boc is not limited in size, in fact the whole blockchain state is a cell with a bunch of cells wrapped within them. Everything is a cell!
An external message is limited by 64kb, which may limit the size of a boc that you're trying to create with your smart contract logic. You can see this defined in the lite client, but it is subject to change:
For users who are unfamiliar, TON Proxy is the "entrypoint" for conencting with the TON Network's sites. The website has some documentation here:
https://docs.ton.org/participate/web3/setting-proxy
Generally, the idea is to connect to one of the public entry TON Proxies:
in1.ton.org:8080
in2.ton.org:8080
in3.ton.org:8080
And then add a manual HTTP proxy to your browser/device with said proxy.
If you want to learn how to set up your own proxy, the documentation i...
Here are two open source wallets:
- TonWhales - iOS/Android
- MyTonWallet - iOS/Android/Chrome
Additionally, the staking contract is open source for you to interface with in any way you desire.
There are two ways. The first, currently experimental, allows you to run locally. Don't do this for production:
pip install ton-http-api
source ~/.bash_profile
ton-http-api
The second is through Docker:
mkdir private
curl -sL https://ton-blockchain.github.io/global.config.json > private/mainnet.json
curl -sL https://ton-blockchain.github.io/testnet-global.config.json > private/testnet.json
./configure.py
docker-compose build
docker-compose up -d
...
You can use the tonweb-contract component of the TonWeb package.
First, create your contract class:
import {Contract} from 'web3-eth-contract';
export class MyContract extends Contract {
constructor(provider, options) {
// insert the bytes of your code here
options.code = hexToBytes('abcd..');
super(provider, options);
// add definitions of the functions of the contract
this.method.myMethod = ...
}
// @override
...
One way that might be helpful is through an indexer: https://github.com/tonindexer/anton
You could get information by running a query on the indexer like this, which gets information for address EQDYo6otRICNYyM2SAcS1mzTUvm1dsN5LCteE7DjeYfKgA4C
:
https://anton.tools/api/v0/accounts?latest=true&interface=nft_item&owner_address=EQDYo6otRICNYyM2SAcS1mzTUvm1dsN5LCteE7DjeYfKgA4C&minter_address=EQAOQdwdw8kGftJCSFgOErM1mBjYPe4DBPq8-AhF6vr9si5N&order=DESC&limit=10
This can be caused by outdated config files. Ensure that you've downloaded the right ones and are using them.
Unfortunately, the TON http-api does not allow you to specify a block when using getAddressBalance.
https://toncenter.com/api/v2/#/accounts/get_address_balance_getAddressBalance_get
I suppose one way you could go about it is reconstructing the balance over time. Get all of the transactions until the block you're looking at is surpased:
https://toncenter.com/api/v2/#/accounts/get_transactions_getTransactions_get
You can try this with the getTransactions endpoint, just make sure t...