The address generated by trc20 in the method and in the hot wallet does not match when using the same mnemonic phrase
Hello! I’m trying to write a method that will generate a TRC20 wallet from a mnemonic phrase and also access an existing wallet on the same network. I found a package a package that should help me – wallet.
import 'package:wallet/wallet.dart';
import 'package:bip39/bip39.dart' as bip39;
void getTrc20Address() async {
final tron = await Tron();
String randomMnemonic = bip39.generateMnemonic();
final seed = bip39.mnemonicToSeed(randomMnemonic);
final privKey = tron.createPrivateKey(seed);
final pubKey = tron.createPublicKey(privKey);
final address = tron.createAddress(pubKey);
print(address);
}
TRc20 address is created correctly, it turns out to send a transaction to it, but when I try to authorize through the phrase created in the mnemonic method in a hot wallet (for example, trust wallet) – the address issued by the wallet differs from what I get in the method.
Example:
the phrase used to generate the wallet in the method: ‘boost limit you peasant april setup print arrest love festival much consider’, and in the method with it the address TZ5kGfid2b7FdP3VaqcFf7PKDC64s7htzB is created, while in the trust wallet with the same phrase I connect to the wallet TY2wEqpxfw6ZK9hXWVat5hKgyrPqg2dfy3.
Where i made a mistake?
2
Answers
well this might be the same address without checksum.
tron uses base58 checksum which has the algorithm like below:
this algorithm is generated by ai chat bot so it might not be the true one but it’s almost like this.