inabit Wallet-As-A-Service

An example use case of how inabit's API Infrastructure is utilized.

Overview

In an era where digital wallets are transforming the landscape of financial services, inabit offers a robust infrastructure tailored to meet the dynamic needs of crypto wallet providers. This guide is designed to navigate you through the seamless integration and management of your crypto wallet operations, empowering you with security, flexibility, and scalability like never before.

Whether you're a growing startup or an established player in the crypto ecosystem, inabit's WaaS solution provides the foundation for building and managing feature-rich wallets that cater to the evolving demands of your users. From secure storage to efficient transaction processing, our infrastructure is engineered to enhance the user experience while ensuring the highest standards of security.

Prerequisites

Before diving into the setup, ensure you have:

  • Have an API Admin user created for your organization in inabit.

  • Access to the inabit platform (as the wallet provider):

    • Have an account ready to be used.

  • Registering to our webhook services with your service URL.

🚧 One-time Must-Have Setup:

Please ensure that you complete the Approvals Docker Configuration and execute the API signer Setup as a one-time prerequisite. Once this step is accomplished, you will be able to create your API wallets and addresses as needed.

Additional Reference

We highly advise taking a look at the following guides as you start developing your wallet as a service with inabit.

  • API Login Access / Authentication

  • Create Transfer Requests in API

  • Create API wallet addresses

  • Remote & Automatic Approvals (Docker Configuration)

  • Automate Signing Transactions

  • Receive Webhooks on Transaction Events

Technical Architecture: Customer Wallet Flows

The architectural diagram depicts the wallet infrastructure utilizing inabit's wallet-as-a-service solution. Below we explain the flow's process from the beginning of a customer's interation in the interface until a transaction is sent successfully.

Transactions Flow Explained

Customer B (Wallet provider's customer)

  • When there's a wallet creation process occuring in the provider's (you) interface, initiate a request to inabit's API to generate a dedicated deposit address (API wallet) for the customer (step 1 in the flow).

    • This part isn't really visible in the flow, but you can see that the provider's inabit account contains multiple customer API wallets.

    • Refer to the first section below to learn how to generate API wallet addresses.

  • Customer B is requesting a withdrawal from using your wallet's interface (the provider).

    • Send a Money Transfer Request to inabit's API.

  • The transaction goes through approval process (Docker Signer)

    • The approval/rejection logic will rely on anything you develop on your end. You can decide what ever you want.

  • Once transaction is approved, funds are taken out of Customer B's API wallet (within the wallet provider's inabit account) and the transaction is broadcasted to the blockchain.

  • Once the transaction is broadcasted and completed, inabit sends two notifications (via webhooks) to notify the following:

    • Transaction was completed

    • Customer B's wallet (and asset) balance we're updated.

Now that the flow is clear, let's review the implementation process step by step!

1. a. Generate API Wallets for Customers

The wallet provider (you) develops a logic that on every wallet creation/generation in your interface, a new inabit API wallet is created for your end-customer.

We recommend saving the inabit API walletId to associate it with your customer in your database.

In order to generate the API wallet address for the customer's deposit, call the following mutation:

Remember to authenticate to call our graphQL API using an access token (bearer) with your API Admin credentials. (If you're not sure how, refer to Authentication)

Don't have an API Admin/API Signer yet? contact us at support@inabit.com to create one!

CreateApiWalletAddress Mutation:

mutation CreateApiWalletAddress($data: ApiWalletCreateAddressInput!) {
  createApiWalletAddress(data: $data) {
    address
    walletId
  }
}

Body (ApiWalletCreateAddressInput object)

NameTypeDescription

blockchainId*

string

ID of the blockchain in inabit

financialAssetId*

string

ID of the financial asset in inabit (can be token/native)

organizationId*

string

ID of the organization in inabit

Example body:

{
  "data": {
    "blockchainId": "clefn78cl00i3lc6rih442mx9",
    "financialAssetId": "clefn78h5012plc6rxbmofnop",
    "organizationId": "clsu8bel7000dlciyfdfbmwcw"
  }
}

Response

{
	"data": {
		"createApiWalletAddress": {
			"address": "0xcc918e16bc528bf58fc250f56898c7d917d33de2",
			"walletId": "cluicfnpb000066015d3narbc"
		}
	}
}

In the mutation's response, you should receive the deposit address for the blockchain and asset you've requested, as well as the inabit API wallet ID for the customer (which you can later save and relate to the specific customer, in order to identify a customer's inabit API wallet).

In the mutation's response, you should receive the deposit address for the blockchain and asset you've requested, as well as the inabit API wallet ID for the customer (which you can later save and relate to the specific customer, in order to identify a customer's inabit API wallet).

Reminder - You can always query data and fetch all API wallets & their blockchain address in your organization when needed. Refer to Wallets Info.

1. b. Initiate Transaction Request

Once a customer in your interface triggers a withdrawal, initiate a withdrawal request to inabit's API. The following mutation is used to create a transfer request (withdrawal):

CreateWithdrawal Mutation:

mutation CreateWithdrawal($data: WithdrawalCreateInput!) {
  createWithdrawal(data: $data) {
    id
  }
}

Body (WithdrawalCreateInput object)

NameTypeDescription

walletId*

String

Wallet ID

financialAssetId*

String

Asset ID

address*

String

From Address (Source)

amount*

Integer

Transfer amount

blockchainId*

String

Blockchain ID

note

String

Transaction Note

priority

String

Transaction Priority

(Slow, medium, fast, etc.)

Example body:

{
	"data": {
		"wallet": {
			"id": "clol7o576002oaz011mmtnvru"
		},
		"financialAsset": {
			"id": "clefn78gv011olc6rcwtt0wel"
		},
		"address": "0x7582f3483116105e0b7845ac1a0df5eb0c8cd062",
		"amount": 5,
		"blockchain": {
			"id": "clefn78em00mslc6r3lzf3h5a"
		},
		"note": "",
		"priority": "Medium"
	}
}

Response

{
	"data": {
		"createWithdrawal": {
			"id": "clpgvrjb700136g01lr3o0tgv",
		}
	}
}

In the mutation's response, you should receive the withdrawal ID.

2. Approving Customers Transaction

🚧 Approval Required

Note that withdrawals will require an approval. In this case, approvals are given automatically according to the logic decided by the clearer (you), through the automatic approvals application (docker).

If you feel like you've missed this step, please check prerequisite once more and refer to our additional reference section at the beginning of the page.

The provider (you) needs to develop a logic to approve transactions using our approvals application tool. Please refer to the following subpage to learn more about how to Automate Signing Transactions.

3. Broadcast Crypto Transaction to the Blockchain

There's no extra work needed in this step.

Once the transaction (withdrawal) request is approved using the API signer, the transaction will be broadcasted to the blockchain automatically.

4. Receive Transactions & Balance Webhooks

In order for the wallet provider (you) to be able to monitor the statuses of transactions executed from your customer's wallets, you can register to our webhook service and subscribe to specific notifications allowing you to identify new incoming/outgoing transaction events, as well as status updates and wallet balance updates.

Please refer to Webhooks and Notifications 📣 for further information.

Congratulations! 🎉👏

You are fully set to operate as a wallet provider using inabit's secured remote wallets infrastructure!

If you encounter any challenges in the process or need further clarification on any aspect, please don't hesitate to reach out to us at support@inabit.com.

Last updated