wallet-core icon indicating copy to clipboard operation
wallet-core copied to clipboard

Support for Jettons on TON blockchain

Open snowkidind opened this issue 1 year ago • 29 comments

Gentlemen thanks for supporting TON, there are many wallets on the TON ecosystem that use a 24 word mnemonic but none that use a 12 word.

Further, the method you used to generate the wallet is unknown, and because of this the wallet address you derived from your keygen method does not support Jettons. This becomes an issue when a TON user decides to send Jettons to the TON address the trust wallet generates.

Another wallet has added an import from private key feature to their wallet but alas, the common method is not being used in trust causing peoples funds (like JUSDT) to be lost in the mix.

Can you at a minimum devolve the method you used to create the twelve word mnemonic or create an escape path for mistakenly sent jettons to a trust wallet?

Thanks

See Also: https://github.com/mytonwalletorg/mytonwallet/issues/62

snowkidind avatar Jun 14 '24 14:06 snowkidind

Do you mean that the Trust Wallet method doesn't support Jettons? There is a method in their examples; I think it works. However, the seed generated by Trust Wallet is not compatible with TON's wallets. Nevertheless, it's still possible to import using the private key.

Soon I will be launching the TON Network on the ECOIN Wallet, where you will be able to use the private key as well as 12 or 24 words. Image

ronaldoguedess avatar Jun 15 '24 02:06 ronaldoguedess

I dont believe trust wallet supports jettons, unless it's recent.

Access to jettons via whatever method they used to derive a private key / address in trust wallet is not currently possible using any known methods for example, using

      const provider = tonweb.provider
      const seed = await mnemonicToSeed([mnemonic]) // 12 word mnemonic
      const keyPair = tonweb.utils.nacl.sign.keyPair.fromSeed(seed)

      const wallet = new tonweb.wallet.all.v4R2(provider, {
        publicKey: keyPair.publicKey,
        wc: 0
      })

      console.log(keyPair.secretKey.toString()) // private key doesnt generate the trust wallet address shown in wallet

snowkidind avatar Jun 15 '24 04:06 snowkidind

The Trust Wallet core supports this, but the Trust Wallet App does not. As I mentioned earlier, the ECOIN Wallet will soon introduce TON Network, with support for private keys, a 12-word, or 24-word seed phrase, and also Jettons.

ronaldoguedess avatar Jun 15 '24 04:06 ronaldoguedess

bro stop spamming the githubs this is not an appropriate channel

snowkidind avatar Jun 15 '24 04:06 snowkidind

bro stop spamming the githubs this is not an appropriate channel

I understand your frustration. I just said I will launch what you need to solve your problem, and I apologize if my approach seemed spammy.

ronaldoguedess avatar Jun 15 '24 04:06 ronaldoguedess

developer community can read the instructions, we dont need to be battered by repeat information. please consider this moving forward.

snowkidind avatar Jun 15 '24 04:06 snowkidind

Hello, we will begin the development of Ton Jettons in TrustWallet App next week, and will also add Ton Connect.

In terms of wallet compatibility, it's important to remember that TrustWallet is a multichain wallet that relies on the widely used standards for generating seed and private keys: BIP39 and BIP44. Regrettably, the Ton architecture has adopted a different approach that we cannot support without compromising compatibility for our users. Nevertheless, it will still be possible to import the private key, and you should be able to see your Ton Jettons within the next weeks. Additionally, you'll be able to access Ton Ecosystem DApps directly within the TrustWallet app.

Milerius avatar Jun 15 '24 04:06 Milerius

Read about the seed: https://github.com/trustwallet/wallet-core/issues/3188

ronaldoguedess avatar Jun 15 '24 04:06 ronaldoguedess

Read about the seed: #3188

We understand the request, and to ensure complete transparency, incorporating this into the app for smooth user experience would necessitate significant rework and architectural design changes. This is specifically to support a single blockchain with a unique seed generation method. While we're not ruling it out, it's not an update you can expect in the near future.

Milerius avatar Jun 15 '24 04:06 Milerius

Hello, we will begin the development of Ton Jettons in TrustWallet App next week, and will also add Ton Connect.

In terms of wallet compatibility, it's important to remember that TrustWallet is a multichain wallet that relies on the widely used standards for generating seed and private keys: BIP39 and BIP44. Regrettably, the Ton architecture has adopted a different approach that we cannot support without compromising compatibility for our users. Nevertheless, it will still be possible to import the private key, and you should be able to see your Ton Jettons within the next week. Additionally, you'll be able to access Ton Ecosystem DApps directly within the TrustWallet app.

