How to create a new wallet to deposit and withdraw

Hi guys!
I have a system app.
I want to receive DOT from users and move them to the DOT master address.
So, I have a master DOT address and this is the main flow:

  1. If the user request a deposit, the system will gen a new temp address (+ private key)
  2. Then the user send some DOT to the temp address.
  3. Then the system (cron job) will check the balance of the temp address.
  4. The system moves all balances of the temp address to the master address.
  5. Bla bla…
  6. Transfer (for withdrawal): send to the user: use the transfer method.

So everything is ok for me?
How to create the new wallet (address + private key) by the GOLANG code or nodejs code?
And how do I move all balances from temp address to master address?
Is there a way to move them quickly ? ( do not use the transfer function ) .
Thank you so much!

hi @rainbowbrite2020
why do you delete the post?

Hello Phuong, i’m new to polkadot development, for what i been researching so far i didn’t find a way to create a new account (wallet) with nodejs. What i found is a command-line library built on Rust, that lets you create an account. substrate/bin/utils/subkey at master · paritytech/substrate · GitHub

Theres no api/endpoint from polkadot, or at least i haven’t found one, to make a request to create an account, maybe you could run subkey code as a service within your go api.

Substrate is the framework that lets you connect to the Polkadot and Kusama networks.

Bests,

Julian

2 Likes

Got it:
github.com/vedhavyas/go-subkey
github.com/vedhavyas/go-subkey/sr25519

CreateAddress() (privKey, pubKey, address string, err error) {
	fmt.Println("create address Dot...", ns.network)
	kr, err := sr25519.Scheme{}.Generate()
	if err != nil {
		return "", "", "", err
	}
	fmt.Println(kr.Seed())
	add, _ := kr.SS58Address(ns.networkID)
	return subkey.EncodeHex(kr.Seed()), subkey.EncodeHex(kr.Public()), add, nil
2 Likes

Hello, I can’t find the document about how to transfer the transaction. Do you have it? Thank you