How to build a non-custodial wallet
Build a backend for a non-custodial wallet in 30 minutes
A wallet is a simple application where users can sign in, generate accounts in different blockchains, and send and receive payments. They are owners of the private keys for every blockchain address, and the wallet provider has no access to them.
A wallet can store any assets. These could be customer ERC-20 tokens, standard blockchain assets, or government-issued currencies.
In this tutorial, you will learn how to build a non-custodial wallet backend on Tatum. All you will have to do after this tutorial is to create a nice frontend for your application.
A non-custodial wallet is the type of wallet where users have full control over their funds and the associated private key.
There are two logical groups of actions that must be done to create a wallet:
- Registration of new users in the application - what must be done during the registration phase
- User application journey - what kind of actions users take while in the application
When you create accounts, blockchain addresses should be created and connected to the ledger accounts. This starts the process of automatic synchronization of incoming blockchain transactions. It is possible to enable webhook notifications for every incoming transaction to the account.
The account's balance is available in the accounts list by default and does not have to be queried separately.
When developing a non-custodial wallet, the Bitcoin transaction should have the attr field present in the request body. This will be used as a change address for the rest of the unspent funds, and it must be the first address connected to the ledger account.
So there you have it. There are many more things that you can enhance in your app and many more features to implement, but this should be a reasonable start for you and your wallet.