That's great news! 👏🏻 You're absolutely correct; it could affect the compatibility for TW users. What's your plan regarding the Webprovider? Are you considering adding support for TON dapps on the Trust Web3 Provider (https://github.com/trustwallet/trust-web3-provider), or will you opt to implement Ton Connect (https://github.com/trustwallet/trust-web3-provider/issues/529)?

Also, considering that TON Connect currently lacks a JAVA/KOTLIN library, are you planning to develop something to address this gap?

ronaldoguedess avatar Jun 15 '24 05:06 ronaldoguedess

Hello, we will begin the development of Ton Jettons in TrustWallet App next week, and will also add Ton Connect. In terms of wallet compatibility, it's important to remember that TrustWallet is a multichain wallet that relies on the widely used standards for generating seed and private keys: BIP39 and BIP44. Regrettably, the Ton architecture has adopted a different approach that we cannot support without compromising compatibility for our users. Nevertheless, it will still be possible to import the private key, and you should be able to see your Ton Jettons within the next week. Additionally, you'll be able to access Ton Ecosystem DApps directly within the TrustWallet app.

That's great news! 👏🏻 You're absolutely correct; it could affect the compatibility for TW users. What's your plan regarding the Webprovider? Are you considering adding support for TON dapps on the Trust Web3 Provider (https://github.com/trustwallet/trust-web3-provider), or will you opt to implement Ton Connect (trustwallet/trust-web3-provider#529)?

Also, considering that TON Connect currently lacks a JAVA/KOTLIN library, are you planning to develop something to address this gap?

Those choice(s) will be made by @y3fers0n & @gastonm5 who are leading this initative.

Milerius avatar Jun 15 '24 05:06 Milerius

@Milerius would you comment about this issue regarding derivation path that seems to be different in TrustWallet ? I guess this would have no issues regarding compromising compatibility for our users. It would be just a choice to be made like other wallets did and be the same so an user importing their words into either wallet funds will appear as expected.

If is necessary a significant architectural changes than so be it. At the end at the user's benefit to have a more seamless app for their choice and not have to worry about details like derivation path, private key etc.

Importing the private key is always something undesirable because it needs further steps to get this information and it is not as friendly as importing 12 or 24 words. It can be a temporary solution, but not definitive.

Good to see there is work going on this topic by TW Team.

ffrediani avatar Jun 21 '24 17:06 ffrediani

Cool@285

Doferesouleymane avatar Jun 23 '24 00:06 Doferesouleymane

@y3fers0n @gastonm5 Considering that TON Connect currently lacks a JAVA/KOTLIN library, are you planning to develop something to address this gap?

Btw, any news related to the TON?

ronaldoguedess avatar Jul 12 '24 02:07 ronaldoguedess

Hi @snowkidind, could you please clarify, did you try to send Jettons to an initialized TON address (ever held funds)? If I'm not mistaken, the wallet needs to be initialized so you can transfer Jettons to the address. We actively work on Jetton support, and just recently added two helper functions in WalletCore to generate Jetton address to check the balance: https://github.com/trustwallet/wallet-core/pull/3922 (please take a look at unit tests added) Also we already support Jetton transfer: https://github.com/trustwallet/wallet-core/pull/3331 (take a look at unit tests added) Soon Trust Wallet apps will allow to transfer Jettons

Further, the method you used to generate the wallet is unknown, and because of this the wallet address you derived from your keygen method does not support Jettons. This becomes an issue when a TON user decides to send Jettons to the TON address the trust wallet generates.

satoshiotomakan avatar Jul 12 '24 07:07 satoshiotomakan

@snowkidind @ronaldoguedess @ffrediani The problem is that TON 24-words mnemonic doesn't follow BIP39 standard. It requires to implement a TON specific derivation method, and derivation path doesn't even play a role in this derivation. Please also note that it only allows to derive ONE account, but Trust Wallet (and WalletCore) is multi-chain oriented.

would you comment about this issue regarding derivation path that seems to be different in TrustWallet ? I guess this would have no issues regarding compromising compatibility for our users. It would be just a choice to be made like other wallets did and be the same so an user importing their words into either wallet funds will appear as expected.

