Understanding Samsung Blockchain Keystore

Keystore Introduction

Key players in the blockchain industry: User, Wallet and Node

In the blockchain industry, there are a few important key players: User, Wallet, and Node.

The User can use the blockchain technology to send or receive cryptocurrencies. A user can be an active user of blockchain-based applications, also known as DApps (Decentralized App) to raise a crypto asset, like a cute character in a game. The User may also post an interesting article on a blockchain-based SNS, where the user gets credits for the number of likes or comments from other users.

All of these use cases require the user to connect to the blockchain network. Wallet or DApps provide the user an interface to connect to the blockchain network, such as Bitcoin or Ethereum. Unlike the traditional wallets, blockchain wallets do not hold any money or an asset of the user, but simply show users a record of all transactions on the ledger that are related to the user’s account. When a user tries to send a certain amount of cryptocurrency to another user, the wallet creates a transaction in a correct format to submit to the blockchain network.

One of the key components of a transaction is a user’s signature. A wallet must be able to sign a transaction with the user’s private key. Some wallets generate a key pair in the wallet by itself and sign the transaction upon user’s request. Some may not generate the key pair itself, but instead, support the use of a separate hardware wallet, which will store the key and complete the signature part of a blockchain transaction. Nevertheless, because there is a fee that must be paid in order to write on the ledger of the blockchain network, a user’s signature that implies that the user has checked and approved the fee, cannot be emphasized enough.

Lastly, when a wallet or a DApp submits the signed transaction to the blockchain network, nodes, similar to server, checks the validity of the transaction and use a consensus protocol to agree whether to include the received transaction in the ledger or not. If it is included, then the transaction is now shared to everyone participating in the network.

Digital signature in blockchain
  • Using a digital signature in the blockchain is one of the fundamentals to understand the technology. The user’s digital signature implies many things. By signing the transaction, the user is confirming that the information in the transaction, such as the recipient address, amount, and fee, are all correct. The signature also guarantees the identity of the user. Only the user that actually holds the key can sign the transaction, because there will be a different result if a different key was used to sign the transaction. Digital signature provides non-repudiation as well, since it is a combination of the user’s key and the

Because there is no centralized server that controls the network in blockchain, it is impossible to cancel or reverse a transaction that has been submitted to the network. Hence, the biggest challenge that the wallets and DApps face is how to sign a transaction safely. To sign a transaction, a user’s private key is needed. In other words, the user’s private key is what must be kept in a safe place. Moreover, the execution environment, where the signing is happening, must be also safe.

Advent of hardware wallets

To avoid the security threats of computer viruses and other remote dangers in the web environment, hardware wallet came out into the world. Along with a print out, or a paper wallet, hardware wallet is one of the choices of Cold Wallet, a wallet that is not connected to the Internet. A hardware wallet usually has a separate space to create, store and use the private key. In such an isolated environment, hardware wallets are invulnerable to remote attacks.

Hardware wallets also have a separate secure display to get user’s confirmation of the blockchain transaction. The information shown by the hardware wallet’s screen is independently displayed from the host that it is connected to, such as the computer.

Yet, there are usability issues when it comes to using a hardware wallet. The user must carry the wallet around and make sure to keep that hardware wallet in a safe place. Also, the complexities and inconvenience of plugging the hardware wallet USB and running an online web app on the computer, and using the hardware wallet to sign a transaction still remain as a challenge.

Samsung Blockchain Keystore launched with Galaxy S10 series

At the beginning of the year 2019, Samsung Blockchain Keystore was launched with the Galaxy S10 series to store the user’s private key in the secure area of the phone and sign blockchain transactions in a safe environment. As a preloaded feature on selected devices in selected countries, Samsung Blockchain Keystore aims to contribute to the blockchain ecosystem to help users and blockchain apps leverage security features of the device and thus, safely use blockchain technology on the mobile.

Samsung Blockchain Keystore can be found by going to the device’s Settings > Biometric and Security. Under the Security category, you will see “Samsung Blockchain Keystore.”

Samsung Blockchain Keystore in Device Settings

With the Samsung Blockchain Keystore app, users can leverage features including key management, signing a transaction, setting up a PIN and a fingerprint as an authentication method, and managing Samsung Blockchain Keystore settings options. More details on each feature are as follows.

① Key Management

The user can create a new key pair (public and private key) or import an existing one that was created from other wallets. More specifically, Samsung Blockchain Keystore supports BIP-39 (Bitcoin Improvement Proposal) standard, and is a HD (Hierarchical Deterministic) Wallet. More details will be covered in the Key Management section.

