Quantcast
Jump to content


Recommended Posts

Posted

Distributed ledger-based technologies are becoming more popular and easy to use. Anyone can now build a new cryptocurrency or token in the Blockchain world. This rise in popularity and value makes crypto assets a big target for hackers. If you want to keep your valuable crypto assets safe, using a hardware cold wallet such as Trezor or Ledger Nano S has become a necessity. Unfortunately, that adds up to one more item in your pocket that you always have to carry around.

Thankfully, gone are the days of carrying clunky, old wallets. Recent Galaxy phones, such as the S10e, S10, S10+, and Fold, can now securely store your cryptocurrency wallet using the Samsung Blockchain Keystore (SBK). Along with storing your cryptocurrency wallet, the SBK SDK allows you to get your Blockchain address and sign cryptocurrency transactions.

In this article, we explore one of the key features offered by the Keystore SDK–how to get your Blockchain address from the SBK SDK and three ways to share it:

  • Display as QR code
  • Copy to clipboard
  • Share through Android’s share intent

Setting up the Project and Handling SBK Data

To set up your Android project with the SBK SDK, follow these instructions.

To use functionalities offered by the SDK, first fetch an instance of the service.

private ScwService mScwService = ScwService.getInstance();

After you have fetched the ScwService instance, you can check whether your device is Keystore-supported.

if (mScwService == null) {
    Log.e("KeystoreApp", "Keystore is not supported on this device.");
}

If the device is Keystore-supported, you can fetch the address list with getAddressList():

mScwService.getAddressList(addressListCallback, hdPathList);

The first parameter to getAddressList() is a ScwGetAddressListCallback, which is executed after getting a response from Keystore. ScwGetAddressListCallback() has two functions:

  • onSuccess(): This function is called when the address list has been fetched successfully from Keystore.
  • onFailure(): This function is called if any errors occur while fetching the address list from Keystore.
ScwService.ScwGetAddressListCallback addressListCallback = new ScwService.ScwGetAddressListCallback() {
    @Override
    public void onSuccess(List addressList) {
        //You can share your address from the address list here
    }

    @Override
    public void onFailure(int failureCode) {
        //Based on the failure code you can show appropriate alerts here
    }
};

The second parameter is an ArrayList of Hierarchical Deterministic (HD) Path(s) whose addresses you want to fetch. If you want to learn more about HD paths, please refer to BIP-44. For example, if you want to find the public address of your first five accounts, pass the following list as a parameter:

ArrayList hdPathList = new ArrayList<>();
hdPathList.add("m/44'/60'/0'/0/0");
hdPathList.add("m/44'/60'/0'/0/1");
hdPathList.add("m/44'/60'/0'/0/2");
hdPathList.add("m/44'/60'/0'/0/3");
hdPathList.add("m/44'/60'/0'/0/4");

A Sample App with the SBK SDK

Now that we are familiar with getAddressList(), let’s dive into our sample application. Features of our Public Address with SBK app are:

  • Fetch your public address from the Keystore
  • Switch between multiple public addresses
  • Display QR code of the selected account
  • Copy selected address into the clipboard
  • Send the selected address with supported applications with Android’s share intent

Initially, only the address of the first account is loaded. When you press the Add button, the HD path of a new account is added to hdPathList, and public addresses are fetched.

public void addAccount(View view) {
    //Account Index is incremented by 1 to get the new account
    accountIndex++;
    //HDPath of new account is added to hdPathList
    hdPathList.add("m/44'/60'/0'/0/" + accountIndex);
    showToast("HDPath Added to list");
    //Public Address of new account is fetched
    getPublicAddress();
}

Public addresses are fetched using the getPublicAddress() function depicted below.

If the address list is fetched successfully, onSuccess() is called, and:

  • The spinner’s previous data is cleared.
  • The newly fetched list is added to the spinner.
  • The UI is updated.

