Introducing

AeroWallet


The Samsung Blockchain Platform SDK is a one stop solution to all your blockchain needs. AeroWallet is a sample application showcasing the features of SBP SDK. The SBP SDK provides six primary features:

  • Hardware Wallet Management
  • Account Management
  • Transactions
  • Token Transactions
  • Simple Payment UI
  • Cucumber Web-View (DApp Browser)

To ensure maximum security a hardware wallet is always recommended to interact with blockchain networks. The SBP SDK provides support for three types of hardware wallets:

  • Samsung Blockchain Keystore (SBK)
  • Ledger Nano X
  • Ledger Nano S

AeroWallet helps showcase most of the available services and APIs of the SBP SDK.


Understanding AeroWallet


Welcome to AeroWallet

To use AeroWallet, you need a stable connection to the internet. The get started button redirects users to the hardware wallet selection page. However, if you have no connection to the internet, the application will prompt you to try again when you have internet.

Before diving into how AeroWallet showcases all the features of the SBP SDK, we must understand the structure & design of AeroWallet. AeroWallet follows the well-known MVVM pattern to design its core architecture. The MVVM architecture helps maintain better separation of concerns, improved testing capacity, and transparent communication between the classes. The codebase is divided into three separate layers:

  • View
  • ViewModel
  • Model (Service)

The View layer consists of the layout, activity and fragment classes. They provide the interface that displays the application data to interact. It contains many UI elements that enable user interaction and helps reflect changes in the network/data from the server. The activity/fragment classes in the view layer consist of observers that observe for changes in the data and update the UI, respectively.

The Service layer or model layer in MVVM terminology consists of many service classes interacting with the SBP SDK. It enables direct communication with the SBP SDK and is the last layer of the architecture. Service classes receive requests from the ViewModel and interact with the SBP SDK.

The ViewModel layer consists of the viewModels that help encapsulate all the application's business logic. It contains Mutable LiveData objects that change depending on user and server feedback. The view layer observes these changes and updates the UI where necessary. The viewModel also gets/sets data by communicating with the service layer.


Hardware Wallet Management

SBP SDK provides an instance of hardwareWalletManager that can be retrieved from the Sblockchain. Currently, the SBP SDK supports three types of hardware wallets: Samsung Blockchain Keystore (SBK) and Ledger Nano devices (USB & BLE).


Hardware Wallet Selection Page

In the AeroWallet codebase, you can find the WalletSelectionActivity class inside the view folder. The logic behind setting the hardware wallet has been decoupled as such:

WalletSelectionActivity -> SetupViewModel -> SetupService -> SBPManager

In the WalletSelectionActivity, listeners are implemented on the buttons of the page. When you press on your desired hardware wallet, the listener calls the connectHardwareWallet function from the SetupViewModel. This function calls the connectHardwareWallet function of SetupService which in turn calls the connectHardwareWallet function of SBPManager. Finally, SBPManager calls the connect API of the SBP SDK's HardwareWalletManager module to connect with the respective hardware wallet. When you are done connecting to the hardware wallet, you can move to select your desired cointype.

Note

SBPManager is a core service class that provides direct interaction with the SBP SDK. It contains instances of SBlockchain, HardwareWalletManager, and AccountManager. The SBlockchain class provides methods to get the AccountManager (singleton instance), HardwareWalletManager (singleton instance) and SupportedHardwareWallet.


Account Management

The Samsung Blockchain Platform SDK manages the address on a blockchain network as an account. These accounts contain all the necessary information required to sign a transaction on the blockchain network. Before fetching or generating an account, you must provide your WalletId, CoinType and NetworkType to the API.


Coin Selection Page

Network Selection Page of Ethereum

After selecting the WalletType, CoinType, and NetworkType, you can now communicate with the SBP SDK to fetch your account. The SBPManager class stores the data for all these variables. Now we have all the necessary pieces of the puzzle to use the AccountManager instance to manage our account. The AccountManager has the following APIs at our disposal:

  • getAccounts: Required parameters are WalletId, CoinType, and NetworkType. Returns the accounts that are stored locally by the SBP SDK.

  • generateNewAccount: Required parameters are ConnectedHardwareWallet and CoinNetworkInfo. Generates a new account with the root seed of connected hardware wallet.

  • restoreAccounts: Required parameters are ConnectedHardwareWallet, Reset and CoinNetworkInfo. Restores all accounts based on the current root seed. Stored accounts in the SDK's repository are deleted and restored.

