Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Unanswered
TON transfer bug when using 32 (DESTROY_ACCOUNT_IF_ZERO) flag?

I've been trying to reuse a wallet deleted by DESTROY_ACCOUNT_IF_ZERO (32) flag. The way I do the transfer:

Imagine we have 2 wallets: A and B.

  1. We transfer N1 TON from A to B. E.g. by using a web-based wallet, script, doesn't matter.
  2. B is uninitialized - it is not on the blockchain yet. With that in mind, we'd like to send all the money from B back to A. For this we're going to use the attached script.
  3. Now we go ahead and transfer N2 TON from A to B again. Doesn't matter how much.

Expected behavior: we get transactions: A->B (N1), B->A (all), A->B (N2); wallet B has N2 TONs in the end.

Actual behavior: we get transactions A->B (N1), B->A (all), A->B (N2), B->A (all); wallet B has 0 TONs in the end.

The script for B->A (all) transfer, which causes this behavior:

import TonWeb from 'tonweb';
import tonwebMnemonic from 'tonweb-mnemonic';


const apiKey = "" || undefined;
// WALLET B
const mnemonic = "...";
const walletVersion = "v4R2";
// WALLET A
const toAddress = "...";


const SendMode = {
    CARRY_ALL_REMAINING_BALANCE: 128,
    CARRY_ALL_REMAINING_INCOMING_VALUE: 64,
    DESTROY_ACCOUNT_IF_ZERO: 32,
    PAY_GAS_SEPARATELY: 1,
    IGNORE_ERRORS: 2,
    NONE: 0
}

const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));


(async () => {
    const provider = new TonWeb.HttpProvider('https://toncenter.com/api/v2/jsonRPC', {apiKey});

    const WalletClass = TonWeb.Wallets.all[walletVersion];
    const mnemonicArray = mnemonic.split(" ");
    
    let { publicKey, secretKey } = await tonwebMnemonic.mnemonicToKeyPair(mnemonicArray);
    publicKey = Buffer.from(publicKey);
    secretKey = Buffer.from(secretKey);

    console.log(`PUBLIC KEY: ${publicKey.toString('hex')}`);

    const wallet = new WalletClass(provider, { publicKey });

    const seqno = await wallet.methods.seqno().call() || 0;
    console.log(`SEQNO: ${seqno}`);
    await sleep(2000);
    
    const transferParams = {
        secretKey,
        toAddress,
        amount: 0,
        seqno,
        sendMode: SendMode.CARRY_ALL_REMAINING_BALANCE | SendMode.IGNORE_ERRORS | SendMode.DESTROY_ACCOUNT_IF_ZERO,
        payload: "test bug"
    };

    console.log(JSON.stringify({...transferParams, secretKey: transferParams.secretKey.toString('hex')}, null, 2));

    const response = await wallet.methods.transfer(transferParams).send();    

    console.log(`transfer sent to blockchain: ${JSON.stringify(response, null, 2)}`);
})();

The strange thing is: if you send A->B (N) again, it will create a new transfer B->A (all) again and again automatically. Sometimes it stops at 2 repeats, sometimes at 4.

I use the unbounceable address: UQAPqRlewultl8xHCKGsrenb4PZaQ0QDfPYoK1fwVUODdZRd.

I also tried sending TON from wallet C (C->B). And the money DID stay on B. BUT once I made a transfer A->B again, all the money including the TONs sent from C went to A automatically!

An example of this bug's manifestation (is it a bug??) is here:

https://tonviewer.com/EQAySjlsHUY2EEedO5GTenzFvAnR5E-4ptwfeox6OZYnNvGF

This is B wallet. Only the first message with "test bug" text was sent by the script. The rest of them were sent automatically on any incoming transfer from A.

In this interaction:

  • A is UQAPqRlewultl8xHCKGsrenb4PZaQ0QDfPYoK1fwVUODdZRd
  • B is EQAySjlsHUY2EEedO5GTenzFvAnR5E-4ptwfeox6OZYnNvGF
  • C is UQBwpXsIVrij8UQ2OpPK2EyeVBrlN6mnOkmThb3k6K-UHZyL

I want to understand, why this happens. Is this intended by TON blockchain developers? Is this not a bug? How to go around this and reuse deleted wallets?

  
  

WhatsApp +33753248207 Buy weed in Paris France, Buy weed in Paris, Buy weed in Lyon, Buy weed in Toulouse, Buy weed in Rouen,Telegram:::::https://t.me/Paris420connectt

WhatsApp +33753248207 Buy Coke,Cocaine,Weed,LSD,Cbd oil ,Molly Pills In Paris France Telegram:::::https://t.me/Paris420connectt
WhatsApp +33753248207 How can tourist get Coke,cocaine,crystal meth,molly in Paris FranceTelegram:::::https://t.me/Paris420connectt

WhatsApp +33753248207 Buy Coke/Cocaine online in Paris Telegram:::::https://t.me/Paris420connectt
Buy cocaine in paris,Where can I buy weed in France?
Buy C...

Yamal22   4 months ago Report
  
  

WhatsApp +447438944586 Buy weed in United Kingdom, Buy weed in UK, Buy weed in London
Buy Cannabis Online | Weed Shop in UK HighTHC
Buy Weed Online in UK | Cannabis & Marijuana for Sale .
WhatsApp +447438944586 Buy Weed, Cocaine, Heroin and Shrooms in UK,England, Scotland,Northern Ireland.
WhatsApp +447438944586 Buy coke/Cocaine in UK, Buy Coke in London, Buy weed in UK, Buy weed in Scotland
Buy Cannabis in UK
WhatsApp +447438944586 Buy weed Online in UK- Order Real Marijuana Online in UK with Worldwide Delivery. Firstly, to buy online from us , you don't need a medical marij...

Yamal22   4 months ago Report
  
  

Am here to testify how my relationship was restored back by the great power's of Dr Adoda after three months of loneliness, my ex-lover called me after my contact with Dr Adoda on ( http://dradodalovetemple.com) That he want us to come back and start a good home, happy to write on this website that my ex boyfriend is back with me and i am very happy sharing the testimony with everyone so that they too can meet this great Dr Adoda and solve their problems. I highly recommend, take a chance.. if your not a believer, he will make you one.

Cyril Vivian   3 months ago Report
  
  

thank you

Rushkar Technology Pvt. Ltd.   one month ago Report
Votes Newest

Answers

15K Views
0 Answers
8 months ago
4 months ago
Tags