If an error occurs, it is logged and available from logcat. Common errors such as ERROR_INVALID_SCW_APP_ID can be fixed very easily by enabling Developer Mode from the Keystore application. You can find instructions on how to enable Developer Mode here.

private void getPublicAddress() {
    ScwService.ScwGetAddressListCallback addressListCallback = new ScwService.ScwGetAddressListCallback() {
        @Override
        public void onSuccess(final List publicAddressList) {
            //After Address List has been fetched Spinner is updated with new list
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    //Clear existing list
                    spinnerAdapter.clear();
                    //New list is added
                    spinnerAdapter.addAll(publicAddressList);
                    spinnerAdapter.notifyDataSetChanged();
                    if (publicAddressList.size() == 1) {
                        showToast(publicAddressList.size() + " address fetched.");
                    } else {
                        showToast(publicAddressList.size() + " addresses fetched.");
                    }
                }
            });
        }

        @Override
        public void onFailure(int errorCode) {
            switch (errorCode) {
                case ScwErrorCode.ERROR_INVALID_SCW_APP_ID:
                    Log.e(LOG_TAG,"Developer option not enabled.");
                    break;
                case ScwErrorCode.ERROR_CHECK_APP_VERSION_FAILED:
                    Log.e(LOG_TAG,"Check internet connection.");
                    break;
                case ScwErrorCode.ERROR_OP_FAIL:
                    Log.e(LOG_TAG,"Operation Failed");
                    break;
                default:
                    Log.e(LOG_TAG,"Error with Error Code: "+errorCode);
                    break;
            }
        }
    };
    if (mScwService == null) {
        Log.e(LOG_TAG, "Keystore is not supported in this device.");
    } else {
        //If Keystore is supported on device address list is requested
        mScwService.getAddressList(addressListCallback, hdPathList);
    }
}

After loading all addresses into the spinner, we can now select any address from it. Once an address is selected, its QR Code is generated and displayed.

publicAddressSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
    @Override
    public void onItemSelected(AdapterView<?> adapterView, View view, int position, long l) {
        //Get Selected Address from spinner
        selectedAddress = adapterView.getItemAtPosition(position).toString();
        selectedAddressTextView.setText(selectedAddress);
        qrCodeImageView.setImageBitmap(generateQRCode(selectedAddress));
    }

In this application, we used “ZXing” to generate the QR bitmap of the selected public address.

private Bitmap generateQRCode(String text) {
    MultiFormatWriter multiFormatWriter = new MultiFormatWriter();
    Bitmap bitmap = Bitmap.createBitmap(10, 10, Bitmap.Config.RGB_565);
    try {
        //Text encoded to QR BitMatrix
        BitMatrix bitMatrix = multiFormatWriter.encode(text, BarcodeFormat.QR_CODE, 1000, 1000);
        BarcodeEncoder barcodeEncoder = new BarcodeEncoder();
        //QR Bitmatrix encoded to Bitmap
        bitmap = barcodeEncoder.createBitmap(bitMatrix);
    } catch (WriterException e) {
        e.printStackTrace();
    } finally {
        return bitmap;
    }
}

When you press the copy button, the address is copied to the clipboard.

public void copyAddress(View view) {
    ClipboardManager clipboardManager = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
    ClipData clipData = ClipData.newPlainText("Public Address", selectedAddress);
    clipboardManager.setPrimaryClip(clipData);
    Toast.makeText(this, "Address Copied", Toast.LENGTH_SHORT).show();
}

We can also share the selected public address using the Android ACTION_SEND intent.

public void shareAddress(View view) {
    Intent sendIntent = new Intent();
    sendIntent.setAction(Intent.ACTION_SEND);
    sendIntent.putExtra(Intent.EXTRA_TEXT, selectedAddress);
    sendIntent.setType("text/plain");
    startActivity(sendIntent);
}

Conclusion

Now that you know more about the Samsung Blockchain Keystore SDK, you can use it to enrich your Blockchain application. For more resources on Keystore SDK, visit https://developer.samsung.com/blockchain/keystore/sdk.