Set up a wallet in Samsung Blockchain Keystore

In the set up page, “Create a new wallet” means generating a Master Seed, that can derive both a public key and a private key used to make Blockchain-based transactions, payments or contracts in Decentralized Apps or other wallet services that have integrated with Samsung Blockchain Keystore.

Because this Master Seed is about 128 to 256 bits of 0 and 1, and is not friendly to read nor remember, 12 to 24 words of recovery phrase can replace the Master Seed. Anyone who knows the Recovery Phrase can access and sign the blockchain transactions.

So the user will need to write down the 12 words and make sure not to lose it. Note that once the process is complete, Samsung Blockchain Keystore will NEVER ask the user to enter all the words again.

Create a new wallet in Samsung Blockchain Keystore

Import an existing wallet” means the user already has 12 to 24 words of recovery phrase, created in Samsung Blockchain Keystore on a different device, or from other wallets that support BIP-39 standard. Once the user enters the correct words of recovery phrase, the wallet will be imported and the set up process is complete. Likewise, once the process is complete, Samsung Blockchain Keystore will NEVER ask the user to enter all the words again.

Import an existing wallet in Samsung Blockchain Keystore
② Sign a Transaction

The user can send cryptocurrency or purchase a crypto item in blockchain apps that have been integrated with Samsung Blockchain Keystore. In the midst of proceeding a blockchain transaction, the user can check sensitive information of the transaction, such as the recipient address, sending the amount and the fee on a secure screen, called Trusted User Interface (TUI) executed by Samsung Blockchain Keystore, and confirm the transaction for Samsung Blockchain Keystore to sign it.

Transaction Confirmation screens by Samsung Blockchain Keystore
③ PIN and Fingerprint Management

During the process of setting up a wallet, the user will need to set up a six-digit PIN to protect the crypto assets. A PIN is a verification method for cryptocurrency transaction, payment and smart contract in Samsung Blockchain Keystore-integrated services.

If the user has a fingerprint registered on the device, then the user can also set up a fingerprint as the alternative authentication method.

The PIN or Fingerprint will be asked every time a user wants to sign a blockchain transaction, check confidential information, like the Recovery Phase, or change PIN.

Set up PIN and fingerprint as an authentication method in Samsung Blockchain Keystore
④ Manage Samsung Blockchain Keystore

Once the user has set up the wallet, when the user clicks “Samsung Blockchain Keystore” menu in the device’s Settings (Biometric and Security), the user will land on Samsung Blockchain Keystore’s main page, where the user can manage Samsung Blockchain Keystore-related options.

The user can change the PIN, enable or disable fingerprint as an authentication method, check Recovery Phrase and reset Samsung Blockchain Keystore. Other things, such as setting alarm notifications or connecting to a channel to send questions or comments to Samsung Blockchain team can be found here as well.

More information, such as How to Use, or Notices from Samsung Blockchain team, Terms and Conditions, and other information related to Samsung Blockchain Keystore are also available.

Samsung Blockchain Keystore Main Page
What will be covered?

Throughout this site, we will look deep into the Samsung Blockchain Keystore. The following items will be discussed.

  • Security considerations when building Samsung Blockchain Keystore and bringing the blockchain ecosystem onto the mobile.

  • Overall architecture of how Samsung Blockchain Keystore is designed and end-to-end service flow, including the exact role of Samsung Blockchain Keystore SDK that will be integrated into your app.

  • Security measures including the execution environment and how keys are generated will be explained in detail.

  • Benefits for developers integrating Samsung Blockchain Keystore SDK and what kind of services we welcome.

Blockchain on Mobile

Expansion of blockchain technology

In the last couple of years, the number of blockchain services and products continues to sky rocket. The fact that there is no centralized server needed makes it very attractive for many companies to jump into the blockchain business. Decentralized Apps (DApps) and wallets are thriving to become part of our everyday life, yet, often face usability and scalability obstacles. Creating a wallet to manage cryptocurrencies, or sending and receiving a cryptocurrency is not an easy task for normal users. User interaction is even harder when a user needs or wants to use a desktop wallet or a separate hardware wallet for key management.

Interestingly, many of the Decentralized Apps look very similar to the mobile apps that we use today, except for the fact that in the background, instead of using a centralized and private server, DApps run on the blockchain network. This leads us to conclude that in order to speed up the expansion of the blockchain ecosystem, it is critical to safely bring the blockchain technology onto mobile.

Inevitable security vulnerabilities when bringing blockchain technology onto mobile

