farukterzioglu / HDWallet

A generic HD wallet for Elliptic Curve (Secp256k1) and Edwards-curve (Ed25519) based crypto currencies like Bitcoin, Ethereum, Cosmos, Tezos, Tron, Cardano, Polkadot, Avalanche, FileCoin and more.
MIT License
79 stars 36 forks source link

Aggregate values #65

Closed mahanamiri closed 2 years ago

mahanamiri commented 2 years ago

My problem is that the wallet addresses are made in HD, but unfortunately the amounts are not available after depositing in index 0.

This is my step.

1.I create HD and external wallet addresses:

string words = "mmm ..."
IHDWallet<TronWallet> wallet = new TronHDWallet(words);
var account0 = wallet.GetAccount(0).GetExternalWallet(0);
var account2 = wallet.GetAccount(0).GetExternalWallet(1);
var account3 = wallet.GetAccount(0).GetExternalWallet(2);

2.Then I transfer some TRX to account 2 & account 3.

3.Then I add the default wallet address based on the words in the tronlink.

Unfortunately I do not have access to the amount through a single wallet!

farukterzioglu commented 2 years ago

This is normal, technically first second and third wallets are separate wallets. You are not creating external wallet address like you said, you are creating external wallets

You also need to add those wallets to the Tron link (just create new next wallet from same mnemonic). And balance of them will be shown at different wallets since they ARE different wallets.

This is normal for an HD wallet. You can't aggregate those balances. Account based blockchains (like Tron) doesn't work like that. You can only do it with utxo based blockchains (like Bitcoin)

mahanamiri commented 2 years ago

Thanks for your explanation, so I can not have multiple separate addresses for one wallet on trc20 network?

mahanamiri commented 2 years ago

And if the answer is yes, can I transfer money from all created addresses to one address with just one fee?

farukterzioglu commented 2 years ago

for every wallet you will have 1 address but with HD wallets, you can have thousand of different wallets so thousands of different addresses. means: one mnemonic -> lots of addresses

but all of this addresses (means wallets) are separate, you need to transfer their balances one by one, with paying fee for every transfer

mahanamiri commented 2 years ago

thanks for your help