New Open Source Tools to Create First-Class Mobile Experiences on EOSIO™
As we all know, however, users are spending more of their time on mobile devices in native applications. This is largely because native apps are often able to provide richer, more engaging experiences than their browser-based counterparts. Today, native mobile applications are a crucial component of consumer-facing product strategies.
It is for this reason that we are excited to announce the alpha release of two new open source EOSIO tools to enhance native mobile application development on EOSIO, an EOSIO SDK for Swift and EOSIO SDK for Java.
Developer Convenience, Flexible Architecture
These Software Development Kits (SDKs) provide native APIs for interacting with EOSIO blockchains; creating, signing and broadcasting transactions; handling keys and obtaining signatures; data serialization/deserialization, and more.
And by targeting both the Java and Swift programming languages, we’re bringing these capabilities to the most popular mobile platforms — Android and iOS — contributing to what we hope will be a proliferation of compelling, native EOSIO-powered experiences for mobile users everywhere.
These SDKs employ a concept borrowed from EOSJS that provide a great deal of flexibility for a variety of use cases and environments — that of independent, interchangeable providers that plug into one core library.
The Core Libraries
The core EOSIO SDK for Swift and EOSIO SDK for Java libraries are responsible for facilitating the transaction lifecycle. They provide developers with easy and idiomatic ways of creating and working with transactions, collecting the necessary signatures, and preparing and broadcasting those transactions to EOSIO nodes. Much of the heavy lifting, however, takes place in the providers that are plugged into it.
The Signature Provider
The Signature Provider is arguably the most flexible of all of the provider abstractions. It is responsible for a) finding out what keys are available for signing and b) requesting and obtaining the signatures required for the transaction.
How it goes about executing that, though, is entirely up to the particular signature provider the developer has chosen to “plug in” for that transaction. By simply switching out the signature provider, signature requests can be routed in any number of ways.
A signature provider is able to carry out a number of useful functions. For example, anyone who needed a signature from keys in the platform’s key store or secure hardware signing element can simply configure the transaction with a signature provider that does it. The same goes for needing signatures from a wallet app running on a user’s device, which a signature provider can also perform.
This is great news for both app developers and users. For developers, this feature means that depending on their selection of signature providers, they no longer have to be on the hook for handling and securing a user’s private keys. For users, it means that the apps they love can easily work with the wallet or authenticator of their choice, creating a win-win situation.
Along with the core libraries, we are releasing the following signatures providers, in alpha.
- EOSIO SDK for Swift: Vault Signature Provider: Signature provider implementation for signing transactions using keys stored in Apple’s Keychain or the device’s Secure Enclave.
- EOSIO SDK for Swift: Softkey Signature Provider: Example signature provider for signing transactions using keys in memory.
- EOSIO SDK for Java: Softkey Signature Provider: Example signature provider for signing transactions using keys in memory.
As always, we encourage others in the community to create and open source other signature providers.
The RPC, ABI, and Serialization Providers
Transactions are also configured with RPC, ABI, and Serialization providers.
- RPC Providers are responsible for all RPC calls to nodeos, as well as general network handling (reachability, retry and failover logic, etc.)
- Serialization providers handle ABI-driven transaction and action serialization and deserialization between JSON and binary data representations
- ABI providers are responsible for fetching and caching ABIs for use during serialization and deserialization
While the need to swap these providers is less frequent, the abstraction is still quite valuable, especially when it comes to one of these SDKs’ other value propositions — support for platforms other than mobile.
Mobile and Beyond
It is important to note that both Java and Swift are general purpose programming languages, and that they are not restricted to running on mobile platforms. In fact, Java, with its “write once, run anywhere” philosophy, precedes Android and is virtually ubiquitous.
With that in mind, we have purposefully set out to make the core SDK libraries as generic and platform agnostic as possible, relegating any platform-specific code to the individual provider libraries.
While we have only tested the alpha versions of EOSIO SDK for Java on the Android platform and EOSIO SDK for Swift on iOS, when instantiated with the right platform-compatible providers, the core library should run with little additional effort. We welcome the community to contribute by testing the core libraries on other platforms and creating issues and pull requests that improve compatibility with those platforms.
Get Started and Get Involved
We have several resources for those interested in using these libraries and/or contributing.
To help developers get started using these new SDKs, we have created both iOS and Android example applications. These examples are simple demonstrations of how to integrate with EOSIO-based blockchains using the EOSIO SDKs. The applications do two things: they fetch your account token balance and push a transfer action.
- EOSIO SDK for Swift: Documentation: https://eosio.github.io/eosio-swift/
- EOSIO SDK for Swift: Github Repo: https://github.com/EOSIO/eosio-swift
- EOSIO SDK for Java: Github Repo: https://github.com/EOSIO/eosio-java
If you are interested in providing feedback and working more closely with our team to improve the EOSIO for developers, you can send our developer relations team an email at firstname.lastname@example.org.
You can also keep up to date with future updates by subscribing to our mailing list on the EOSIO Developer Portal. We are excited to be regularly improving the usability of the software for EOSIO developers as we continue to lay a foundation for the mass adoption of blockchain technology.
. . .
All product and company names are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.