But we consider adding support for TON 24-words specific mnemonic for TON chain only in the near future, and if you import it, you can only see TON account. The task is in our roadmap, it requires significant changes in our API

satoshiotomakan avatar Jul 12 '24 07:07 satoshiotomakan

Hi @ronaldoguedess, yes we plan to add support for X25519 "crypto_box" key exchange protocol to establish TON Connect Session, and also signing a transaction with externally generated data (needed for sendTransaction)

Considering that TON Connect currently lacks a JAVA/KOTLIN library, are you planning to develop something to address this gap?

satoshiotomakan avatar Jul 12 '24 08:07 satoshiotomakan

Hi @ronaldoguedess, yes we plan to add support for X25519 "crypto_box" key exchange protocol to establish TON Connect Session, and also signing a transaction with externally generated data (needed for sendTransaction)

Is the team working on it? Deadline? I'm asking because this is very important for the moment.

ronaldoguedess avatar Jul 26 '24 04:07 ronaldoguedess

@ronaldoguedess, it's estimated to be done early next week

satoshiotomakan avatar Jul 30 '24 09:07 satoshiotomakan

Just wanted to say that the fix for jettons inadvertently sent to trust wallet was by creating a private key from mnemonic using the derivation path:

m/44'/607'/${index}'

snowkidind avatar Aug 02 '24 01:08 snowkidind

Just wanted to say that the fix for jettons inadvertently sent to trust wallet was by creating a private key from mnemonic using the derivation path:

m/44'/607'/${index}'

I didn't understant, could you give more details?

ronaldoguedess avatar Aug 02 '24 01:08 ronaldoguedess

https://github.com/mytonwalletorg/mytonwallet/issues/62

snowkidind avatar Aug 03 '24 10:08 snowkidind

Hi @ronaldoguedess, X25519 "crypto_box" key exchange protocol is available since 4.1.4

satoshiotomakan avatar Aug 12 '24 08:08 satoshiotomakan

Hi @ronaldoguedess, X25519 "crypto_box" key exchange protocol is available since 4.1.4

Yeah, I saw that, but what can I do with this crypto box? I waiting some sample in Java or Kotlin to use Ton Connect, or the cypto box is to encrypt memo?

ronaldoguedess avatar Aug 12 '24 15:08 ronaldoguedess

@ronaldoguedess CryptoBox is used to establish a TON Session between dapp and the wallet. TON Connect in general is a complex protocol, and WalletCore provides all cryptographic and wallet functions required for its support. There won't be an TON Connect example in WalletCore as it's out of scope.

satoshiotomakan avatar Aug 14 '24 12:08 satoshiotomakan

@ronaldoguedess CryptoBox is used to establish a TON Session between dapp and the wallet. TON Connect in general is a complex protocol, and WalletCore provides all cryptographic and wallet functions required for its support. There won't be an TON Connect example in WalletCore as it's out of scope.

I understand that. I was hoping you might implement a way to utilize that directly. However, is there at least a way to connect and interact with TON dApps using injection, similar to what the Trust web3-provider does?

I noticed this functionality was added in this commit, but I couldn't find a sample in Java/Kotlin to work with it.

ronaldoguedess avatar Aug 15 '24 14:08 ronaldoguedess

@ronaldoguedess sorry I can't advise on that, better to create a question at the web3-provider repo.

However, is there at least a way to connect and interact with TON dApps using injection, similar to what the Trust web3-provider does?

satoshiotomakan avatar Aug 15 '24 15:08 satoshiotomakan

Hi, @satoshiotomakan. Ton network has a new feature for jettons, it's about mintless jettons. doc: mintless jettons related tx: https://tonviewer.com/transaction/9b6bd2e46536392323809b5bb38b4492f9614a2d54fdf63baa46e3fc53c6474b

I find that trust support custom_payload in Transfer message but not support custom_payload in JettonTransfer message. it seems that if trust do this support, the mintless jettons transfer can be supported. Can you add this to your plan?

wayne-liu-crypto avatar Sep 19 '24 04:09 wayne-liu-crypto

Hi @WayneLaw-Crypto, thank you for the note. It's on our roadmap already, but low priority at least for now. I'll let you know once we have any ETA

satoshiotomakan avatar Sep 19 '24 08:09 satoshiotomakan

Hi @WayneLaw-Crypto, Mintless Jettons support has been added at https://github.com/trustwallet/wallet-core/pull/4041

satoshiotomakan avatar Nov 21 '24 10:11 satoshiotomakan