Skip to content

Latest commit

 

History

History
62 lines (49 loc) · 1.82 KB

README.md

File metadata and controls

62 lines (49 loc) · 1.82 KB

Zerion Wallet Core

This repository contains Wallet Core used by Zerion Android app.

Examples

Check androidTests to see all examples.

Define wallet data source, repository and cipherManager:

val cipherManager = CipherManager(context)
val dataSource = WalletDataSourceImpl(cipherManager, "com.mywallet")
val repository = WalletRepositoryImpl(dataSource)

Import or create wallet:

val walletContainer = repository.importWalletPersist(mnemonic, password, "My wallet")
// or
val walletContainer = repository.importWalletPersist(privateKey, password, "My wallet")
// 
val walletContainer = repository.createWallet(password, "My wallet")

Derive accounts with index or derivation path:

val account0 = walletContainer.deriveAccount(0, password)
val account1 = walletContainer.deriveAccount("m/44'/60'/0'/0/0", password)

Access private key via index or derivation path:

val privateKey0 = walletContainer.decryptPrivateKey(0, password).toHex()
val privateKey1 = walletContainer.decryptPrivateKey("m/44'/60'/0'/0/0", password).toHex()

Access seed phrase:

val mnemonic = walletContainer.decryptMnemonic(password)

Sign transaction:

val transaction = TransactionInput(
            chainID =  ...,
            gasPrice =  ...,
            nonce =  ...,
            gas =  ...,
            toAddress =  ...,
            data =  ...,
            amount = ...,
        )

val signed = Signer.sign(Transaction(transaction), privateKey).toHex()

Dependencies

TrustWalletCore - low level wallet cryptography functionality, written in C++ with Java wrappers.

License

Zerion Wallet Core is available under the Apache 2.0 license. See the LICENSE file for more info.