When bringing blockchain technology onto mobile, there are inevitable security threats and vulnerabilities. Security measures to keep blockchain technology secure, yet transparent, etc. all have been integrated throughout the blockchain technology. Thus, the main concern is not the blockchain technology itself, but rather the mobile environment that the blockchain technology is executed in.

Because the wallet is the interface that signs and submits the transaction, it is often the main target for hackers. Since it is impossible to reverse a transaction that has been submitted, it is never enough to emphasize the importance of keeping and using the private key in a safe environment.

Possible attacks to extort the private key include malicious software that physically looks exactly the same as the screen where the user needs to enter the 12 to 24 Mnemonic Words to recover a wallet. Or create and show a malicious screen that suddenly asks the user to enter such crypto secrets in order to proceed with signing a transaction. Phishing, even crypto secrets, can all lead to the user losing the private key, an access to all the cryptocurrencies, and cryptoassets.

The display can also be maliciously modified so that user confirms and signs a fake transaction. For example, the address of the recipient displayed on the user’s screen could be maliciously modified so that user sends the cryptocurrency to the attacker, not to the intended recipient. Without any security measures to check the integrity of the transaction by the wallet, the user can sign and submit the transaction unconsciously.

These malicious attacks can result in the user losing a tremendous amount of cryptocurrencies or sending a crypto-asset to the attacker. Worst of all, the nature of blockchain makes it hard to track the attackers, and the user may never find out who caused the attack and stole the crypto assets.

  • Top qualities of a “good” blockchain wallet

    To address these security threats and vulnerabilities mentioned, Samsung Blockchain Keystore thoroughly evaluated and prioritized various security features, and came with the conclusion that the following qualities need to be supported in order to be a “good” blockchain wallet.

① Secure Display

In the blockchain network, the sensitive information in the transaction should never be tampered with. Sensitive information, especially used for user’s confirmation, must be shown on a safe and secure display.

② Secure Touch

What the user enters into the screen should be protected, and guaranteed to be not spoofed. Extremely sensitive information, such as the 12 to 24 Mnemonic Words that are equivalent to the user’s private key, or entering PIN as a means of user authentication, all must be done in a secure environment.

③ Secure Storage

The cryptographic secrets to sign a transaction implies both user’s identity and user’s confirmation. Hence, they must be completely isolated from other normal apps and such environment that can be susceptible to malwares.

④ Secure Computation

The environment where the user is creating a new wallet, or signing a transaction, etc. must all be executed in a secure environment. These should not be mixed with apps running in REE (Rich Execution Environment), where Android OS runs and also the environment that is vulnerable to remote attacks.

When developing Samsung Blockchain Keystore, security qualities mentioned above were taken into consideration and inherently applied into the service. Keeping these top qualities defined by Samsung Blockchain Keystore team in mind, we will cover the overall architecture of Samsung Blockchain Keystore and look into what makes Samsung Blockchain Keystore safe and different from other wallets.

Samsung Blockchain Keystore Architecture

Samsung Blockchain Keystore leverages the ARM’s TrustZone, which is one of the best known technology to implement Trusted Execution Environment (TEE) in mobile devices. Trusted Execution Environment (TEE) is a secure area inside a main processor. As an isolated environment, it makes sure that the code and data loaded in the TEE are protected from software attacks and vulnerabilities in the Rich Execution Environment (REE).

Samsung Blockchain Keystore Main Page

In parallel to the apps that we use every day in REE, there are Trusted Applications (TAs), authorized security software that run in TEE. Samsung Blockchain Keystore leverages this TEE and implements TAs to run operations that require a high level of security, such as generating keys and signing a transaction in the blockchain network.

Samsung Blockchain Keystore also provides users with a Trusted User Interface (TUI) that runs in the TEE, so that the display that the user sees is not maliciously modified, and user’s input is securely protected. This is feasible because the information displayed on the TUI is run by an approved Trusted Application and the input that the user entered is isolated from other applications that run in REE.

Moreover, the use of Samsung Knox allows Samsung Blockchain Keystore to guarantee that the device is running an approved binary and that the Kernel has not been tampered with. Samsung Blockchain Keystore will be disabled for compromised device in order to protect your data.

Architecture and Key Components

To understand Samsung Blockchain Keystore Architecture, we will first look at the key components: DApp/Wallet that has integrated Samsung Blockchain Keystore, Samsung Blockchain Keystore SDK, Samsung Blockchain Keystore app, and Trusted Execution Environment that Samsung Blockchain Keystore leverages.

