It will log to standard output of TVM. The way you execute TVM, determines the way output is generated or logged. So you have to run TVM with your smart contract and the input message, and then check the debug log. For example, if you use ton-contract-executor
, it will be available in debugLogs
field of the result.
Start with reading and understanding wallet v3 code here:
https://github.com/ton-blockchain/ton/blob/master/crypto/smartcont/wallet3-code.fc
Then maybe check wallet v4:
https://github.com/ton-blockchain/wallet-contract/blob/main/func/wallet-v4-code.fc
Then you may read NFT Collection and Item implementation:
https://github.com/ton-blockchain/token-contract/blob/main/nft/nft-collection.fc
https://github.com/ton-blockchain/token-contract/blob/main/nft/nft-collection.fc
Finally, J...
There is no float
in FunC, and TVM in general. Floating point numbers are useful in scientific calculations. Because they don't have exact precision, they are usually not that useful in applications working with money.
TON amounts like 1.234567890 are stored as a big integer of nano tons like 1234567890 and when displayed to user, they are divided by 1 billion in client side applications, so the user can view a more friendly and understandable amount. Other monetary values like jettons u...
In FunC you can use string literals with a
tag. For example: "Ef8zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM0vF"a
More info: https://ton.org/docs/develop/func/literals_identifiers#string-literals
Seqno is one way to prevent Replay Attacks. When a transaction is sent to a wallet smart contract, it compares the seqno field of the transaction with the one inside its storage. If they match, it's accepted and the stored seqno is incremented by one. If they don't match, the transaction is discarded.
Without seqno (or another mechanism to prevent Replay Attacks), anyone (usually the receiver of funds) can read the transaction data (for example from blockchain explorers) and create another...
Inactive means the wallet is not initialized yet, meaning that the code for the smart contract of your wallet is not yet deployed on the network.
This is not problematic, and you can use your wallet to receive funds on the network without initializing it first. Multiple deposits can be sent to your wallet. However, to withdraw, you need to first deploy it, and wallet softwares do this automatically on first withdrawal.
In fact, many wallets are initialized after their first deposit!
...
You can use the ICO version of Jetton smart contract which is available here:
https://github.com/ton-blockchain/token-contract/blob/main/ft/jetton-minter-ICO.fc
You have to change the multiplier for your jetton. For example, multiplying to 1000, means that 1 TON equals 1000 of your jettons.
Then you can deploy it and anyone sending Toncoin to it, will receive your jettons.
Note that this is a template and you have to add additional functionality on top of it, like stopping it when i...
Consider using another solution like PaymentChannels:
https://github.com/ton-blockchain/payment-channels
This way you can move the costly operation off-chain, and you can open the channel once for each user.
To develop smart contracts you need to at least learn FunC. In the process you might also learn Fift for a better understanding of how things work on a lower level.
To develop Telegram bots you can use many different general-purppose programming languages. There are a lot of options available here.
For the client side of dApps, you can use JavaScript or other tools that can generate a client side application.
You may use toncenter.com APIs:
Mainnet: https://toncenter.com/api/v2/jsonRPC
Testnet: https://testnet.toncenter.com/api/v2/jsonRPC
You can learn more here:
https://ton.org/docs/develop/smart-contracts/fees
Masterchain costs a lot more than basic workchain, like a thousand times.
It depends on many factors.
-
You have included the
initState
(that is the code and data of the wallet or smart contract) alongside your transaction. In this case the smart contract is deployed first, and then it handles the incoming message. This is similar to sending the transaction to an initialized account. -
No
initState
, andbounce
flag is set. In this case, the message cannot be delivered to a smart contract and the message will be bounced back to the sender. After subtra...
With a minor change, you can. In the while
loop, assign qRefs.store_ref
to qRefs
. In fact you don't need to keep references to the old builder. I would write it like this:
() save_data_on_update(slice destination_address) impure inline {
builder b = begin_cell();
b = b.store_slice(destination_address);
repeat (4) {
b = b.store_ref(begin_cell().store_uint(0, 1).end_cell());
}
cell c = b.end_cell();
set_data(c);
}