TON_Learn:TON DEX PnL CalculatorThis week, I wanted to publish an article about Onchain Token Aud

9WVo...L3cQ
27 Apr 2024
64

TON_Learn:
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!

Jettons Ranking

In the last article it was supposed to enter the address of the master contract, but in general how are Tokens available in the TON network and how can they be compared?

It is convenient to compare large companies and blockchains by capitalization - the market price reflects the asset well, since it is located in a large and competitive market, which means the laws of supply and demand work well = capitalization reflects the state of affairs.

But for such high-risk assets as Jettons, utility comes to the fore. Since it answers the question - why is this necessary at all? What does this number in the jetton wallet give?What are the use cases?

The first approach to assessing the utility of Jettons may be the presence of transactions with it, everything is simple - if the token is used in an exchange, there is a demand for it.

But where there is demand, there is also supply, so it is also important to take into account the distribution of the Jetton supply among wallets - so that two wallets do not create a million transactions between themselves, increasing the volumes.

To start your own research, we have put together a dashboard:

https://tonlearn.tools/#/jetton-dash

It includes Jettons that are recognized by the Tonkeeper wallet and have a sufficient number of transactions to be considered. Transactions are divided into periods:

▶️ in 30 days
▶️ in 7 days
▶️ and for the current day

Click on the lines with Jetton and you will see the distribution of the token among the top 20 wallet owners.

Of course, this is only the first step, it is important, for example, to look for wallets that generate transactions in dex pools, relationships, etc., but the main thing here is to start...

TON’s House of Cards

I think all my readers are aware that TON had problems last week. The TON-20 standard, with impressive marketing in the Chinese segment, led to a queue on the network, which led to problems with the indexer, which in turn stopped most important applications.

I wondered what kind of token or application could cause such problems - when I went to the zero address for burning, I was surprised. A bunch of transactions with json inside and that’s it.

As it turned out, there is no clear documentation for TON-20, so I had to figure it out using an original idea from the Bitcoin network - BRC-20.

But what surprised me even more was the amount of hate in around-TON tg channels that fell on everyone who creates something TON. Although there are no signs of malicious intent here.

So I decided to write a longread where:

1️⃣we figure out how TON-20 and BRC-20 works
2️⃣we talk about why such dubious technical solutions lead to problems

and all this in the context of the problem of alignment of incentives - a key problem of such ecosystems that blockchain generates.

ENG LINK | RU LINK

I will be grateful for your support - every like and repost helps, since the topic of blockchain is difficult to perceive

Learning to analyze data using Jettons

In recent months, I have written many tutorials on mining data from TON.
All of them are written from the point of view of how to collect data from data storage point of view, but almost none of them are written from the point of view of methodology.

Therefore, I decided to take a couple of simple problems and go through them using an algorithm, which I consider correct:
1️⃣analysis of smart contracts
2️⃣drawing a diagram of the desired process with the data transmitted in the message
3️⃣obtaining a minimum amount of data, the correctness of which can be checked through the explorer
4️⃣final data collection

Today, for this task, I chose ranking Jettons by transactions. We will go through the algorithm described above and thus rank the Jettons in the TON network.

At the end of the tutorial there will be Google Colab, which will allow you to interactively view the data

ENG LINK | RU LINK

I will be grateful for your support - every like and repost helps, since the topic of blockchain is difficult to perceive

Threat to TON: EIP-4844

At the end of the year, many crypto-related companies voice trends for the next year. All reputable forecasts (bitwise, a16z, etc.) for next year include EIP-4844.

The Ethereum EIP-4844 update will affect transaction fees in L2 networks, as well as the GameFi segment, I’ll try to briefly explain what’s what:

1️⃣Ethereum Goal

Ethereum aims to scale by implementing sharding, breaking down the blockchain into smaller parts to process more transactions. Yet, this introduces challenges, like executing code across shards.

2️⃣Sharding?

Sharding involves splitting a database or system across multiple resources. In Ethereum, it means dividing the network to boost efficiency and throughput.

3️⃣Enter EIP-4844: A Solution Unveiled

EIP-4844, aka proto-danksharding, proposes a groundbreaking fix. It introduces a new transaction type that accepts "blobs" of data - sizeable chunks stored on Ethereum for a limited period.

4️⃣The Power of 'Blobs'

'Blobs' are a game-changer. They allow dApps to bundle transactions and submit them as a single blob, slashing the number of transactions and reducing fees.

5️⃣Reduced Fees: A Win-Win + Throughput

With blob-carrying transactions, fees become significantly lower, making dApps more accessible for users. This is a gift for L2 and GameFi, they can “packed” txes into blobs and thus become super cheap. By batching transactions, Ethereum processes more per second, boosting throughput.

6️⃣Layer 2 Transformation

Currently, Layer 2 transactions cost $0.02 - $0.35. But EIP-4844 could bring costs down to mere fractions of a cent, revolutionizing Layer 2 applications.

7️⃣TON Positioning

I think you already understand what I’m getting at, the competitive advantages of TON are low commissions and the ability to process millions of transactions per second (TPS), and judging by the investment news, the main focus in Dapp is Gamefi.

8️⃣TON’s move