Samsung Blockchain Keystore Architecture
Key Components
  • Decentralized Apps (DApps) and Wallets

    DApps and wallets usually provide users an interface to the blockchain network, by connecting to a node in the blockchain network. They help users manage cryptocurrencies or crypto-assets by creating and submitting a transaction to the blockchain network.

    DApps and wallets that have integrated Samsung Blockchain Keystore SDK can leverage Samsung Blockchain Keystore to get the user’s blockchain address, which is like a user’s account on the blockchain network. Also, after creating transactions, DApps and wallets can request Samsung Blockchain Keystore to sign transactions safely.

  • Samsung Blockchain Keystore SDK

    DApp and wallet developers can download Samsung Blockchain Keystore SDK from the Samsung Developers site, and integrate it. The SDK directly communicates with Samsung Blockchain Keystore.

  • Samsung Blockchain Keystore

    Samsung Blockchain Keystore is a preloaded app on selected Galaxy devices. When requests are received from DApps or wallets via the Samsung Blockchain Keystore SDK, the app controls operations and communicates with Trusted Applications that run in Trusted Execution Environment.

    In the Samsung Blockchain Keystore app, user can setup the wallet, edit settings, like enabling fingerprint as an authentication method or changing alarm settings for notifications, and get more information about the service.

  • Trusted Execution Environment (TEE)

    Samsung Blockchain Keystore leverages Trusted Execution Environment, where only authorized applications are able to be executed. Key features that are handled in this environment is generating Master Seed (root source of all the keys), parsing and showing transaction details, and signing a blockchain transaction. Also, Trusted User Interface (TUI) for secure display and user input protection is also executed in TEE.

End-to-End Service Flow

Taking one step further from the main components, the following is an end-to-end service flow of what happens when there is a request from a DApp or a wallet to Samsung Blockchain Keystore to sign a blockchain transaction.

Before we begin, there are two assumptions: (1) Samsung Blockchain Keystore is already set up and (2) Dapp/Wallet knows the user’s address, by deriving it from the Samsung Blockchain Keystore. In other words, the Master Seed, which is the root to many keys, is already generated in the TEE, and safely saved in Samsung Blockchain Keystore. Keeping this in mind, let’s look into each step.

Samsung Blockchain Keystore Service Flow
Application Screens
  1. 1.

    DApp/Wallet creates an unsigned blockchain transaction. The transaction could be triggered by the user to buy a crypto-asset, or send cryptocurrencies. Transaction details, like recipient address, amount, fees, and etc. are used to create a transaction.

  2. 2.

    DApp/Wallet uses Samsung Blockchain Keystore SDK to request Samsung Blockchain Keystore to sign the transaction.

  3. 3.

    Samsung Blockchain Keystore receives the transaction via the SDK and handles the operation request in order.

  4. 4.

    Controller in Samsung Blockchain Keystore that communicates with Trusted Application (TA) passes the transaction to TAs in the Trusted Execution Environment to parse the transaction details.

  5. 5.

    Samsung Blockchain Keystore displays the parsed transaction details on the Trusted User Interface, which also runs in the Trusted Execution Environment.

  6. 6.

    The User checks the transaction details on the Trusted User Interface and manually confirms that all the transaction details is correct by either entering PIN or authenticating with a fingerprint.

  7. 7.

    Samsung Blockchain Keystore signs the transaction with the key derived from the Master Seed in the Trusted Execution Environment.

  8. 8.

    Transaction signed by TA in Samsung Blockchain Keystore is now returned to Samsung Blockchain Keystore app.

  9. 9.

    Through Samsung Blockchain Keystore SDK, Samsung Blockchain Keystore returns the signed transaction to DApp/Wallet.

  10. 10.

    DApp/Wallet receives the signed transaction and submits it to the blockchain network. Once the transaction is confirmed by the nodes, it is applied on the blockchain ledger.

Key Management

In this section, we will cover general terms – public key, private key, and an address, and how Samsung Blockchain Keystore generates and manages these keys. Samsung Blockchain Keystore is a Hierarchical Deterministic (HD) Wallet and follow the industry standards of BIP-32, BIP-39 and BIP-44. (BIP stands for Bitcoin Improvement Proposal). By implementing these standards, Samsung Blockchain Keystore aim to provide better user experience to back up the wallet, since the user only needs to keep the root seed of the private and public keys safe. It is just the 12 words generated from Samsung Blockchain Keystore that user needs to remember or write down. We will look into how this is achieved by implementing Hierarchical Deterministic Wallet in Samsung Blockchain Keystore.

Public Key, Private Key, and Address

