-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide an endpoints for TFT supply figures including both Stellar and Rivine #517
Comments
Update: Now I Have another error when I try to start the server. seems originated from an old configuration in my system. I tried to delete the sandbox dir, and also did
Also, I want to mention that I don't have any prior experience with the Rivine project and I wasn't involved in setting up TFT on Stellar. So, some of the discussions might be a bit unclear for me. However, I'll come back to this once I've fixed my development environment. |
Update:
In the meantime, can we get @robvanmieghem and @LeeSmet feedback on this issue to see if they can share any relevant information or opinions about this since they know the most about this area?
|
To my knowledge, at the time this was created rivine was already deprecated (and the majority of tokens migrated), to the point where most unmigrated tokens can be considered "lost".
When we moved from rivine to stellar, all accounts on stellar were locked (except for the block creators but those don't really matter). The locking was done by a special "deauthorization" transaction on rivine. When tokens are/were migrated to stellar, the memo is set to type hash with the value the hash of the lock transaction on rivine, so the tokens which you have on stellar as result of a migration are linked to tokens on rivine (also, the stellar address can be verified to "match" the rivine address). Essentially this establishes a link from stellar to rivine so we can prove all tokens already existed, but this also means on rivine you can't see which tokens are migrated and which aren't. In other words, to find out how much tokens have been migrated (and how many haven't), you'll need to list all transactions on stellar of both TFT and TFTA, and then filter based on transaction memo, where a migration tx is one which has a memo which also happens to be a rivine deauth tx ID. For the unmigtrated TFT, you'll need to figure out the total rivine TFT supply and subtract the migrated amount. FWIW: I have some code on my personal github which finds all threefold mints across both networks (mint in this context being the result of minting code). It also checks if tokens are the result of a migration to find out if they should be counted or not. This might give some hints about what you want to achieve. https://github.com/LeeSmet/find_threefold_mints |
https://github.com/threefoldfoundation/tft-stellar/tree/master/scripts/analysis has the scripts to put all this information in an sqlite database. The Stellar subfolder indexes all Stellar transactions as well. |
Update: Token burns should involve removing assets from circulation and It appears that we are not taking burned tokens on TFchain into consideration yet. As a result TFT asset on stellar is currently (inflated?). Burning tokens isn’t solely voluntary; we actively burn 35% of tokens from billed contracts every 24 hours due to utilization. This deliberate reduction in token supply should, if correctly mirrored on Stellar, contribute to an increase in its value. Now, could you shed some light on which specific wallets should considered illiquid supply? |
This is a good point. Seems it was never implemented. If we can query the total supply of TFT on both mainnet and testnet TF Chains, then compare them to the relevant Stellar vault addresses for each bridge, the discrepancy should be visible.
As far as I know, the only illiquid tokens in the system right now are illiquid foundation wallets. Details about these wallets appear to be supplied through a config file that's not in the repo, but the info can be read from here. Tokens from the vesting program are now eligible to be unlocked immediately, so I don't think they should be considered illiquid, even if they are still vested. The remaining possibility that I'm aware of is that some TFT buyers had an arrangement where their purchase unlocked in chunks monthly. I don't know if any tokens covered by such arrangements are still locked. I think only considering the foundation wallets when considering liquid vs illiquid is good enough. |
I had no luck with testing this code.
|
@LeeSmet @robvanmieghem Is it relevant to do this now. also, was there a planned/announced deadline for token migration? Will we need to monitor rivine unmigrated tokens indefinitely? |
We still get occasional requests to migrate Rivine tokens via our support channels. I do think it's relevant to at least get a sense for how many tokens are left there and eligible to be migrated (would also be a natural question in any discussions around cutting off migrations).
I think all the same results can be obtained using the code in this repo under
Once this is done, the result is a SQLite database with all necessary data to compute the desired figures. I am testing it personally, and so far I've only managed to process about 30k of 708k blocks from Rivine via the |
So to avoid doing redundant work , we can follow these steps:
Sounds good ? |
Update: Total issuance on Rivine
Migrated amount
Unmigrated amount
The minted TFT(A) amount on Stellar that has a lock transaction as a memo
I'll have to rerun everything and double-check for issues because the later number appears to be significantly larger than the total issuance on Rivine, even though it should be equal to the migrated amount. Worth mentioning that I had a lot of these messages while running issuertxs.py
Did you have better luck? @scottyeager |
I think overall we have the same idea. My thinking would be to just continue matching Stellar mints that occur from Rivine migrations with their original Rivine accounts, rather than removing any items from the database. But overall the outcome is the same.
I saw some of these too and spotted checked one. It seemed to be a Stellar transaction totally unrelated to TFT. Not sure why that's happening, but at least it doesn't seem to be a failure to parse any actually relevant transactions.
I didn't manage to finish running |
I'm trying to make sense of the available data. But I keep get weird results. In the Rivine table, there’s an account with the identifier 033e7e20e80ceefb64c37c5f5453429aa450e9fea422888adcaf069a94d83b58dcc2bf89eb80f1. This account was deauthorized with tx Upon investigating the lock transaction in the minted table, I discovered two transactions with the same memo Transaction 1: Here’s where it gets intriguing: both transactions share the same memo but have different destinations. The total amount transferred to Stellar is 169,135,910.77 TFT. However, the issuance amount on Stellar doesn’t match the account balance in Rivine at the time of closing. Now, the questions arise: Why was the same Rivine lock transaction used as the memo to issue TFT for different addresses on Stellar? These discrepancies warrant further investigation. Perhaps there’s a hidden layer of complexity not clear to me or an unexpected twist in the migration process. |
What makes things even worse is that there was a bug in the original migration service when converting an unspent output where the input was not completely sent to the deauthorized address and multiple outputs were locked. No, I did not create the bug but noticed and fixed it in ca255dd |
For this particular instance, I took a look manually in the Rivine explorer (here's a link to the specific page). Seems there were two amounts, locked and unlocked, which correspond to the two amounts you observed migrated to Stellar. I think the only question here is why weren't those balances included in the database. |
But Shouldn't both go to the same address? I read that locked token was migrated as TFTA and unlocked tokens were migrated as TFT. I see both were issues TFT for different addresses. Maybe a Normal account and a vesting account? |
Also from what I read Migration service was later discontinued, and migration was processed manually through support channels. Did we continue to follow the same migration logic and process as before? |
After reviewing the code, I observed that the Rivine explorer client handles balance queries exclusively for regular wallets. Unfortunately, querying balances for multi-sig wallets has not been implemented (the code returns just an empty balance). Consequently, the balance for this wallet (and any multisig wallets) becomes zero in the database. tft-stellar/lib/tfchainexplorer.py Lines 141 to 142 in a1c6745
|
I have scanned all the wallets and found that only a few of them are multi-sig wallets.
I can correct these entries manually in the database (since these data are static anyway). |
Update: The analysis suggests that the number of tokens migrated to Stellar exceeds the number of tokens initially issued on Rivine with 1,725,373,122.3610737 TFT. Update 2: 764,831,278.8226932 TFT deauthorized balance done (total supply on Rivine before locking)
|
These numbers don't seem quite accurate to me, specifically the migrated tokens seem to be on the low side. From stellar.expert, we can see that at the time of writing there are 53.3M TFTA and 885.9M TFT, totaling roughly 939.3M TFT on stellar. If the provided numbers are correct and only 281.7M TFT have been converted, that would mean some 657.6M TFT have been minted on stellar since we started minting there in may 2020 with the start of V2 minting (minting for month of may -> payout actually happened in june). So that would mean 657.6M TFT / 44 months which gives an average of 15M TFT minted per month. From doing the actual minting, I know for a fact that this number is way too high. The average minted TFT per month is in the range of slightly above 3M per month, spiking to 5M with v3 for some time before now dropping back to slightly above 3M. So I've updated my code to also print out all migrations (and conversions for TFTA->TFT though that is not really relevant right now). This gives me these numbers: The total MINTED (as result of proof of capacity) TFT amount on both chains is Considering the above, the remaining rivine TFT to be migrated would be I haven't manually validated these numbers, however from running the minting the numbers presented do seem to line up (for the total issuance). Also the close match of stellar TFT+TFTA compared to the computed numbers do inspire some confidence. Note, on rivine tfchain, there was a block creator reward of 1 TFT. I haven't included this (roughly 700K tft), since it was not the result of proof of capacity minting ,and it should never get migrated as to my knowledge, these accounts were never deauthorized. |
Thanks, Lee, for the update. You are correct. Here are the final numbers I got after the fix.
The important part is here
so only 189,358.9876737 TFT Remains unmigrated! But per your analysis :
Can we discuss the differences between the total issued amount on Rivine in your analysis and the results I obtained from modified Rob's script? |
You can try |
So here are some points to consider:
I'll see if I can modify my code to also sort out the voluntary burns of TFT (on rivine and stellar TFT) if there are any. If that doesn't work out, a list of all TFT addresses on rivine which have tokens might be needed, so we can see if indeed all have been deauthorized (which I suspect didn't happen at this point) |
As it stands I count 1604 address on tfchain which have ever appeared in a coinoutput (i.e. received tokens). So that suggests all of them got deauthorized. Other than that there are some burns on TFT on stellar it seems (didn't check rivine as it seems the coindestructionTX never got registered there). There are roughly 2K burns, mostly for very small amounts (though some slightly larger). One which stands out is a burn of 5M tft. However these 5M tft were also credited from a non mint or migration tx. While this particular case does not really matter, it does invalidate the assumption that all TFT on stellar are the result of minting or conversion. https://stellar.expert/explorer/public/account/GBBYLWMOZOGJKV6XRLOVILJMXTT2MPA3GD5FAJJ2CK6N3OOKY3SXQCUO?asset[]=TFT-GBOVQKJYHXRR3DX6NOX2RRYFRCUMSADGDESTDNBDS6CDVLGVESRTAC47-1&cursor=151683972719280128&sort=id&type[]=payments |
@robvanmieghem mentions these TFT here. Something to do with initial setup of TFT on Stellar, it seems. |
Per discussion with stakeholders today, we will cease conversion of Rivine TFT immediately and not count unmigrated tokens toward the supply. Thanks for the work on this one @sameh-farouk and @LeeSmet. |
Actually one thing remains to be done, and that's providing a simple endpoint that just adds TFT + TFTA on Stellar to give a total supply figure. |
Update: |
Update: |
Looks good! Thanks @sameh-farouk. |
Currently we have the tft_statistics service running at https://statsdata.threefoldtoken.com/stellar_stats. This provides TFT supply info for the Stellar chain only.
We'd like to also have an endpoints that include any TFT on Rivine that are still eligible to be migrated to Stellar. This would be used, for example, to provide live supply figures to sites like Coinmarketcap.
There's already code in this repo to grab data from both Rivine and Stellar. What would be needed is to serve the output of certain calculations based on this data:
Update:
The text was updated successfully, but these errors were encountered: