Skip to content

Wallet Engines

All Wallets classes should be django models that inherit from hub20.apps.core.models.accounts.BaseAccount. This base model stores no information, except an unique identifier.

Ethereum wallet models

The hub20.apps.ethereum.models.accounts module defines wallet classes. All of them store an address field, and they can also be used to keep track of all of its blockchain transactions.


Only stores addresses and can not be used to sign transactions. Can not be generated by hub20 programatically. This wallet type is useful if the operators want to pre-generate a large number of wallets and rely on Hub20 to keep track of payments received.


Each model generates its own private key and stores it in the database. The address from the account is determined upon wallet generation.


Based on hdwallet, each new wallet is generated from the seed phrase that needs to be provide by the operators as part of the Hub settings. No private key is stored in the database, but the application needs to have access to seed phrase or it won't be able to generate new wallets.

Implementing new wallet models

If you want to implement a model that corresponds to a different type of Ethereum Wallet (i.e, to have smart wallet contracts that can use different recovery features, it should derive hub20.apps.ethereum.models.accounts.BaseEthereumAccount and provide the following methods:

  • generate(cls, *args, **kw) -> EthereumAccount_T: a class method that will be called if there is the hub does not have an available route for a payment order. It should raise TypeError in case the model if new wallets can not be generated by the class

  • private_key(self) -> str: an object property that returns the that hex string representing the private key. This will be needed for every implementation of wallets that you want to automatically sign and submit transactions to the blockchain.