The Key pair is mandatory to participate in the blockchain network. This key pair is composed of a public key and a private key. Public key is used to derive an address that is used like a user’s account in blockchain. It is safe to share the public key or the address with others. On the other hand, a private key is used to sign transactions and must be kept secret. Anyone who has access to the private key can sign transactions and spend cryptocurrency or use crypto-assets without user’s permission.

Key Function Algorithm Key Function Algorithm

Simply put, the private key is a random number. Based on the private key, there are algorithms, like Elliptic Curve Digital Signature Algorithm (ECDSA) that derives the public key. This algorithm may differ depending on the blockchain platform. But one interesting characteristic of a public key is that it is derived from a private key, but the other way around is not possible – public key cannot derive nor predict the private key. The same relationship applies to the public key and the address. Address, which is used like a user’s account, cannot derive any public keys.

Since a private key is a random number, this implies that the randomness of a private key generation must be guaranteed. Yet, software random number generators, also known as pseudo random number generators, are known to have security vulnerabilities.

Because the public key and address format differs by blockchain platforms, user needs to have one key pair for Ethereum, another key pair for Bitcoin, and etc. If a user wants several accounts for Ethereum, then that many number of key pairs will be required. Moreover, Bitcoin uses countless number of accounts, because after a transaction has been made, any Bitcoin changes after the transaction is returned to a different account of the user’s. In other words, it becomes very complex and inconvenient if a user would have to save a key pair for every blockchain account that the user holds. Samsung Blockchain Keystore aims to reduce this by implementing Hierarchical Deterministic wallet.

Hierarchical Deterministic Wallet (HD Wallet)

Hierarchical Deterministic wallet allows these multiple key pairs to be derived from a single root seed called, “Master Seed.” Master Seed is the root of a large tree of public and private keys. This Master Seed is the only thing that user needs to store and back up. This is the key to access all of your crypto secrets, so how it is generated and stored should be kept in a secure environment.

Master Seed is between 128 and 256 bits and because the physical look of Master Seed is not very user friendly, and is a combination of “0” and “1”, there is an industry standard, to replace them with Mnemonic Words, or a group of words. For example, if the Master Seed is 128 bits, then with the checksum of 4 bits, a total of 132 bits is split into a group of 11 bits. Each group falls into a group number between 0 and 2047, which is an index to a wordlist of 2048 words. These index numbers are then converted into the corresponding words and the combination of 12 words make up “Recovery Phrase” in Samsung Blockchain Keystore.

Generating Master Seed and Mnemonic Words in Samsung Blockchain Keystore
Master Seed Generation Master Seed Generation

Samsung Blockchain Keystore generates the Master Seed by Trusted App in Trusted Execution Environment, by the steps below:

True Random Number Generator Generating Master Seed

① True Random Number Generator (TRNG), also known as Hardware Random Number Generator, that is embedded into Samsung device chipsets, generates an initial entropy length (ENT) of 128 random bits. Elaborating more on ENT, industry standard allows 128 to 256 bits, in multiple of 32 bits. Depending on the length of the initial entropy length, the number of words that this will be converted into will differ, from 12 to 24, in multiple of 3.

Samsung Blockchain Keystore takes the first 4 bits of the SHA-256 hash of the 128 bits to generate something called, “checksum.” Theoretically, it is ENT/32 that is taken to generate the checksum. So for Samsung Blockchain Keystore, ENT is 128 bits, resulting in 4 bits of checksum. For other wallets that generate 24 words with the ENT of 256 bits, 8 bits are used as a checksum.

Samsung Blockchain Keystore appends the previously generated 4 bits of checksum to the initial entropy length, resulting in 132 bits.

Sample of Mnemonic Codes Sample of Mnemonic Codes

④ 132 bits (combination of initial entropy length and checksum) are divided into 11 bits, resulting in 12 words, “Mnemonic Codes”. These 12 words are industry standard, and is one of the 2048 words on the BIP-39 English Wordlist.

Because the 12 words follow BIP-39 standard used in the industry, user can back up wallet on a different Samsung device that supports Samsung Blockchain Keystore, or other wallets that are BIP-39-compatible.

Importing a Wallet

When a user imports a wallet in Samsung Blockchain Keystore, the user will enter the 12, 18 or 24 words into the Trusted User Interface (TUI) that will protect user’s input. This time, Samsung Blockchain Keystore will convert the Mnemonic Words entered in order to the original Master Seed. The Master Seed is the one and only source that Samsung Blockchain Keystore will save in a secure area. Likewise, this will become the source to generate countless number of public keys and sign transactions with the private keys when a request is made.

Randomly entering Mnemonic Words to guess Recovery Phrase