Thus, EIP-4844 can hit TON hard, it will have no advantages over the current market leader Ethereum and L2 solutions around it.

I hope that the creators on TON will find new solutions, since simply copying solutions/Dapps from other networks may simply not be enough after EIP-4844.

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).

The result was about 3,000 resales.

Then I got the following clusters:

1) Names - 103 resales

There are especially many female names in this category

TOP resale: selena - 8 000 TON

2) Crypto - 100

Diffrent crypto related things

TOP resale: memecoin - 42 069 TON (first resale was 368 TON!!!)

3) Brand - 74

The possibility of marketing expenses by brands makes this category interesting

TOP resale: yahoo - 25 000 TON

4) Chinese 70>

Most likely there are even more Chinese words than I marked - unfortunately I don’t know Chinese

One of the top resale: yinhang - 10 000 TON (first resale was 366 TON!!!)

5) Georaphic names- 54:

There are both popular locations and rather small-town locations like gomel - small city in Belarus

TOP resale: america - 15 800 TON

6) Occupation - 48

Professions and names associated with hobbies

One of the top resale: creator - 10 500 TON

7) Gambling - 40

Words including bet casino are often found in the dataset

One of the top resale: roulette - 80 000 TON

8) Technology - 37

This category surprises me a little, the words here are very diverse

TOP resale: livestream

9) Transliteration - 29

Telegram is popular in Russia and of course there is a cluster with Russian words written in English letters

ТОП: kalyan (means hookah) - 4 212 TON

10) Filthy language - 23

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 want to say a special thank you to the guys from dton whose service allows you to do such analytics.

P.S I leave the chat closed for now - there is a lot of spam from

P.P.S In the next post we will look at the top traders on DEX in TON

@ton_learn | twitter | buy TON and jettons

TON - How do top traders make money on DEX?

In any business/sport/hobby, it is always interesting to learn the secrets/methods/techniques of the best. Therefore, I downloaded all swaps from Stonfi and Dedust for the last 30 days and calculated Realized Profit so that I could analyze their transactions. Let's see what came of it.

Methodology

I took swaps - within 30 days, since I was interested in active traders
Excluded those with less than 10 transactions in 30 days
I only took pairs from TON
I calculated Realized PNL - I have a separate post about this


TOP 5 traders by PnL (by clicking on the address you will see transactions for all time):

1) mCiU 30d swaps: 51 PNL: 97806 ~ TON

This address simply drained the GRAM token for 30 days, by the way, this is a problem with PnL as an indicator - the absence of purchases on DEX is displayed as a huge profit

2) naCQ 30d PNL: 34427 ~ TON

Same as the address above

3) d6Ke 30d PNL: 32413 ~ TON

traded: PLANKTON,TON Inu
sold: DFC, GLINT, PUNK and many others

4) c2lN 30d PNL: 30294 ~ TON

Like the first two addresses, simply sold GRAM

5) rN2L 30d PNL: ~ 24939 TON

And again just GRAM sales

Here I realized that we need to take into account the number of sales and purchases and additionally sort only them, otherwise we simply get a list of those who bought/received tokens before the period in question and simply sold them

TOP 5 traders for PnL with ~similar BUY and SELL:

1) zVGO total pnl: ~ 14172 TON buys:  14 sells: 20  

Bought and sold GRAM

2) yhHu total pnl: ~ 10105 TON buys:  6 sells: 7

Bought and sold KINGY and DFC

3) _r6M total pnl: ~ 8852 TON buys:  6 sells: 13  

Very diverse deals

4)o9Qf total pnl: ~ 7655 TON buys:  2 sells: 9
Bought and sold GRAM and SCALE

5)cFI- total pnl: ~ 7312 TON buys:  24 sells: 33
Very diverse deals  


Jettons that gave maximum 30d PnL:

GRAM about ~ 833712 Total DEX PnL in TON

DFC about ~ 150267 Total DEX PnL in TON

JETTON about ~ 63876 Total DEX PnL in TON

ARBUZ about ~ 26995 Total DEX PnL in TON

TONNEL about ~ 26243 Total DEX PnL in TON

If you want to study the trades and PnL of any address on TON, I have an open source tonlearn.tools. Enter the address, click on the lines with Jettons and copy the transactions of any TON DEX Trader.

Tutorial: Jetton Dashboard

Anyone who is interested in token purchase has encountered the difficulty of data availability.

Blockchains are poorly adapted for collecting analytics - nodes and lightnodes provide information only on a specific block of the network, so you have to use blockchain indexers services or API of services running on the blockchain.

As decentralized exchanges strive to have a presence on platforms like coingecko, they create standardized APIs, often making them open source. Such APIs allow you to get a lot of information related to token trading.

Therefore, in this article we will put together a dashboard for tokens on the TON blockchain and see how easy it is to get data from DEX, but in the end we will talk about the problems of this method of data collection. I hope such a simple tutorial will make the steps in the TON blockchain clear and enjoyable.

LINK ENG | RU

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

Write & Read to Earn with BULB

Learn More

Enjoy this blog? Subscribe to Crypto_00

1 Comment

B
No comments yet.
Most relevant comments are displayed, so some may have been filtered out.