Skip to main content

Blade SDKs

Blade provides SDKs for popular platforms, facilitating implementation across various technology stacks.

PlatformPurposeRepositoryDemo
JSBrowser-based applicationsGitHubDemo
SwiftNative iOS developmentGitHub
KotlinNative Android applicationsGitHubDemo
React NativeCross-platform React Native appsGitHubDemo
Unity (beta)Desktop applicationsGitHubDemo
C++ (beta)Cross-platform developmentGitHubDemo

Quick Start

JavaScript

npm i @bladelabs/blade-sdk.js
import {BladeSDK} from '@bladelabs/blade-sdk.js';

const apiKey = "ygUgCzRrsvhWmb3dsLcApGnApSZ4tk8hBCmZqg9BngpuQYKsnD5m9FjfPV3tVBeB";
const network = "Mainnet"; // or "Testnet"
const dAppCode = "your-dApp-code";

const bladeSDK = new BladeSDK();
await bladeSDK.init(apiKey, network, dAppCode);
const balance = await bladeSDK.getBalance("0.0.8235");
console.log(balance);

Swift

Package.swift:

dependencies: [
.package(url: "https://github.com/Blade-Labs/swift-blade.git", from: "0.6.25")
]

Podfile:

pod 'SwiftBlade', '~> 0.6.25'
import SwiftBlade

SwiftBlade.shared.initialize(apiKey: "API_KEY", dAppCode: "dAppCode", network: .TESTNET) { (result, error) in
print(result)
}

SwiftBlade.shared.getBalance("0.0.8235") { (result, error) in
print(result)
}

Kotlin

settings.gradle:

dependencyResolutionManagement {
repositories {
maven { url 'https://jitpack.io' }
maven { url 'https://maven.fpregistry.io/releases' }
}
}

app/build.gradle:

dependencies {
implementation 'com.github.Blade-Labs:kotlin-blade:0.6.25'
}

AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />
import io.bladewallet.bladesdk.Blade

Blade.initialize("api-key", "dAppCode", "Testnet", BladeEnv.Prod, requireContext(), false) { infoData, error ->
if (infoData != null) {
println("BladeInit success: $infoData")
} else {
println("BladeInit fail: $error")
}
}

Blade.getBalance("0.0.49177063") { balanceData, error ->
println(balanceData ?: error)
}

React Native

npm i @bladelabs/react-native-blade-sdk
import BladeSdk, { BladeEnv, Network } from '@bladelabs/react-native-blade-sdk';

const initResult = await BladeSdk.initialize(apiKey, dAppCode, Network.Testnet, BladeEnv.Prod, true);
console.log('initResult:', initResult);

const balanceResult = await BladeSdk.getBalance("0.0.8235");
console.log('getBalance:', balanceResult);

FAQ

What is the Blade SDK? The SDK comprises tools enabling seamless integration of Blade services into applications.

What functionality does Blade SDK offer? Features include smooth integration with Blade services, partner services, and interaction with Hedera hashgraph network. Check the features matrix for specifics.

What should I do if initialization fails? Two common issues:

  1. Verify API key, dAppCode, network, and environment correctness — credentials may vary per network and platform, provided by BladeLabs.
  2. Verify visitorId in getInfo() output isn't empty — region restrictions or ad-blockers may cause issues.

When contacting support, provide partial apiKey details (e.g., "FG9dU...PcSAt") to protect sensitive data.

What is BladeEnv / SdkEnvironment? Prod environment is default; typically requires no explicit specification.

What is dAppCode? dAppCode is a unique identifier for your application used to identify your application in Blade's system. It is supplied by BladeLabs.

Is providing private keys to SDK methods secure? BladeSDK never shares private keys in any form. They are used only for signing transactions and never leave the device. Users bear responsibility for secure storage. Treat apiKey as sensitive data — never share it.

Where can I find examples? Examples exist for nearly every SDK version — see the repository links in the table above.

Disclaimer

The security of private keys remains solely the user's responsibility. While SDKs wrapping Hedera SDK and Blade wallet API target maximum security, Blade assumes no responsibility for private key protection.

danger

Once someone gains access to your private keys, they will have full control of your account, funds, tokens, and NFTs.

Best Practices for Key Storage

iOS:

  • Keychain Service — Apple's secure storage for sensitive information using the Keychain API
  • Encrypted File — Store private keys in encrypted files, decryptable via password or passphrase

Android:

  • Android Keystore — Google's hardware-backed cryptographic key storage service
  • Encrypted File — Similar to iOS approach with file-based encryption

JavaScript:

  • Browser Local Storage — Encrypted private keys in browser storage (lower security — accessible by page scripts)
  • Encrypted Cookie — Encrypted cookies decryptable via password (not optimal — scripts can access)
info

These represent common approaches; consult security experts for specific requirements.

Supported Features

FeatureJSSwiftKotlinReact NativeUnityC++
init
getInfo
setUser
resetUser
getBalance
getCoinList
getCoinPrice
transferHbars
contractCallFunction
contractCallQueryFunction
transferTokens
createScheduleTransaction
signScheduleId
createAccount
getPendingAccount
deleteAccount
getAccountInfo
getNodeList
stakeToNode
getKeysFromMnemonic
searchAccounts
dropTokens
sign
signVerify
ethersSign
splitSignature
getParamsSignature
getTransactions
getC14url
exchangeGetQuotes
swapTokens
getTradeUrl
createToken
associateToken
nftMint
getTokenInfo