Some may raise a question on the feasibility of guessing the words among 2048 words on the Mnemonic Words list and somehow, getting access to the private key that corresponds to the Recovery Phrase. But it’s not just the words of 12 to 24 in multiple of 3, that have to correctly chosen, but the order of these words have to be correct as well.

This is because if you are using 12 words, then 128 bits must be correctly guessed, and 266 bits for 24 words. Choice between 0 and 1 on 128 bits give us 2 x 2 x 2 x … 2 = 2128 of the possible Master Seeds, and 2^256 cases for 24 words.

Moreover, the checksum of 4 bits for 12 words, and 8 bits for 24 words, protects randomly making a combination of words. When importing a wallet in Samsung Blockchain Keystore, there is a checksum check after user has entered 12, 18 or 24 words, and it will throw an error that the combination of words entered isn’t a valid recovery phrase. The user will receive absolutely no information on which words make the checksum invalid, making it even more difficult to randomly guess the Recovery Phrase.

HD Path
HD Path / Tree HD Path / Tree

The HD Wallet is a tree of theoretically infinite number of private and public keys. One interesting fact is that it allows derivation of a child keys from the Master Seed via a function defined in BIP-32 standard, “Child Key Derivation (CKD) functions.” This means with the Master Seed and the location of the tree, key derivation is feasible. More details on the key derivations can be found in the Appendix.

The location in the tree is called a “path” and BIP-44 standard defines the standard to unify rules for wallet’s compatibility of these HD Key Generation. Hence developers just need to specify the path to derive the address from, and whoever keeps the Master Seed will be able to calculate and return the actual key value for that specified location. Each depth is represented by “/” in the HD Path and the apostrophe (‘) implies that the depth is hardened.

The following is HD Path level standard defined in BIP-44.

HD Path / Tree
  • purpose’ is “44” here, with the implication that it is the following BIP-44 standard.

  • coin_type’ tells if it is Ethereum, Bitcoin, or other coins. The algorithms to derive the public key from the private key can differ by the coin type, though both Ethereum and Bitcoin use ECDSA algorithm. The number is constant and set for each crypto, and it can be registered in SLIP-0044 (SLIP: SatoshiLabs Improvement Proposals), managed by SatoshiLabs. For example, it is “0” for Bitcoin, and “60” for Ethereum.

  • account‘ represents multiple accounts number and is usually ‘0’.

  • change is usually used in Bitcoin, using “1” for the account to receive all the changes after sending Bitcoins to other accounts. Normally, “0” is used.

  • address_index is the last depth, and usually starts with 0, and increases by one, when you “add” an account in a wallet.

For example, HD Path for the first account of Ethereum is:
m / 44’ / 60’ / 0’ / 0 / 0
and for the second account of Bitcoin is:
m / 44’ / 0’ / 0’ / 0 / 1

Use of HD Path in Samsung Blockchain Keystore

Samsung Blockchain Keystore can be used to (1) derive an address or extended public key and (2) sign a transaction. To consume these two features, developers of DApps or wallets will need to define, where in the HD tree, they would like to derive the public key from, and use the corresponding private key to sign the transaction. HD Path is a required parameter for APIs related to the two features below.

  • Get address from Samsung Blockchain Keystore
    If you are a DApp or wallet developer, you can use Samsung Blockchain Keystore to first get the user’s address or extended public key (public key and the chain code), and search on the blockchain ledger, transaction history and records of the user, so that user can know how much cryptocurrency or crypto-asset is remaining. Here’s a brief flow of getting the address.

    Locating the Address and Public Key Locating the Address and Public Key

    Wallet or DApps will make a request to Samsung Blockchain Keystore to derive an address or extended public key for HD Path “m/44’/60’/ 0’/0/0” (Ethereum account).

    Using Samsung Blockchain Keystore SDK, Wallet/DApp’s request will be passed to Samsung Blockchain Keystore.

    Once Samsung Blockchain Keystore will receives the request to get the address or extended public key, it will pass onto the controller to communicate with Trusted App to derive the public key.

    Master Seed is stored safely in a secure area, and the derivation of the extended public key (public key and the chain code) of the HD Path, is executed by Trusted Application in Trusted Execution Environment.

    Derived public key will be then passed to Samsung Blockchain Keystore app to derive the address, where one more algorithm function will be executed.

    After the calculation, the address that corresponds to the requested HD Path will be returned to Wallet or DApp via Samsung Blockchain Keystore SDK.

  • Sign a transaction by Samsung Blockchain Keystore
    The user will now want to make a transaction, such as sending cryptocurrencies, that will require the user to “write” on the ledger. This change needs to be signed by the private key that corresponds to the user’s address, derived from user’s public key. Below is a diagram and explanation for each step.

    Transaction Signing Transaction Signing

    Wallet or DApps will make a request to Samsung Blockchain Keystore to sign a transaction. A correctly formatted transaction without the signature part, and HD Path to derive the private key to sign the transaction will be needed.

    Using Samsung Blockchain Keystore SDK, Wallet/DApp’s request will be passed to Samsung Blockchain Keystore.

    Once Samsung Blockchain Keystore will receives the request to get the public key, it will pass onto the controller to communicate with Trusted App.

    Trusted App will first parse the transaction, and show critical information on TUI, such as recipient address, amount and fees. After user checks the transaction details, user will confirm it via PIN verification or fingerprint authentication.

    After the user’s confirmation, the safely stored Master Seed will now be used to derive the private key that corresponds to the HD Path that was passed with the transaction request. Then the Trusted Application will sign the transaction with the derived private key. Likewise, these are all executed in Trusted Execution Environment.

    The signed transaction will be returned to Samsung Blockchain Keystore app.

    Samsung Blockchain Keystore app will return the signed transaction to Wallet/DApp via Samsung Blockchain Keystore SDK and Wallet/DApps can now submit the signed transaction to the blockchain network.

