Blade SDKs


Blade offers SDKs for the most popular platforms, making it easy for you to implement our code, whatever your tech stack looks like.

High-level SDK usage diagram

Simplified version of diagram to show how Blade SDKs can be used in your application.

Quick start


How to install

npm i @bladelabs/blade-sdk.js

How to init

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


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

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


How to install

Add the following lines to your Package.swift file:

dependencies: [
    .package(url: "", from: "0.6.25")

Or add the following line to your Podfile:

pod 'SwiftBlade', '~> 0.6.25'

How to init

import SwiftBlade

SwiftBlade.shared.initialize(apiKey: "API_KEY", dAppCode: "dAppCode", network: .TESTNET) { (result, error) in
    // ready to use SwiftBlade

// Get balance by hedera id
SwiftBlade.shared.getBalance("0.0.8235") { (result, error) in


How to install

  1. Add repositories to your project:

// ./settings.gradle
dependencyResolutionManagement {
    repositories {
        maven { url '' }
        maven { url '' }
  1. Add dependency to your project:

// ./app/build.gradle
dependencies {
    implementation 'com.github.Blade-Labs:kotlin-blade:0.6.25'
  1. Add permission to your project:

<!-- ./app/src/main/AndroidManifest.xml-->
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="" xmlns:tools="">
    <uses-permission android:name="android.permission.INTERNET" />

How to init

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")

// Get balance by hedera account id
Blade.getBalance("0.0.49177063") { balanceData, error ->
    if (data != null) {
        println(balanceData ?: error)

React Native

How to install

npm i @bladelabs/react-native-blade-sdk

How to init

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);


Q: What is the Blade SDK?

A: The Blade SDK is a set of tools that allow you to easily integrate Blade's services into your application.

Q: What can I do with the Blade SDK?

A: You can use BladeSDK in your app smooth integration with the Blade services, partner services, interact Hedera hashgraph network and more. Check features list below.

Q: I have problems with initialisation, what should I do?

A: There are two most popular problems:

  1. Check your API key, dAppCode, network and environment. They should be correct. Worth to mention that apiKey may be different per network (testnet, mainnet) and platform (JS, Swift, Kotlin, React Native, etc.). Use credentials provided by BladeLabs team.

  2. Issues with getting visitorId. This problem may occur if region restrictions are applied. Sometimes it may be related Ad-blockers, so please disable them and try again. If the problem persists, please contact BladeLabs team.

In these cases please call method getInfo() and check if visitorId is not empty. Also, it will be useful if you provide us result of this method call when contacting support. Keep in mind that output may contain sensitive data, like apiKey, so please be careful with sharing this information (you can send it partially, like this "FG9dU...PcSAt").

Q: What is BladeEnv / SdkEnvironment?

A: In default scenario, you shouldn't specify BladeEnv, in than case Prod will be used

Q: What is dAppCode?

A: dAppCode is a unique identifier for your application. It is used to identify your application in Blade's system. This code is provided by BladeLabs team.

Q: Is it secure to provide private key to SDK methods

A: BladeSDK never share Private keys in any form. It is used only for signing transactions and never leaves the device. It's your responsibility to keep it safe. Please check best practices for storing private keys in your application. Also, treat apiKey as a sensitive data and never share it with anyone.

Q: Where I can find examples?

A: You can find examples for almost any of provided SDK. List of SDKs with examples provide above.

Q: Still have questions?

A: Feel free to contact us. We are always happy to help you.


Please note that the security of your private keys is your sole responsibility.

Our SDKs, which wraps Hedera SDK and Blade wallet API, have been developed to ensure the highest level of security possible.

However, we do not take any responsibility for the security of your private keys.

Please be aware that once someone else gains access to your private keys, they will have full control of your account, funds, tokens, and NFTs.

We strongly recommend that you follow best practices for securing your private keys when using our SDKs. Please be aware that private keys will never be sent over the network or shared with any third party through our SDK.

Best practices for securing your private keys

Here are some examples of secure storage options for hex-encoded private keys for iOS, Android, and JavaScript:


Keychain: iOS provides a secure Keychain service that allows you to store sensitive information, such as private keys, securely. You can use the Keychain API provided by Apple to store and retrieve private keys in a secure manner.

Encrypted file: You can store the private key in an encrypted file and save it to the device's file system. The file can be decrypted when needed using a password or passphrase.


Android Keystore: Android provides a secure hardware-backed Keystore service that allows you to store cryptographic keys securely. You can use the Android Keystore API provided by Google to store and retrieve private keys in a secure manner.

Encrypted file: Similar to iOS, you can store the private key in an encrypted file and save it to the device's file system. The file can be decrypted when needed using a password or passphrase.


Browser local storage: You can store an encrypted private key in the browser's local storage, which provides a simple way to store data on the user's device. However, this is not the most secure option as the data can be accessed by other scripts running on the same page.

Encrypted cookie: You can store the private key in an encrypted cookie on the user's device. The cookie can be decrypted when needed using a password or passphrase. However, this is not the most secure option as cookies can be accessed by other scripts running on the same page.

It's important to note that these are just a few examples, and there may be other secure storage options available depending on your specific use case and requirements. It's recommended to consult with a security expert to determine the most appropriate storage solution for your needs.

Supported features across SDKs

  • ✅ - implemented

  • ❌ - not implemented



Inits instance of BladeSDK for correct work with Blade API and Hedera network.


const info = await bladeSdk.init("apiKey", "Mainnet", "dAppCode");


This method returns basic params of initialized instance of BladeSDK. This params may useful for support.

Returned object likely will contain next fields: apiKey, dAppCode, network, visitorId, sdkEnvironment, sdkVersion, nonce

In case of support please not provide full apiKey, limit yourself to the part of the code that includes a few characters at the beginning and at the end (eg. AdR3....BFgd)


const info = bladeSdk.getInfo();


Set account for further operations.

Currently supported two account providers: Hedera and Magic.

Hedera: pass accountId and privateKey as hex-encoded strings with DER-prefix (302e020100300506032b657004220420...)

Magic: pass email to accountIdOrEmail and empty string as privateKey. SDK will handle Magic authentication, and finish after user click on confirmation link in email.

After successful authentication, SDK will store public and private keys in memory and use them for further operations.

After that in each method call provide empty strings to accountId and accountPrivateKey. Otherwise, SDK will override current user with provided credentials as Hedera provider.

In case of calling method with accountId and accountPrivateKey arguments, SDK will override current user with this credentials.

It's optional method, you can pass accountId and accountPrivateKey in each method call. In further releases this method will be mandatory.


// Set account for Hedera provider
const userInfo = await bladeSdk.setUser(AccountProvider.Hedera, "0.0.45467464", "302e020100300506032b6570042204204323472EA5374E80B07346243234DEADBEEF25235235...");
// Set account for Magic provider
const userInfo = await bladeSdk.setUser(AccountProvider.Magic, "", "");


Clears current user credentials.


const result = await bladeSdk.resetUser();


Get hbar and token balances for specific account.


const balance = await bladeSdk.getBalance("0.0.45467464");


Get list of all available coins on CoinGecko.


const coinList = await bladeSdk.getCoinList();


Get coin price and coin info from CoinGecko. Search can be coin id or address in one of the coin platforms.


const coinInfo = await bladeSdk.getCoinPrice("hedera-hashgraph", "usd");


Send hbars to specific account.


const receipt = await bladeSdk.transferHbars("0.0.10001", "302e020100300506032b65700422042043234DEADBEEF255...", "0.0.10002", "1.0", "test memo");


Call contract function. Directly or via BladeAPI using paymaster account (fee will be paid by Paymaster account), depending on your dApp configuration.


const params = new ParametersBuilder().addString("Hello");
const contractId = "0.0.123456";
const gas = 100000;
const receipt = await bladeSdk.contractCallFunction(contractId, "set_message", params, "0.0.10001", "302e020100300506032b65700422042043234DEADBEEF255...", gas, false);


Call query on contract function. Similar to {@link contractCallFunction} can be called directly or via BladeAPI using Paymaster account.


const params = new ParametersBuilder();
const contractId = "0.0.123456";
const gas = 100000;
const result = await bladeSdk.contractCallQueryFunction(contractId, "get_message", params, "0.0.10001", "302e020100300506032b65700422042043234DEADBEEF255...", gas, false, ["string"]);


Send token to specific account.


const receipt = await bladeSdk.transferTokens("0.0.1337", "0.0.10001", "302e020100300506032b65700422042043234DEADBEEF255...", "0.0.10002", "1.0", "test memo", false);


Create scheduled transaction


const receiverAccountId = "0.0.10001";
const receiverAccountPrivateKey = "302e020100300506032b65700422042043234DEADBEEF255...";
const senderAccountId = "0.0.10002";
const tokenId = "0.0.1337";
const nftId = "0.0.1234";
const {scheduleId} = await bladeSdk.createScheduleTransaction(
    "TRANSFER", [
            type: "HBAR",
            sender: senderAccountId,
            receiver: receiverAccountId,
            value: 1 * 10**8,
            type: "FT",
            sender: senderAccountId,
            receiver: receiverAccountId,
            tokenId: tokenId,
            value: 1
            type: "NFT",
            sender: senderAccountId,
            receiver: receiverAccountId,
            tokenId: nftId,
            serial: 4


Sign scheduled transaction


const scheduleId = "0.0.754583634";
const senderAccountId = "0.0.10002";
const senderAccountPrivateKey = "302e020100300506032b65700422042043234DEADBEEF255...";
const receiverAccountId = "0.0.10001";
const receipt = await bladeSdk.signScheduleId(scheduleId, senderAccountId, senderAccountPrivateKey, receiverAccountId, false);


Create new Hedera account (ECDSA). Only for configured dApps. Depending on dApp config Blade create account, associate tokens, etc.

In case of not using pre-created accounts pool and network high load, this method can return transactionId and no accountId.

In that case account creation added to queue, and you should wait some time and call getPendingAccount() method.


const account = await bladeSdk.createAccount();


Get account from queue (read more at createAccount()).

If account already created, return account data.

If account not created yet, response will be same as in createAccount() method if account in queue.


const account = await bladeSdk.createAccount();
if (account.status === "PENDING") {
  // wait some time and call getPendingAccount method
  account = await bladeSdk.getPendingAccount(account.transactionId, account.seedPhrase);


Delete Hedera account. This method requires account private key and operator private key. Operator is the one who paying fees


const receipt = await bladeSdk.deleteAccount(accountToDelete.accountId, accountToDelete.privateKey, "0.0.10001", "0.0.10001", "302e020100300506032b65700422042043234DEADBEEF255...");


Get account info.

EvmAddress is address of Hedera account if exists. Else accountId will be converted to solidity address.

CalculatedEvmAddress is calculated from account public key. May be different from evmAddress.


const accountInfo = await bladeSdk.getAccountInfo("0.0.10001");


Get Node list


const nodeList = await bladeSdk.getNodeList();


Stake/unstake account


const receipt = await bladeSdk.stakeToNode("0.0.10001", "302e020100300506032b65700422042043234DEADBEEF255...", 3);



const result = await bladeSdk.getKeysFromMnemonic("purity slab doctor swamp tackle rebuild summer bean craft toddler blouse switch");


Get accounts list and keys from private key or mnemonic

Supporting standard and legacy key derivation.

Every key with account will be returned.


const resultKey = await bladeSdk.searchAccounts("302e020100300506032b65700422042043234DEADBEEF255...");
const resultSeed = await bladeSdk.searchAccounts("purity slab doctor swamp tackle rebuild summer bean craft toddler blouse switch");


Bladelink drop to account


const drop = await bladeSdk.dropTokens("0.0.10001", "302e020100300506032b65700422042043234DEADBEEF255...", "secret-nonce");


Sign base64-encoded message with private key. Returns hex-encoded signature.


const signed = await bladeSdk.sign(btoa("Hello"), "302e020100300506032b65700422042043234DEADBEEF255...");


Verify message signature by public key


const signature = "27cb9d51434cf1e76d7ac515b19442c619f641e6fccddbf4a3756b14466becb6992dc1d2a82268018147141fc8d66ff9ade43b7f78c176d070a66372d655f942";
const publicKey = "302d300706052b8104000a032200029dc73991b0d9cdbb59b2cd0a97a0eaff6de...";
const valid = await bladeSdk.signVerify(btoa("Hello"), signature, publicKey);


Sign base64-encoded message with private key using ethers lib. Returns hex-encoded signature.


const signed = await bladeSdk.ethersSign(btoa("Hello"), "302e020100300506032b65700422042043234DEADBEEF255...");


Split signature to v-r-s format.


const signature = "27cb9d51434cf1e76d7ac515b19442c619f641e6fccddbf4a3756b14466becb6992dc1d2a82268018147141fc8d66ff9ade43b7f78c176d070a66372d655f942";
const {v, r, s} = await bladeSdk.splitSignature(signature);


Get v-r-s signature of contract function params


const params = new ParametersBuilder().addAddress(accountId).addString("Hello");
const result = await bladeSdk.getParamsSignature(params, "302e020100300506032b65700422042043234DEADBEEF255...");


Get transactions history for account. Can be filtered by transaction type.

Transaction requested from mirror node. Every transaction requested for child transactions. Result are flattened.

If transaction type is not provided, all transactions will be returned.

If transaction type is CRYPTOTRANSFERTOKEN records will additionally contain plainData field with decoded data.


const transactions = await bladeSdk.getTransactions("0.0.10001");


Get configured url for C14 integration (iframe or popup)


const {url} = await bladeSdk.getC14url("HBAR", "0.0.10001", "100");


Get quotes from different services for buy, sell or swap


const quotes = await bladeSdk.exchangeGetQuotes("EUR", 100, "HBAR", CryptoFlowServiceStrategy.BUY);


Swap tokens


const result = await bladeSdk.swapTokens("0.0.10001", "302e020100300506032b65700422042043234DEADBEEF255...", "HBAR", 1, "SAUCE", 0.5, "saucerswapV2");


Get configured url to buy or sell tokens or fiat


const {url} = await bladeSdk.getTradeUrl(CryptoFlowServiceStrategy.BUY, "0.0.10001", "EUR", 50, "HBAR", 0.5, "saucerswapV2", redirectUrl);


Create token (NFT or Fungible Token)


const keys: KeyRecord[] = [
    {type: KeyType.admin, privateKey: adminKey},
    {type: KeyType.wipe, privateKey: wipeKey},
    {type: KeyType.pause, privateKey: pauseKey},
const treasuryAccountId = "0.0.10001";
const supplyKey = "302e020100300506032b65700422042043234DEADBEEF255...";
const result = await bladeSdk.createToken(
    treasuryAccountId, // treasuryAccountId
    supplyKey, // supplyPrivateKey
    true, // isNft
    0, // decimals
    0, // initialSupply
    250, // maxSupply


Associate token to account. Association fee will be covered by PayMaster, if tokenId configured in dApp


const result = await bladeSdk.associateToken("0.0.1337", "0.0.10001", "302e020100300506032b65700422042043234DEADBEEF255...");


Mint one NFT


const receipt = await bladeSdk.nftMint(
    "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAARUlEQVR42u3PMREAAAgEIO1fzU5vBlcPGtCVTD3QIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIXCyqyi6fIALs1AAAAAElFTkSuQmCC", // TODO upload file base64
        author: "GaryDu",
        other: "metadata",
        some: "more properties"
        provider: NFTStorageProvider.nftStorage,
        apiKey: nftStorageApiKey,


Get token info. Fungible or NFT. Also get NFT metadata if serial provided


const tokenInfo = await bladeSdk.getTokenInfo("0.0.1234", "3");

Last updated