CoinNetworkInfo is a special class in the SBP SDK that allows the packing of coin/platform, network, and rpc node information. To create a CoinNetworkInfo, you need to pass the CoinType, NetworkType, and RPC URL to its constructor.

Reset is a boolean parameter that is usually set to false. If set to true it removes all accounts in the shared preferences and writes restored accounts.

There is also a navigation bar that helps to navigate between the fragments.
All the account information is displayed within the dashboard fragment of AeroWallet. The send button redirects to Transfer fragment and the receive button redirects to the Receive Fragment.


Receive fragment showcases the public address of your account to copy/share


Dashboard displaying the public address and balance of the account


Account Tree to switch between accounts and Add New button to generate a new account

Transactions

One of the primary goals achieved by the SBP SDK is to provide simple transactions through abstracted APIs for each type of ledger system.

To learn how to use the APIs from SBP SDK to sign transactions, please look into the respective service classes in the programming guide section of SBP SDK.

To perform a transaction on the blockchain network, you need the receiver's public address and sufficient balance. In AeroWallet, you can use a QR scanner to scan the receive's public address QR code enter the desired amount of funds to transfer. Please note that a transaction fee (gas) is required to perform transactions on the blockchain network.


Ethereum Transaction fragment

SBP SDK supports both legacy and EIP-1559 transactions for ethereum. You can also choose your desired transaction speed.

Token Transactions

Besides fund transfers, the SBP SDK provides APIs to perform token, nft and safenft transactions. AeroWallet has a separate fragment to showcase token transfer from one account to another. However before sending a token, you must add the token into your account. In the token fragment press on the '+' button to add a new token to your account. You can type in the address of the token or use the QR code scanner and AeroWallet will automatically fill in the rest of the fields from the blockchain network.


Add Token fragment

After the token has been added, you will find it displayed in the token fragment along with all its details. You can now send tokens to any account of your choice by simply filling in the receiver's address and token amount.


Send Token fragment

Payment Sheet

One of the key selling features of the SBP SDK is our simple payment UI or payment sheet. This feature is embedded inside the SBP SDK and comes with a complete UI for your application's payment solutions. Error handling, null checking and balance checking are also added to the payment sheet.

There are a lot of possible use cases for the SBP SDK's payment sheet. Developers can easily use our payment solution to process in-app transactions. AeroWallet presents such a use case by showcasing an online marketplace where the transactions are processed by the SBP SDK's payment sheet.


Mobi DApp Marketplace

Ethereum Payment Sheet (ETH, ERC20, and ERC721 showcased in AeroWallet)

All the required information has been passed into the payment sheet. The gas fee will depend on the transaction speed of your choice. Payment sheet allows you to easily complete a transaction without the need of handling all your intricacies yourself.

Cucumber Web-View (DApp Browser)

Cucumber WebView is a customized webview dedicated to Web DApp. This allows users to integrate their Web DApp into their mobile with zero changes to their web code. Currently, CucumberWebView is capable of Javascript SDKs for Ethereum and Tron, more specifically:

  • Web3.js
  • TronWeb

Demo Ethereum Crypto Store

You can easily integrate your own crypto store or any other Web DApp using CucumberWebView. After the successful integration, the web DApp of your choice will be able to implement our built-in payment sheet activity of the SBP SDK that will cater to all your transaction needs. Use the addCoinServiceConnector method with your desired coinType to inject the CucumberWebView provider. This injection will allow you to delegate the sendTransaction of JavaScript API to our onSendTransaction method. You can use this to initiate the desired payment sheet or the SDK's available transaction APIs.


Payment sheet triggered through Cucumber Webview

The complete codebase of AeroWallet and API reference of the SBP SDK can be found here.