View the full blog at its source



  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Similar Topics

    • By Samsung Newsroom
      Samsung Electronics today announced SmartThings Pro and next-generation display technologies for its award-winning digital signage lineup. The announcement is part of the company’s participation at InfoComm, the largest professional audio-visual industry trade show in North America, held in Las Vegas from June 12 to 14.
       
      At Booth W1225, Samsung will showcase SmartThings Pro, an evolution of SmartThings with business-focused capabilities; Samsung Color E-Paper, an ultra-low power, lightweight and slim digital paper display; exclusive new generative AI functions for the Interactive Whiteboard (WAD series); and the new Samsung Business TV BED series, a UHD TV with flexible functionality for businesses across different sectors. These solutions will be displayed throughout InfoComm, with Samsung providing demonstrations and educational sessions to highlight the products’ wide-ranging benefits.
       
      “We are pleased to introduce a variety of new solutions, services and products at this year’s InfoComm,” said Hoon Chung, Executive Vice President of Visual Display Business at Samsung Electronics. “Building on our legacy of being ranked No.1 in signage sales for 15 consecutive years, we are using this event to showcase our latest solutions that cater to diverse business needs.”
       
       
      SmartThings Pro Brings New Intelligence to Business Environments

       
      SmartThings Pro extends Samsung’s hyper-connected smart home technology to business environments, enhancing sustainability, automating operations and improving the overall business experience. To better support business-to-business (B2B) customers, SmartThings Pro offers customizable Application Programming Interfaces (APIs) for seamless integration. It also features AI Energy Mode, an intelligent power saving technology that reduces energy consumption based on ambient brightness, content analysis and motion detection. This energy-saving algorithm is available for Samsung products connected to the SmartThings Pro ecosystem.
       
      Additionally, SmartThings Pro enables users to check the connection status of various IoT devices through a user-friendly dashboard. This dashboard provides AI to analyze connected devices, helping users use their devices more efficiently and adopt energy-saving practices.
       

       
      Beyond individual users, SmartThings Pro will also improve the general operations of connected devices in corporate environments, including SMART Signage, hospitality displays, air conditioning systems, digital appliances and much more. It also helps corporate clients manage various environmental factors such as temperature, humidity, lighting more effectively by linking various IoT products. It also integrates sensors like cameras to enhance monitoring and control capabilities. These features help users automate daily configurations and setups, resulting in more efficient and sustainable operations while reducing overall business costs.
       
      Many of Samsung’s partners already plan to use the available APIs. Some of these partners include:
       
      Cisco, which will demonstrate API integrations with Cisco video devices at InfoComm and show how to integrate them with Webex Control Hub for scaled deployments. Aqara, which will enhance the Smart Hotel experience through co-operating experiences. Quividi, which will build a retail analytics solution with its online data center, VidiCenter, leveraging its new partnership with Samsung.  
      “We will further enhance Samsung’s IoT solutions for the B2B market through SmartThings Pro,” said Chanwoo Park, Executive Vice President at Samsung Electronics. “Our customized solutions strengthen display performance in apartment buildings, residential spaces, public facilities like schools and commercial spaces like retail, hotels and offices. SmartThings will not only improve performance for these operators, but it will reduce cost.”
       
       
      Color E-Paper: Extremely Efficient, Lightweight and Slim Display for Businesses

       
      Samsung will unveil its ultra-low power display, Samsung Color E-Paper (EMDX model), for the first time at InfoComm. Seamlessly blending digital ink with innovative full-color e-paper technology, this new signage can replace analog or paper promotional materials.
       
      The new product offers a more eco-conscious alternative to traditional promotional methods while delivering the high-visibility signage businesses need. The Samsung Color E-Paper operates at 0.00W1 when displaying static image and consumes significantly less power than traditional digital signage when changing images. Additionally, managers can remotely control the Color E-Paper, setting schedules to save energy with automatic wake-up and sleep times.
       

       
      The 32-inch screen is equipped with QHD (2,560 x 1,440) resolution and a 60,000-color gamut (six colors per pixel: red, yellow, green, blue, white and black). Weighing only 2.9kg and measuring 17.9mm in width,2 it can be seamlessly installed in various locations, such as walls, tables or even ceilings, without additional mounts. This flexibility allows businesses and advertisers to deploy the Color E-Paper in multiple locations to effectively engage audiences while reducing operational costs.
       
      Samsung Color E-Paper includes a dedicated mobile app3 that allows users to easily create or change content. It also supports the Samsung VXT solution, enabling real-time monitoring and remote integrated management of multiple displays simultaneously. The VXT CMS Canvas also offers a variety of templates optimized for E-paper displays, making it easier to produce content across different verticals.
       
      For charging and data transmission, the Color E-Paper features two USB-C type ports and supports Wi-Fi and Bluetooth. It also includes 8GB of flash memory, an interchangeable bezel that allows users to change colors of the frame4 and VESA5 standard wall mount compatibility6 to provide users with enhanced connectivity, customization options and flexible mounting solutions.
       
      The Color E-Paper panel utilizes the innovative E Ink Spectra 6 technology, a groundbreaking color solution designed for in-store advertising, indoor signage and replacing paper posters. It features an enhanced color spectrum and advanced color imaging algorithm to improve marketing and advertising performance.
       
      “We’re excited to announce our partnership with Samsung to unveil the innovative 32-inch E Ink Spectra 6 for the signage market,” said Dr. FY Gan, President of E Ink Holdings. “This collaboration highlights our commitment to a brighter future with display solutions. By merging E Ink’s cutting-edge color e-Paper technology with Samsung’s signage expertise, we are poised to deliver low-power color displays that revolutionize digital promotion and communication, while enhancing sustainability strategies.”
       
       
      Interactive Whiteboard: AI Capabilities Boost the Learning Experience

       
      First announced at ISE,7 the Interactive Whiteboard (WAD series) will make a grand entrance at InfoComm, loaded with new features that include generative AI capabilities.
       
      New AI-powered features include automatic transcriptions from spoken lessons and the ability to generate detailed class summaries that highlight key points and main topics. By analyzing the teacher’s voice transcription, the written material on the display and provided educational materials, it can also generate quizzes for students. It also uses machine learning to improve content accuracy and block inappropriate content.
       
      Additionally, through a collaboration with educational technology company Merlyn Mind, the display will feature voice recognition technology optimized for educational environments. This will simplify control of the Interactive Display and help tailor its functionalities to align with school-specific curricula.
       
      “We are delighted to collaborate with Samsung Electronics, a global leader in educational technology and innovation,” said Dr. Satya Nitta, the CEO of Merlyn Mind. “Samsung has a long history of bringing advanced technology to classrooms, starting with Chromebooks over a decade ago. Together, we will continue to integrate our purpose-built AI for education with Samsung’s solutions to create more engaging and effective learning environments.”
       
      These capabilities will roll out for all three different-sized models later in the year, providing more convenient usability and a higher contextual learning environment.
       
       
      Samsung Business TV BED: Exceptional Image Quality With Flexible Functionality

       
      At InfoComm, Samsung will also showcase the Samsung Business TV BED series, offering UHD picture quality and flexible functionality. Available in a range of sizes8 – 43, 50, 55, 60, 65, 70, 75 or 85 inches – the TV can fit into almost any space, making it an optimal choice to enhance both the style and functionality of various environments. This solution meets the needs of sectors including restaurant industry, education, small/home offices and other small businesses.
       

       
      Launching globally in Q3,9 businesses can use the existing Samsung Business TV App available on Android or iOS devices to remotely manage, schedule and display customized content effortlessly. It also supports SmartThings Pro and Samsung VXT, meeting a wide variety of business needs and providing lifelike clarity through 4K image quality and smooth device management.
       
       
      1 The power measurement is based on IEC 62301 standards. According to the standards, the value rounded to the second decimal place, and the average power below 0.005W is indicated as 0.00W.
      2 Specifications based on internal testing pre-launch. Final specifications subject to change.
      3 App is available on Android and iOS.
      4 Bezel frame sold separately
      5 Video Electronics Standards Association
      6 Compatible with 200×200 VESA mount
      7 Integrated Systems Europe (ISE) is a leading audiovisual (AV) and systems integration trade show in Europe.
      8 Size availability varies by region.
      9 Specific launch timing will vary by region.
      View the full article
    • By Samsung Newsroom
      Samsung Electronics, the world’s leading TV manufacturer for the 18th consecutive year, commenced its 2024 Southeast Asia Tech Seminar in Bangkok, Thailand. From April 23 to 24, Samsung will showcase its 2024 lineup, featuring AI-powered technologies that offer enhanced picture, sound, and customization.
       
      Since 2012, Samsung’s global Tech Seminar sessions have served as a platform for sharing detailed information and exclusive product experiences. As part of its ‘Screens Everywhere, Screens for All’ vision, Samsung plans to present innovations that deliver industry-leading viewing experiences and user-friendly features.
       
      ▲ Haylie Jung (right), Picture Quality Solution Lab at Samsung Electronics, explains that the 2024 Neo QLED 8K incorporates the new and powerful NQ8 AI Gen3 Processor to support AI-backed features such as 8K AI Upscaling Pro and AI Motion Enhancer Pro
       
      The 2024 Southeast Asia Tech Seminar in Bangkok follows a successful series kickoff in Frankfurt, Germany this February. At this event and upcoming seminars in regions such as Latin America, Samsung will present new TV and monitor technologies, as well as lifestyle products:
       
      Samsung’s 2024 Neo QLED 8K includes the latest NQ8 AI Gen3 Processor, which enables a vivid and more precise picture through its 512 neural networks—eight times as many as its predecessor. It supports features like 8K AI Upscaling Pro and AI Motion Enhancer Pro for the best Neo QLED 8K visuals to date. The 2024 Samsung OLED TV upscales content to 4K resolution thanks to the NQ4 AI Gen2 Processor, and features OLED Glare Free technology. Certified by Underwriters Laboratories Inc. (UL), the technology reduces light reflection on the screen to provide a more immersive viewing experience with fewer distractions. Music Frame is a new lifestyle product that functions as a frame-shaped speaker. It can be used as a frame on the wall by inserting images or photos into its replaceable photo frame. Samsung Knox, applied to Samsung TV, achieved a ‘Common Criteria’ certification, recognized by 31 countries this February as strengthening TV security measures in terms of software and hardware.  
      ▲ Kevin Cha (left), Picture Quality Solution Lab at Samsung Electronics, explains that AI-backed features such as 8K AI upscaling pro are powered by a new and powerful NQ8 AI Gen3 processor to the 2024 Neo QLED 8K
       
      “We are extremely excited to share Samsung’s key AI TV technologies at the Tech Seminar,” said Yongjae Kim, Executive Vice President of Visual Display Business at Samsung Electronics. “We are not only showcasing the latest technologies that make our TVs stand out, but also our real efforts to better serve customers and our focus on protecting their information.”
       
      For more information on Samsung’s 2024 TV and monitor lineup, visit www.samsung.com/.
       
      ▲ Samsung Electronics has received a CC certification for 10 consecutive years since first applying Samsung Knox, the industry’s best security solution, to its TV products in 2015
       
      ▲ Andrew Sohn (left), Picture Quality Solution Lab at Samsung Electronics, shows off Samsung’s AI engine that can instantly optimize picture and sound quality based on the game or genre being played
       
      ▲ According to Kevin Cha (right), Picture Quality Solution Lab at Samsung Electronics, the 2024 Samsung OLED features Glare free technology to deliver a comfortable viewing experience
      View the full article





×
×
  • Create New...