Using the SBlockchain class

The following code shows how to use SBlockchain class methods:

try {
    mSblockchain = new SBlockchain();
} catch (SsdkUnsupportedException e) {
     if (e.getErrorType() == VENDOR_NOT_SUPPORTED){
         Log.e("error", "Platform SDK is not support this device");    

The SBlockchain class provides the following methods:

  • Initialize(Context) - Initializes an instance of the Samsung Blockchain SDK.

  • getAccountManager - Returns the AccountManager that manages the Account. The AccountManager is a singleton instance.

  • getHardwareWalletManager - Returns the HardwareWalletManager managing the HardwareWallet. The HardwareWalletManager is a singleton instance.

  • getSupportedHardwareWallet - Get supported hardware wallet types of Blockchain SDK.

  • getVersionCode - Returns the version number of the Samsung Blockchain SDK.

  • getVersionName - Returns the version name of the Samsung Blockchain SDK.

Using the initialize() method

The SBlockchain initialize method:

  • Initialize SBlockchain instance.

  • Checks if the Samsung device is supported.

If the initialization of SBlockchain failed, the initialize() method throws an SsdkUnsupportedException exception. To find out the reason for this exception, check the exception message.

Handling SsdkUnsupportedException

If an SsdkUnsupportedException exception is thrown, check the exception message type using SsdkUnsupportedException.getType().

The following type of exception message needs to be handled: VENDOR_NOT_SUPPORTED: The device is not a Samsung device

Using the CoinNetworkInfo class

Basically, the Platform SDK does not provide a specific blockchain node information that we want to interact with.

The Platform SDK interacts with the blockchain network that the developer created. To use APIs that needs blockchain node interaction, use the CoinNetworkInfo instance that was created by the constructor. This class requires CoinType, NetworkInfo and JSON-RPC URL String. If you don’t have your own JSON-RPC server, is recommended as it can be used as a free trial.

CoinNetworkInfo mCoinNetworkInfo =
                   new CoinNetworkInfo(
                           "{Node Url}" //ex.

After creation, you can use CoinNetworkInfo instance to SDK’s APIs like a getCoinService.

EthereumService etherService =
                        (EthereumService) CoinServiceFactory

If you want to use the same CoinNetworkInfo every time, those values must be managed somewhere.