neodix42 / MyLocalTon

Personal local TON blockchain
GNU General Public License v3.0
119 stars 21 forks source link

Using wallet as a faucet #35

Closed dkatzan closed 3 months ago

dkatzan commented 3 months ago

Following up on this request https://github.com/neodix42/MyLocalTon/issues/31

it looks like both the main wallet and the validator wallet in the settings file are constantly creating new transactions, causing their seqno to keep increasing

using one of these wallets as faucet can easily result in a race where my transaction fail due to old seqno?

would it be possible to add another wallet which is funded with a lot of ton at bootstrap, and his details added to the settings file as well to serve as a potential faucet wallet?

Would it be possible to make such a wallet with a preset hardcoded private key and address, so it can be used in test setup, without having to extract it from setting file each time?

Thx again for the help!

neodix42 commented 3 months ago

I found no reason why this could not be implemented. Please try release MyLocalTon v113. You will be able to find raw address and the mnemonic of faucet wallet in a console output, as well as here .

dkatzan commented 3 months ago

How would you use the private key to init a wallet, e.g. in pytoniq I managed to do it using the menomics, but looking at the private key, it looks to be 64 char long and in hex format, which are 32 bytes but pytoniq.from_private_key actually expects private key to be 64 bytes

neodix42 commented 3 months ago

I don't know how exactly to do it in pytoniq, but in general you have first to create a signature key pair from seed. Here is an example with ton4j. Basically use ed25519.FromSeed(32bytes) and as result will be 64 bytes secret, that can be used later on.

dkatzan commented 3 months ago

Ahh got u so in pythoniq it the private key can be obtained by using

from nacl.bindings import crypto_sign_seed_keypair
public_key, private_key = crypto_sign_seed_keypair(seed)