More details on the BIP-32, BIP-39 and BIP-44 can be found in the following links.

BIP-32: Hierarchical Deterministic Wallets


BIP-39: Mnemonic Code for generating deterministic keys


BIP-44: Multi-Account Hierarchy for Deterministic Wallets


SLIP-44: Registered coin types for BIP-0044


What makes Samsung Blockchain Keystore Unique?

The main function of a general keystore is to generate keys and store them in a safe place. In the blockchain industry, a wallet can use various open source libraries to generate the keys. Other option could be integrating with a hardware wallet.Unlike Android Keystore, which is used for general purpose, the name, “Samsung Blockchain Keystore” implies that Samsung Blockchain Keystore is a keystore that is dedicated to support blockchain transactions. Keeping this in mind, let’s look at some features that make Samsung Blockchain Keystore unique from other keystores.

  • Support blockchain-specific algorithms : ECDSA with secp256k1 curve for Bitcoin and Ethereum

    Algorithms used to generate keys and signatures are different by cryptocurrency. For example, ECDSA (Elliptic Curve Digital Signature Algorithm) with secp256k1 curve is needed for Bitcoin and Ethereum. Samsung Blockchain Keystore supports algorithms specifically used for such cryptocurrency transactions.

  • Parse blockchain transactions

    Samsung Blockchain Keystore parses blockchain transactions in a safe environment, and show the transaction details to the user. A normal keystore usually does not parse any information to be signed, and focus on signing only.

  • Secure Display and Secure Touch: Trusted User Interface

    Trusted User Interface (TUI) is a general term that includes trusted display and trusted touch that are accessible by only the authorized Trusted Applications that run in the TEE. Samsung Blockchain Keystore leverages TUI in TEE to display sensitive information and protect user’s input.

    For instance, normal apps running in REE could maliciously show the recipient’s address or transfer amount that are different from what is actually included in the transaction. But because Samsung Blockchain Keystore leverages TEE to use TA to parse the transaction details and show the actual details on TUI, where the information can never be tampered with, user will be able to distinguish maliciously modified transactions

    The following are TUI screens run by Samsung Blockchain Keystore.

    Transaction Signing
    Transaction Signing Trusted User Interface Screens


PIN input screen is used to (1) Register PIN and (2) Confirm PIN when user authentication is needed. When creating or importing a wallet, user needs to set up PIN first. User will be asked to enter the registered PIN when making transactions and checking Recovery Phrase again. User’s input of PIN in all these cases are run in an isolated environment, by TUI.

[Recovery Phrase]

Recovery Phrase that represent the Master Seed and countless number of private keys, hence the secure display to show this Recovery Phrase cannot be emphasized enough.

[Double Checking Recovery Phrase]

To complete creating a wallet, user must enter a few random words of the Recovery Phrase to confirm that user has written down the 12 words in a safe place. User’s input is protected here.

[Enter Recovery Phrase]

When importing a wallet that was created from a different wallet, like a hardware wallet or Samsung Blockchain Keystore on a different device, user has to enter the 12 to 24 words. Likewise, what user enters is protected via TUI, including the keyboard.

[Transaction Confirmation]

