The following is from a test file in tonweb. Here's the entire file. https://github.com/toncenter/tonweb/blob/master/src/test-jetton.js
It should be enough for your needs!
const transfer = async () => {
const seqno = (await wallet.methods.seqno().call()) || 0;
console.log({seqno})
console.log(
await wallet.methods.transfer({
secretKey: keyPair.secretKey,
toAddress: JETTON_WALLET_ADDRESS,
...
When added to a liquidity pool protocol, a jetton is defined by supply and demand. If you are looking for a way to sell a jetton at a single fixed price, then you're likely looking for an ICO smart contract:
https://github.com/ton-blockchain/token-contract/blob/main/ft/jetton-minter-ICO.fc#L56
Where the amount of TON sent with the transaction is multiplied by some value of jetton to mint to the sender.
int jetton_amount = buy_amount; ;; rate 1 jetton = 1 toncoin; multiply...
There are plenty of projects out there to try. Here are 3 suggestions:
- Rock paper scissors game that require deposits to play (think about how to keep data private in between moves)
- Try deploying a custom Jetton (token)
- Try making a basic swap/IDO contract
Slices are the way to store strings. At the end of the day, strings are just a bunch of bytes that are interpreted in an ASCII format. You'll have to interpret strings as such when working with them in the smart contract.
https://ton.org/docs/develop/func/literals_identifiers#string-literals
You can define strings with quotation marks like in other languages, but they are stored in such a way that they become a slice of bytes.
This is a good suggestion for a dedicated step-by-step tutorial. I imagine that the TON community will focus on this in the coming months.
Here are some resources to help with creating NFTs:
- TON-NFT-deployer: created by TON Diamonds, this is a complete project that can help the technically minded developer deploy an NFT
- Disintar: an NFT marketplace for TON. You might want to look into here if you want...
You're looking for the dump_stack()
function.
https://ton.org/docs/develop/func/stdlib/#dump_stack
It dumps the last 255 values in the stack and shows the total stack depth.
() dump_stack() impure asm "DUMPSTK";
There's also the ~dump
and ~strdump
built-ins.
There is no such layer or toolkit. You would have to build such primitives yourself using the TON virtual machine and potentially FunC.
This post has JS code that does it as well as explanations how it all works: https://ton-community.github.io/tutorials/01-wallet/
You should be able to get the wallet address like so:
import { mnemonicToWalletKey } from "ton-crypto";
import { WalletContractV4 } from "ton";
async function main() {
// open wallet v4 (notice the correct wallet version here)
const mnemonic = "unfold sugar water ..."; // your 24 secret words (replace ... with the rest of the words)
...
The answer is likely "no". Smart contracts are for on-chain logic, and the server is off-chain. The actions taking place on a smart contract will not be determined solely by the TVM.
You could have a smart contract act as an interface for the server to listen to: for example, account A communicates with smart contract B, and sends an event to delete a file of ID C on server D. But there is nothing that guarantees that file C exists, or that the server D's logic will listen to B.
As far as I am aware, there are no complete user-friendly interfaces to create a DAO on TON. That being said, there are smart contract and repositories examples for you to potentially work off of.
Probably the closest to what you want:
https://github.com/orbs-network/dao-vote
Fift implementation of a multisig wallet:
https://github.com/mir-one/dao-multisig
There is a Telegram payments bot, but it has yet to integrate TON:
There are some community example projects of TON bots that accept TON payments:
https://github.com/Gusarich/ton-bot-example
https://github.com/LevZed/ton-payments-in-telegram-bot
But if you want something better, you'll have to develop one yourself. You can try starting here:
https://ton.org/docs/develop/dapps/asset-processing/
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...
I haven't heard of 10 video lessons, but I do know of the Ten Lessons GitHub repository for FunC. They have since then grown to 19 lessons.
Two issues:
- You should read address from slice via
load_msg_addr
, notload_bits
- Store address to builder via
Addr
, notaddr
addr
, is an alias for 256uint. Meanwhile full address serialization with Addr
also includes address format tag, workchain, 256bit part and some additional fields.
The documentation surrounding TON DNS is here:
https://ton.org/docs/participate/web3/dns
Its official site is here:
https://dns.ton.org/
I must stress that this is not the same DNS as what you would find when registering a .com domain address on a typical domain registrar. There is currently no ".ton" nameserver that can be connected to the rest of the world wide web. Instead, these are essentially nicknames for addresses. This is helpful because addresses are hard to memorize, bu...
It is definitely feasible to implement the logic of your game as a smart contact and then it’s guaranteed to be secure for all users.
Each transaction to change the game state will cost a few cents as gas. If this cost is an issue (for example your game has tens of thousands of transactions per player), then you can use payment channels to reduce this cost.
One of the interesting things mentioned is randomness, which is difficult in the Web3 space. A verifiable randomness function (VRF)...
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...
It really depends on the smart contract code. The standard for NFTs (TEP-62) does not include deletion, however.
https://github.com/ton-blockchain/TEPs/blob/master/text/0062-nft-standard.md
You could always just transfer it to the null address, or if that doesn't work, some other random address.
In JavaScript, you can use the ton
package. I have adapted an example from a community-led TON tutorial. Please use at your own risk.
What it does is:
- Generate multiple mnemonics
- Find the addresses of the generated mnemonics
- Fund the addresses of these mnemonics with a pre-funded wallet
- Send a transaction out of these mnemonnics to automatically deploy the contract
im...
The best solution is likely the TON Contract Executor. It allows you to run the TON Virtual Machine locally, and thus execute smart contracts. You should be able to debug and fully test contracts before launching them to the network. I don't believe it forks networks like HardHat can, however.
There is also MyLocalTON which is a community led solution that runs not only the virtual machine b...
There is such an operator; the documentation calls ita "conditional operator".
https://ton.org/docs/develop/func/statements#conditional-operator
This is the example provided:
;; <condition> ? <consequence> : <alternative>
x > 0 ? x * fac(x - 1) : 1;
It is possible to do this, but you would have to generate thousands of different private and public key pairs. I have yet to see one configured specifically for TON, though.
Essentially, you would generate thousands of random mnemonics and filter for ones that are like the parameters that you want.
You can generate key pairs with TonWeb:
const nacl = TonWeb.utils.nacl; // use nacl library for key pairs
const tonweb = new TonWeb();
const key...
The tl-parser utility can be found here:
https://github.com/vysheng/tl-parser
You'll have to compile and install it, but the bash script should work afterwards.
You likely can. Just use:
pip install pytonlib
If that doesn't work, you can try a community member's python version of tonsdk.
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...
This can be caused by outdated config files. Ensure that you've downloaded the right ones and are using them.
The code is law, and the law says no. I imagine that this is to ensure that domains are held by people who are "alive".
Here is the code for reference.
if (op == op::dns_balance_release) { ;; release domain
throw_unless(414, (now() - last_fill_up_time > one_year) & (cell_null?(auction)));
int min_price = get_min_price(domain.begin_pars...
The official TON documentation can be found here:
https://ton.org/docs
If you're getting started with TON, a recent tutorial has been made available here:
https://ton-community.github.io/tutorials/01-wallet/
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...
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;
}