TON_Learn:Lesson 17 Selling NFTsIn this lesson, we'll cover:- NFT Sale smart contract- NFT Mark
:
Lesson 17 Selling NFTs
In this lesson, we'll cover:
- NFT Sale smart contract
- NFT Marketplace smart contract
- how to burn a contract after it is no longer needed
The lesson is built from conceptual to detail, I think the next analysis of contracts will be the same.
Links: ENG | RU
P.S. The author went on vacation and rested, so there will be a lot of content in the near future).
18 Lesson Hacking Simple Smart Contract
I decided to analyze the tasks from the last hack challenge in order to collect lessons on the vulnerability of smart contracts.
In this tutorial, we'll look at how compiler optimization of a smart contract can lead to a vulnerability.
ENG devto_link
RU habr_link
Important! This article is a great entry point for new people to TON, so I will be very grateful if you support the articles on the sites with your upvotes, this way you will help bring new cool people to TON).
Crypto Story: How Sam Bankman-Fried, who lost $17 billion in the FTX crash, made his first million and what does Kimchi have to do with it
The story of the fall of the FTX crypto exchange has been thundering over the past few weeks. And of course, all eyes are on the head of the FTX: Sam Bankman-Fried.
But in the history of any millionaire, the most interesting thing is how the first million was earned, and that's what today's article is about:
ENG Link
RU Link
What are reserve currencies in crypto and how does it work
Most categories of projects with TVL are clear in their name.But there are also those categories of projects that cause problems with understanding. One such category is reserve currencies/protocols.
Consider:
- what are reserve tokens
- what mechanisms allow to stabilize the price
- which leads to possible high APYs
- why critics think it's a Ponzi scheme
P.S Perhaps we will see such tokens on TON in the future
LINKS: RU | ENG
Web3 Social Apps: Next Generation Social Networks vs Web2 Goliaths
The idea of tokenizing social networks is not new, and the goals of Web3 Social applications to give users back power over their data sound too idealistic, but the trends of recent years are causing interest in the Web 3 Social area.
Consider:
- trends in social web3 apps
- what is social decentralized graph
- how companies are trying to ride the wave of new social trends
- what Web2 Problems Give Web3 Growth Opportunities
LINKS: ENG | RU
Requests to the TON blockchain using JS: How to fetch NFT data
Often Web3 applications or Dapps look architecturally like a Frontend that invokes smart contract methods. Accordingly, you need to be able to make requests for JS in the blockchain. There are few JS examples in TON, so I decided to make a small visual tutorial.
LINKS: ENG | RU
How to built an app with authorization in the TON blockchain
An important part of decentralized applications is authorization using a crypto wallet. In this tutorial, we will step by step collect authorization for the TON blockchain using tonconnect/sdk.
LINKS: ENG | RU
P.S In the second part, we will look at how to send transactions using a connected wallet and expand on our example.
Nasty situation with TON grant/ Мерзкая ситуация с грантом в TON
RU:
(In eng below)
Я не планировал делать посты в канале ближайший месяц, так как буду перезапускать канал - да, приготовил кое-что интересное... но неприятная ситуация заставила написать.
В марте мы с товарищем решили сделать какой-нибудь полезный проект в сети TON. Проведя анализ, решили сделать библиотеку на Dart для TON, таким образом сделав TON удобным для для разработчиков кроссплатформенность приложений на Flutter.
Расписав подробно шаги, мы подались на грант. Гранты в тон бывают трёх типов: ОЧЕНЬ большие), средние до 50000$ и маленькие до 5000$(также их называют Footsteps). Footstep одобряют быстро и делает это один человек, средние гранты оценивают несколько человек и по итогу выноситься вердикт.
Мы подали грант в конце марта: ссылка. 20 апреля (да прошло куча времени) получаем первый комментарий - “seems legit..” И так далее. И вот мы уже готовы делать библиотеку и ждём финального апрува….
28 апреля приходит финальное заключение - проект лучше подходит под Footsteps, грант отклоняют, но very welcome в Footsteps).
Захожу я в footsteps и вижу, что кто уже подал наш проект на footsteps с меньшим скоупом работы ровно за день до того как нам пришло финальное заключение и сразу же получил аппрув.( день в день и никаких обсуждений скоупа или суммы выплаты итоговой как это обычно бывает - согласитесь как-то странно).
Конечно же идея не является уникальной, и никаких доказательств, что ребята сначала посмотрели в гранты, нашли проработанную идею, уже помеченную как legit и задемпинговав перенесли её в Footsteps, но тем не менее ситуация какая-то мерзкая… и этим постом я хочу предостеречь читателей, если вы планируете делать что-то связанное с грантами на TON советую подумать, что будет если вашу заявку на грант зареджектят и параллельно скопируют.
P.S через месяц в этом канале начнут выходить посты про технические аспекты криптовалют, туториал и любопытная) аналитика, надеюсь вам понравится 🥺
ENG:
I did not plan to make posts in the channel for the next month, as I will restart the channel - yes, I prepared something interesting ... but an unpleasant situation forced me to write.
In March, my friend and I decided to make some useful project in the TON network. After analyzing, we decided to make a library on Dart for TON, thus making TON convenient for developers of cross-platform applications on Flutter.
Having painted in detail the steps, we applied for a grant. Tone grants come in three types: VERY large, medium up to $50,000, and small up to $5,000 (also called Footsteps). Footstep is approved quickly and is done by one person, average grants are evaluated by several people and a verdict is issued as a result.
We submitted to the grant at the end of March: link. April 20 (yes, a lot of time has passed) we get the first comment - “seems legit ...” And so on. So we were ready to start developing and were waiting for the final approval….
On April 28, the final conclusion comes - the project is better suited for Footsteps, the grant is rejected, but very welcome in Footsteps).
I go into footsteps and see that someone has already submitted our project for footsteps with a smaller scope of work exactly one day before we received the final conclusion and immediately received an approval (to the day and no discussion of the scope or the amount of the final payment, as is usually the case - agree somehow it is strange).
Of course, the idea is not unique, and there is no evidence that the guys first looked at grants, found a well-developed idea, already marked as legit and dumped it transferred to Footsteps, but nevertheless the situation is kind of vile ... and with this post I want to warn readers, if you are planning to do something related to TON grants, I advise you to think about what will happen if your grant application is rejected and copied in parallel.
P.S in a month, this channel will start publishing posts about the technical aspects of cryptocurrencies, a tutorial and interesting) analytics, I hope you enjoy it
End of the Grant Situation/Концовка ситуации с грантом
ENG:
(In RU below)
After the situation from the previous post, I contacted the guys in charge of TON Footsteps. And they said they would improve communication between those responsible for the grants and those responsible for the footsteps so that this does not happen.
In parallel with this, Mark wroke to me, he seems to be a devRel in TON, and offered to make a footstep on DART via TON Connect. Actually, here is a library that will allow you to create authorization on TON for cross-platform applications on Flutter.
Well, I wouldn’t be me if I didn’t make tutorials on the library that the team and I developed:
ENG LINK
Also there is the example.
P.S I am very pleased that TON reacted to the situation in such a way, because regarding the ecosystem, I'm just a regular developer
P.P.S The channel will be restarted on the first of July
RU:
После ситуации из предыдущего поста, я списался с ребятами отвечающих за TON Footsteps. И они сказали, что улучшат коммуникацию между ответственными за гранты и за футстепы, чтобы такого не происходило.
Параллельно с этим мне отписался Марк, он вроде как devRel в TON, и предложил сделать футстеп на DART по TON Connect. Собственно, вот библиотека, которая позволит вам создавать авторизацию на TON для кроссплатформенных приложений на Flutter.
Ну и я бы был не я, если бы не сделал туториалы по библиотеке, которую мы с командой разработали:
RU LINK
Плюс есть пример.
P.S Мне очень приятно, что в TON так отреагировали на ситуацию, т.к. относительно экосистемы я просто обычный разработчик
P.P.S Перезапуск канала будет первого июля
🎬 TON Learn new season
After writing about 15 TON tutorials, I told myself no more tutorials😵💫:
- you have to collect information bit by bit: reverse engineering of open source projects, search for information smeared with a thin layer according to documentation
- the topics of the TON tutorials are narrow, and a lot of effort and time invested bring little results
- when publishing tutorials or articles about the technical side of crypto, you come across a negative. Blockchain is perceived by many not as a technology, but as some kind of endless scam
But on the one hand🫲, spending time looking for some ideas for projects or just figuring out for myself how it works, I have accumulated a lot of code examples and notes.
On the other hand🫱, the technical side of TON has some elegance, which we are gradually acquiring with convenient development tools, which were sorely lacking a year ago.
Therefore, I realized that I wanted to update the lessons so that they were written for new convenient development tools🛠. And also add articles that would turn the FunC lessons into a full-fledged TON course covering the main topics for beginners.
Therefore, the followingarticles will be published on the channel:
- Development of smart contracts in the blueprint environment, we will figure out how to compile contracts, how to write jest tests inside, we will figure out how to consider transactions inside and write on chain tests
- We will figure out how to receive data from TON without an intermediary via ADNL protocol
And consider the patterns of working with the c4 register through global variables, as well as convenient patterns for working with the balance of a smart contract
- A couple of tutorials for TON Connect React UI to understand how to make a simple ui for your smart contract in 10 minutes
I call the block of articles described above a season 🍂, gradually accumulating information, I will be releasing such technical seasons.
Between seasons, I will write my notes about TON and blockchain technology in general(for example, over the past 4 months, I have gained a lot of experience in getting data from TON and I have something to show you).
Under the articles will be twitter 🧵 threads🧵, I will be glad for your support there.
🧵 Thread 🧵
Smart Contract Pipeline Part2 - Tests for our smart contract
A year and a half ago, writing tests for smart contracts on TON took many times longer than writing the smart contract itself 🤯. You had to do a lot of low-level work.
In the blueprint was decided not to reinvent the wheel and tests are written using the Jest framework 🛠, there are utilities for convenience: https://github.com/ton-org/test-utils
This approach speeds up development at times, I'm sure you'll like it:
RU LINK | ENG LINK
If you would like to support the release of articles, I would be grateful if you repost the twit thread about this article, it will help to show it to more people.
🧵 TWIT 🧵
TON Smart Contract Pipeline Part 3 - Convenient deployment to the test network
It's time to deploy a smart contract so as not to do low-level things, I offer you a convenient option:
1️⃣generate QR code with deploy payload
2️⃣scan it with your wallet
3️⃣confirm the transaction
...
🤩Smart contract on the testnet!🤩
RU LINK | ENG LINK
if you would like to support the release of articles, I would be grateful if you repost the twit thread about this article, it will help to show it to more people.
🧵 TWIT🧵
NFT wash trading in Telegram Usernames
The lack of normal regulation of the crypto market makes it a testing ground for all possible scam mechanics. A 2022 study showed that about 45% of the volume of NFT blockchain EVM transactions are part of the wash trading.
Given such a large percentage, I became interested in how things are with TON and I decided to apply filters from the study to find wash transactions in the largest TON NFT collection - Telegram Usernames
NFT laundering is the resale of NFTs between controlled wallets for subsequent profit, you can read more about this in the articles below.
To search for money wash transactions, we will use the hildobby method, which consists of four filters, which we will discuss below.
The data source will be the dton.io indexer, from which we will receive information. I note that the results in this article are relevant as of 08/24/2023, but they can always be updated through the script.
In total, as of 08/24/2023, there were 109158 sales in the TG Usernames collection with a volume of 57143316 TON, which is about $80,572,075 as of the date.
Let's move on to filters:
Filter 1: Buyer = Seller
Reselling a collection element to itself is clearly unnatural behavior. Therefore, the first filter looks for deals where the seller is equal to the buyer when selling NFTs. The results are as follows:
Filter 2: Back & Forth Trades
You can resell items not only between the same wallet, a simple strategy is to trade the same NFT between two different wallets, sending it back and forth.
Filter 3: Bought NFTs 3x
Since some unscrupulous NFT sellers create chains to resell items, there are money laundering deals that bypass the previous filters. Therefore, it is convenient to consider all transactions where one and the same owner repeats one and the same owner three or more times as money laundering.
The author of the technique emphasizes that this filter is not optimal, but the importance of this filter outweighs its disadvantages.
Filter 4. Buyer & Seller First Funded by Same Wallet
To save time, wallets used for fictitious trading are often funded by the same wallet or each other. The filter will check each buyer and seller for who sent them the first transaction.
If it is the same wallet (or different), then it is marked as a laundering trade.
Total Result:
Total sale in the collection: 109158
Transactions that fell under the filters: 3957
Percentage from all deals: 3.63 %
Filter trade Volume: 592680 TON ~ 835678 dollars
Percentage from Total Sales: 1.04 %
You can read more about the methodology and wash trading + Percentages by each filter:
ENG LINK
RU LINK
Link to a script that can be reused for other collections:
Github LINK
!Attention!, the code is not optimal, improve if you want
Writing such technical articles is not another repost of news or advertising of scam projects, it is quite difficult and labor-intensive, I will be grateful if you support by liking the article, send this post to someone who is interested and support by reposting or liking this article on Twitter:
🧵 Thread
Smart Contract Pipeline Last Part - Chatbot Smart Contract and On-chain
In addition to tests in the sandbox🛠, you can write tests on the test network, these can be the most ❗️important❗️ tests that you need to run before bringing contracts to the main network.
But there are also cases that cannot be tested in the sandbox. Let's take a look at the tutorial below:
1️⃣ smart contract chatbot
2️⃣ how to watch transactions in the sandbox
3️⃣ write on chain tests
RU LINK | ENG LINK
I will be grateful for your support on the sites, your every like and up is important!
How to find popular NFT collections in the TON blockchain - ranking collections using the dton.io indexer and Python
When trading any asset, you need to understand the current state of the market, and for NFTs this is no exception. In this tutorial, I will show you how to collect information on sales volume by collection over the last 24 hours in the TON blockchain.
Why is this necessary?
Let's say we want to purchase an NFT for further resale, which, roughly speaking, is important to us:
1️⃣Increasing price - in order to resell it for more than what we bought
2️⃣Liquidity - so that if the price rises, a buyer can be found
If we move away from general words about liquidity and price growth, then the algorithm could be as follows:
1️⃣Understand the current general state of the market and specific blockchains
2️⃣Find out which collections are currently popular on this blockchain
3️⃣Analysis of certain collections - historical floor, sales history, number of unique owners, etc.
4️⃣After choosing a collection, look for undervalued items in them to purchase
Of course, this is not the only strategy - you can look at what collections are on the go or what whales are buying, but still, the step of reviewing the state of the market and searching for popular collections is now difficult to skip in order to understand the overall picture. But we'll talk about this later.
⬇️Tutorials⬇️
Tutorial link ENG
Tutorial link RU
Google Colab with code
marketplaces, there are blocks where NFTs put up for sale are displayed and it is the price in these blocks that they try to hook - so that visitors to marketplaces become interested in what kind of collection this is, where NFTs are put up for sale for 1,000,000 TON.
How did I want to fix this?
Knowing how smart contracts for selling NFTs in TON work, you can simply leave only those transactions with op == 2, thus canceling sales op == 3 and op ==1 accumulating TON for purchase will no longer be in the list, BUT there is another option….
How I fixed it:
You can also cut off some of the wash trades and cancellations of sales by checking that the owner changed during the sale of NFT (prev_owner != new_owner), thus the resulting Ranking will reflect the real picture of sales. I changed this on the website:
https://tonlearn.tools/#/ton-nft-sales-volume
Bonus:
To prevent the post from being boring, I added on tonlearn.tools, for the curious, what will be discussed in the next post.
https://tonlearn.tools/#/ton-toncoin-whales
How to find the richest wallets in the TON blockchain - get data from the dton.io indexer and Python
News about rich people and investments of large funds are always on the front pages📰. People are interested in what people with large capital buy and invest in📈.
Blockchain allows you to satisfy curiosity on a new level, because all information is publicly available in full. In this article I will tell you how to get 🐳 wallets of the TON blockchain using a request to the dton.io indexer.
We’ll also talk about how you can simply enrich your data. An example of what we get at the end can be seen here:
https://tonlearn.tools/#/ton-toncoin-whales
ENG LINK
RU LINK
In the next tutorials we will add what percentage of TONcoin whales own from the total supply of TONcoin and cumulative.
For starters, I’ll note that the top 100 wallets have 35.5 percentage of total supply for today(If we subtract the ecosystem reserves,Locker and exchanges).
I will be grateful for your support - every like and repost helps tell more people about the TON ecosystem!
Purchases of Telegram Usernames made by Pavel Durov using Python and the dton.io indexer
Why is it necessary?
Recently, a lot of attention has been paid to Telegram CEO Pavel Durov’s NFT purchases:
▪️Before the appearance of group stories in telegram with boost mechanics, Pavel buys Telegram Username boost
▪️On September 25, Pavel buys fabrika and a week later connects it to the bot of the Friends Factory project
Well, just a treasure trove of insights
How do we know that Pavel's wallet
The wallet was identified by the username nerd when it was found on a possible account of Pavel Durov, onetimeusername.
Information about this can also be found in the list of known Tonkeeper wallets
Problem viewing wallet through explorers
If you want to look at Pavel’s wallet through an explorer, it will be difficult to find interesting information; every day a lot of spam transactions fall there and a lot of tokens and NFTs are transferred there for PR of their projects.
Therefore, it would be interesting to see information about TG usernames separately.
Result: https://tonlearn.tools/#/pavel-durov-telegram-usernames
Links to tutorials
LINK ENG
LINK RU
In the following posts we will look at other TON whales, and also add information not only on NFT purchases)
I will be grateful for your support - every like and repost helps tell more people about the TON ecosystem!
Circulating vs total supply
Is 1,000,000 TON a lot or a little?
Any discussion on this topic comes to the question - relating to what? For example, how much is this relative to the whales from the previous post?
In the stock market, market capitalization is used for comparison - the value of an object calculated on the basis of the current market (exchange) price.
CoinmarketСap bases its ranking of blockchains based on market capitalization. Therefore, if you hear that TON has risen to another place, this means that its capitalization has increased relative to other blockchains.
There are many nuances in calculating capitalization, but in the end it all comes down to:
Market Cap = Current Price x Supply
The price is understandable, but what to charge for the supply. Let's see what we have:
Total supply = the number of coins in existence, i.e., the number of coins that were already issued minus the coins that were burned. The total supply is basically the sum of the circulating supply and the coins that are locked up in crypto types of escrow.
Circulating supply = the number of cryptocurrency coins or tokens that are publicly available and circulating in the market.
To calculate capitalization in cryptocurrencies, Circulating Supply is used, since the market value is reflected by assets on the market, and not somewhere in a lock for three years)
Crypto Market Cap Supply= Current Price x Circulating Supply.
It is analogous to the free-float capitalization in the stock market.
Therefore, to make it clearer what the whales own, I added to the site the percentage from Supply:
https://tonlearn.tools/#/ton-toncoin-whales
P.S Today is a short post - the author is on vacation, but in a week we will continue with x5 effort)
TON DEX PnL Calculator
This week, I wanted to publish an article about Onchain Token Audit with tutorials, but while dton.io is moving to new servers, let's talk about PnL.
What is it and why is it needed?
DEX PnL calculator allows you to see how much profit or loss wallet received when trading certain tokens.
This allows:
- understand which tokens are more profitable to trade
- look at other people’s trading strategies
- evaluate real results, not advertising about 100x
What is the problem with the calculation?
Tokens are bought and sold at different times, with different TON prices, the price of TON is also not stable. Also, not all tokens can be sold, how to count them then.
I put together such a DEX PNL calculator for TON, transactional calculation based on realized PnL for StoneFi (what this means is described below)
LINK: https://tonlearn.tools/
Now let's look at what this means:
Realized/Unrealized PnL
Realized PnL
profits from an investment you've made
Realized PnL = Entry price - Exit price
Unrealized PnL
potential profit you can make from held investments
Unrealized PnL = Entry price - Current price
Okay, what date should I take the price for?
First-in, first-out
The purchase price is taken at the time of the first purchase, and the sale price at the time of sale, for example:
Suppose Alice first bought 1 TON at $1,100 and a few days later bought 1 TON at $800. A year later, he sold 1 TON at $1,200.
Alice's initial cost = (1 TON x $1,100) = $1,100
Current market value = (1 TON x $1,200) = $1,200
FiFO PnL = $1,200 - $1,100 = $100 (profit)
Last-in, first-out
The LIFO method requires the seller to use the most recent purchase price of an asset in the calculation. Using the same example as above:
Alice’s initial cost = (1 TON x $800) = $800
Current market value = (1 TON x $1,200) = $1,200
PnL = $1,200 - $800 = $400 (profit)
Weighted average cost method
Means to calculate the weighted price for each purchase. For our example:
Weighted average cost = ((1 TON x $800) + (1 TON x $1100)) / 2 TON = $950
Current market value = (1 TON x $1200) = $1,200
PnL = $1,200 - $950 = $250 (profit)
Transaction-based
A transaction-based calculation requires a person to calculate the PnL for each specific transaction.
Realized PnL = - $1,100 - $800 + $1,200 = -700$
P.S This is still an MVP, but I will be glad if you try it, especially if you have transactions through Stonefi and you can check the service in your wallet. I will add other Exchanges as soon as i have time.
TON Jetton Audit Series Part1 - Supply and Bubble Charts
Often in the crypto world, the words decentralization and smart contracts are just a shell for scam or, to put it mildly, dishonest schemes.
You can hear Do Your Own Research - do research, but an ordinary person, not a venture capital firm with a staff of analysts, cannot spend so much time on analysis.
What can be done?
Without canceling DYOR, we can try to find an indicator/dashboard that, with 20% of the effort to study, will give 80% of the result - information about the token.
What kind of indicator? - I propose to consider the distribution of the supply of tokens.
Let's look at the cases:
1) Manipulations with floor and NFT volume
NFT buyers often focus on floor (the lowest price of a collection) and collection volume - dishonest sellers influence these indicators by reselling NFTs between a pair of wallets.
If you display resales on a dashboard relative to the overall distribution, such manipulations will be immediately visible.
2) Concentration of 25% of fungible tokens in one hand
The creators of tokens often flaunt a large number of token transactions, look, they use our token, although often it is simply transferring tokens between a pair of interconnected wallets - the token ecosystem is active, but the real owner is actually one...
3) Fake DAOs
An important part of a DAO is voting management - it is important to understand whether the voting will be real or just legitimizing the decisions of a couple of people. If a couple of people own almost the entire supply, it is not a DAO.
You will say, this is certainly cool, but going through a bunch of wallets will take a lot of time…
Bubble charts come into the picture
The best way to visualize token distribution is with a bubble chart; this will allow you to quickly see suspicious patterns.
In this tutorial we will put together a script that will chart the top 100 wallets by balance for any Jetton in the TON blockchain!
ENG LINK | RU LINK | Colab
I will be grateful for your support - every like and repost helps tell more people about the TON ecosystem!
RedsTONe Oracles - what to do about it?
Recently, news appeared about the partnership between the Redstone oracle and the TON blockchain. The emergence of such an oracle should open up opportunities for creating new projects on TON.
But what can be created using oracles?
If we discard, scam things like lotteries and guessing crypto prices,it turns out that the ideas do not lie on the surface. You have uploaded some external information to the network and what next?
Therefore, in this article we will look at what patterns there are for using oracles in the blockchain. To later make tutorials on this topic in TON.
LINKS: ENG Article | RU Article
I will be grateful for your support - every like and repost helps, since the topic of blockchain is difficult to perceive
@ton_learn | twitter | buy TON and jettons
TG Usernames - What to buy at TON?
Telegram Usernames is a top NFT collection with clear utility
But which usernames can be resold profitably in this collection?
To answer this question, I parsed all transactions over the past six months.
Next, I took from there transactions where:
- there was a change of address of the owner (which means resale)
- price >120 TON (we are looking for how to make money).
Everything is simple here - swear words and other prohibited on tv words
One of the top resale : slut - 10000 TON
11) Celebrity - 19
In this cluster, full names are rarely found; resales occur for some short names that are associated with celebrities
TOP resale: musk - 9 088 TON
I think you will be interested in reviewing them
I
analyze their transactions. Let's see what came of it.