Regarding transaction confirmation, after parsing the transaction by a Trusted Application in TEE, Samsung Blockchain Keystore will show selected sensitive transaction details on TUI. The sensitive information differs depending on the blockchain platform, but most of them focus on the amount to transfer, recipient address and fee.

  • Secure Computation: Trusted Execution Environment

    Trusted Applications and Trusted User Interface are all run in Trusted Execution Environment, an isolated environment. This means normal applications and malware that run in Rich Execution Environment (REE) will have no access to any information in TEE. Likewise, Samsung Blockchain Keystore will be able to prevent users from confirming maliciously modified transaction.

  • User’s Manual Confirmation

    In order to sign a transaction via Samsung Blockchain Keystore, the user must manually confirm by clicking confirmation button and enter PIN or authenticate with a fingerprint. A normal keystore usually completes its function by generating a key and making a digital signature. But Samsung Blockchain Keystore prioritizes the user confirmation via a TUI feature in the belief that user’s explicit agreement is the most critical step in signing a transaction. Hence, it is impossible for malicious apps to acquire a user’s signature from the background or sign a transaction without the user knowing it.

  • Parse blockchain transactions

    Samsung Blockchain Keystore parses blockchain transactions in a safe environment, and show the transaction details to the user. A normal keystore usually does not parse any information to be signed, and focus on signing only.

  • Support algorithms for signatures

    Keys are generated differently depending on the type of algorithm used. For example, ECDSA (Elliptic Curve Digital Signature Algorithm) is applied for Bitcoin and Ethereum. Some cryptocurrencies consume a different algorithm as a standard. Because Samsung Blockchain Keystore is specific to blockchain, algorithms to generate keys and sign blockchain transactions are supported.

  • True Random Number Generator (TRNG)

    We saw that a keystore generates keys. But whether the randomness of the key is guaranteed so that the key cannot be predicted in any other way is another question. Generating this random key in a software environment is known to have security vulnerabilities. Samsung Blockchain Keystore leverages a True Random Number Generator (TRNG) feature from the device to guarantee randomness from a hardware level.

  • Safe key storage

    Once the keys are generated, where and how safely the keys are stored is important. Hardware wallet was originally designed with the purpose to store the keys in a separate environment. Similarly, Samsung Blockchain Keystore stores the encrypted Master Seed that generates numerous keys, in the Secure File system, where normal apps will not have access to nor be able to decrypt the file.

Integrating Samsung Blockchain Keystore SDK

Integration Benefits

Samsung Blockchain Keystore leverages security measures that are inherent in a safe execution environment, also known as Trusted Execution Environment (TEE).

By integrating with Samsung Blockchain Keystore, Decentralized App or Wallet developers can make your app secure. Developers no longer will have to worry about key management, from how guarantee the randomness of key generation, how to store the Master Seed safely, and to how to use it to sign a transaction in a secure environment. Even if an app running in REE maliciously modified display and tried to make user sign a fake transaction, Trusted User Interface (TUI) run in TEE by Samsung Blockchain Keystore will make sure that the user can manually check and confirm the exact transaction details.

The user will also have the ownership to keep keys safe on the device itself, no longer having to rely upon other third party servers. User will manually confirm all the transactions and make sure that there is absolutely no transaction that the user does not know about.

Integrations that Samsung Blockchain Keystore team look for

Because Samsung Blockchain Keystore is a preloaded app on selected Galaxy devices, Samsung Blockchain Keystore SDK is also designed for only native Android apps for now. Decentralized Apps and wallets must support a native Android app to integrate the SDK. For web-based apps, please refer to Samsung Blockchain SDK (not Keystore) for integration.

Samsung Blockchain Keystore welcomes integrations of Decentralized Apps and wallets in diverse areas. We will be excited to have Samsung Blockchain Keystore SDK integrated into services that provide intuitive user interaction with the blockchain and easy use of the blockchain technology. For applications that seek to provide good, long-run blockchain services with greater security, do not hesitate to make this quick integration with Samsung Blockchain Keystore.

Decentralized Apps and wallets can use Samsung Blockchain Keystore for selected Samsung devices that support Samsung Blockchain Keystore and other keystore or wallets for devices that do not support it. Samsung Blockchain Keystore SDK provides an API to check whether it is supported by the device or not, so diverging keystores within the DApp or wallet should not be an obstacle.

The smart phone is the bridge that can bring blockchain technology one-step closer to our everyday lives. With Samsung Blockchain Keystore, we anticipate to contribute to expanding the blockchain ecosystem, helping users use blockchain services more conveniently, but with greater security.

So why not secure your app with Samsung Blockchain Keystore and join us in expanding this blockchain ecosystem!