Download OpenAPI specification:Download
Bringing security and usability to enterprise blockchain applications
The ChainFront Cloud Services API enables developers to quickly and easily integrate their solutions with blockchain networks. The API endpoints support connecting to the Stellar, Ripple (XRP), Ethereum, and Bitcoin networks. By using ChainFront, you provide your users with a secure and easy way to approve transactions without the need for them to manage their own private keys. The private keys are created within the secure environment provided by ChainFront and never leave this environment, nor are they ever viewable. You can easily create accounts, transfer tokens, and invoke contracts, all with the benefit of requiring multi-factor authentication for any transaction signer.
The current version of the API is v1.
The ChainFront Cloud Service API is a RESTful API. It allows you to create accounts, configure multi-factor transaction approval methods, create blockchain addresses, create and sign transactions, and submit transactions to a blockchain network.
All production API requests are made to:
https://api.chainfront.io/api/v1
There is also a testing sandbox to use when developing and testing applications, with requests being made to:
https://sandbox.chainfront.io/api/v1
All requests to the ChainFront REST API are served over HTTPS. Unencrypted HTTP is not supported.
The API is available to ChainFront customers and integration partners and all organizations must acquire valid credentials prior to using the web services. All API endpoints require authentication. Please see the Security section below for additional information.
For production usage, the ChainFront REST API uses the OAuth 2.0 protocol to authorize calls.
When you integrate with ChainFront, you will receive a set of OAuth client ID and secret credentials for your app for both the sandbox and production environments. You pass these credentials via the Authorization header of the get_access_token request.
In exchange for these credentials, the ChainFront authorization server issues a bearer access token that you use for authorization when you make REST API requests. A bearer token enables you to complete actions on behalf and with the approval of the resource owner.
In the sandbox environment, for ease of testing you may instead opt to use an API key via HTTP Basic Authentication.
To authenticate using an API key, use HTTP basic auth with the username set to the API key's name and the password set to the API key's secret.
Most client software provides a mechanism for supplying a user name and password and will build the required authentication header automatically.
In the case where you need to manually construct and send a basic auth header with your API key, perform the following steps:
Authorization: Basic YXBpS2V5TmFtZTphcGlLZXlTZWNyZXQ=
In addition, you will need to pass a X-CUSTOMER-ID
header with all requests. The value of this header will be provided
to you when you sign up.
Security scheme type: | OAuth2 |
---|---|
authorizationCode OAuth Flow | Authorization URL: https://sandbox.chainfront.io/oauth/authorize Token URL: https://sandbox.chainfront.io/oauth/token Scopes:
|
In a traditional blockchain security architecture, users are responsible for keeping a private key secure. In a traditional enterprise application, users are accustomed to password recovery, rolling passwords, and generally are not expected to manage their own password backups. ChainFront blends these approaches by abstracting the private key away from the user, in exchange for the user presenting a multi-factor approval via a device they have proved they own.
Each account can be configured with a transaction approval method. For every transaction in which the account is a signer, the approval method indicates how the user is to approve the transaction.
Tx Approval Method | Requires User Approval | Approval Type | Registration Flow | Who Collects Approval | Supports Additional Approvers |
---|---|---|---|---|---|
AUTHY_PUSH | yes | Push Notification | SMS prompt to install Authy | ChainFront | yes |
CHAINFRONT_TOTP | yes | TOTP Code | SMS code | ChainFront | yes |
APP_TOTP | yes | TOTP Code | SMS code | Your App | no |
IMPLICIT | no | None | None | None | no |
The ChainFront APIs use JSON as the default format.
Ensure you set the following HTTP headers in order for JSON to be properly processed:
Content-Type: application/json
Accept: application/json
While you can use ChainFront APIs by making direct HTTP requests, we provide client library code for all our APIs that make it easier to access them from your favorite languages.
Currently we offer Java, Javascript, Go, and Python client libraries. SDKs for other languages can be generated by using OpenAPI tooling.
To obtain the latest SDKs please contact us at info@chainfront.io.
In this example we show how to onboard a user, configure multi-factor transaction approval, and submit a transaction to the Stellar blockchain. Note that in this example we are using Authy push approvals as our MFA method. Also for simplicity we're using API keys rather than OAuth 2 flows.
curl -X POST \
https://sandbox.chainfront.io/api/v1/accounts \
-H 'accept: application/json' \
-H 'authorization: Basic Y2ZhZG1pbkB......' \
-H 'content-type: application/json' \
-H 'x-customer-id: MY_CUSTOMER_ID' \
-d '{
"userName": "user01",
"email": "user@mycompany.com",
"phone": "555-555-5555",
"txApprovalMethod": "AUTHY_PUSH"
}'
This will create an account for user 'user01' in a state of 'PENDING', and send an SMS to the user instructing them how to enable Authy on their phone. Once the user has enabled Authy, the account will move to a state of 'ACTIVE'.
Take note of the 'cfAccountid' value returned in the response body, as this will be used in downstream calls to identify the user. We're assuming that the returned id is '1000' for the remaining steps.
curl -X POST \
https://sandbox.chainfront.io/api/v1/accounts/1000/stellar \
-H 'accept: application/json' \
-H 'authorization: Basic Y2ZhZG1pbkB.......' \
-H 'content-type: application/json' \
-H 'x-customer-id: MY_CUSTOMER_ID' \
-d '{
}'
This call will create a Stellar address for the user. Since we're in a test environment, the account will also be funded with some fake XLMs.
Now you'd like to send XLM to another ChainFront user.
First, generate a unique "idempotency key" to prevent this payment from being applied more than once.
export IDEMPOTENCY_KEY=`uuidgen -r`
Now you can create a payment transaction using that key:
curl -X POST \
https://sandbox.chainfront.io/api/v1/stellar/transactions/payments \
-H 'accept: application/json' \
-H 'authorization: Basic Y2ZhZG1pbkB.......' \
-H 'content-type: application/json' \
-H 'x-customer-id: MY_CUSTOMER_ID' \
-H 'x-idempotency-key: $IDEMPOTENCY_KEY' \
-d '{
"sourceCfAccountIdentifier": { "type" : "ID", "identifier":"1000" },
"destinationCfAccountIdentifier": { "type" : "ID", "identifier":"1001" },
"amount": "50",
"assetCode": "native",
"memo": "This is a test memo"
}'
This will request approval from user id 1000, and once granted, will create, sign, and submit a transaction to Stellar to send 50 XLM to user 1001.
To verify that our payment transaction was successfully applied to the ledger, we'll invoke the ChainFront APIs to check the Stellar account balances.
curl -X GET \
https://sandbox.chainfront.io/api/v1/accounts/1000/stellar \
-H 'accept: application/json' \
-H 'authorization: Basic Y2ZhZG1pbkB.......' \
-H 'content-type: application/json' \
-H 'x-customer-id: MY_CUSTOMER_ID'
Response:
{
"cfAccountId": 1000,
"address": "GCFZ5N7NRKPQK5ZCK3CVUFA4ATXXE6HIPXBXOIMDAGXKFDTEI26GM5R3",
"balances": [
{
"assetType": "native",
"assetCode": "XLM",
"amount": "9949.99995"
}
],
"blacklistAddresses": [],
"whitelistAddresses": [],
"createdDate": "2018-10-23T03:35:05.479158Z",
"lastModifiedDate": "2018-10-23T03:35:05.479158Z"
}
For account 1001:
curl -X GET \
https://sandbox.chainfront.io/api/v1/accounts/1001/stellar \
-H 'accept: application/json' \
-H 'authorization: Basic Y2ZhZG1pbkB.......' \
-H 'content-type: application/json' \
-H 'x-customer-id: MY_CUSTOMER_ID'
Response:
{
"cfAccountId": 1001,
"address": "GBH4TZYZ4IRCPO44CBOLFUHULU2WGALXTAVESQA6432MBJMABBB4GIYI",
"balances": [
{
"assetType": "native",
"assetCode": "XLM",
"amount": "10050.0"
}
],
"blacklistAddresses": [],
"whitelistAddresses": [],
"createdDate": "2018-10-23T03:35:05.479158Z",
"lastModifiedDate": "2018-10-23T03:35:05.479158Z"
}
We see that the payment of 50 XLM was successful, and the required Stellar transaction fees were also deducted from the source account.
The ChainFront account services support creating, reading, and updating ChainFront accounts.
Returns a paginated list of all accounts.
pageNumber | integer <int32> Page number |
pageSize | integer <int32> Number of accounts returned |
A list of accounts
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Create a new account
Account to create.
userName required | string The username of the account. |
email required | string The email address of the account. |
phone required | string The phone number of the account. |
txApprovalMethod required | string Enum:"AUTHY_PUSH" "CHAINFRONT_TOTP" "APP_TOTP" "IMPLICIT" The transaction approval method for this account. For every transaction where this account is a signer, the approval method indicates how the user is to approve the transaction. [AUTHY_PUSH]: sends a push approval request to the registered Authy id. [CHAINFRONT_TOTP]: using ChainFront UIs, the user will have to scan a QR Code with Google Authenticator, and will be prompted to enter their TOTP code. [APP_TOTP]: Your app will need to collect the TOTP code from the user and pass it in the X-TOTP-Code header. [IMPLICIT]: No approval will be required for transactions with this account. Use this flow when your application handles all security related to account identity. |
verification | object (VerificationInfo) |
Account created successfully
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Search for accounts matching a given set of criteria. This uses a simple query language.
To search for a user by email: /accounts/search?query=email:john.doe@company.com.
To search by user name: /accounts/search?query=userName:johndoe.
To search by phone number: /accounts/search?query=phone:555-555-5555.
query | string Search query string |
A list of accounts
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Returns account details for the given account identifier
cfAccountId required | integer <int64> Account identifier |
Account details
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Verify a new account by checking an SMS code sent to a user.
cfAccountId required | integer <int64> The ChainFront account id. |
The phone verification code.
code | string |
Account verified successfully
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
The Stellar account service supports the creation of accounts on the Stellar network. A high-entropy private key is generated and stored securely in the ChainFront vault. This key never leaves the vault, and can only be used to sign transactions if the required multi-factor approvals have been granted.
Returns the Stellar account details for the given account and Stellar address
cfAccountId required | integer <int64> cfAccountId |
Stellar account details
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Create a new Stellar account. The seed, private and public key are created from a high entropy random number; all performed within the secure environment. The private key is created within the secure environment and is never viewable nor transmitted between servers.
cfAccountId required | integer <int64> Account identifier |
stellarAccount
blacklistAddresses | Array of string An optional list of addresses for which this account is prohibited to transact. |
whitelistAddresses | Array of string An optional list of addresses for which this account is allowed to transact. If empty, there are no restrictions on who this account can transact with (subject to any optional blacklist addresses. |
Account created successfully
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Create a new trustline for a Stellar account
cfAccountId required | integer <int64> Account identifier |
stellarAddress required | string stellarAddress |
stellarAccountTrustline
assetCode required | string The asset code. |
assetIssuer required | string The address of the Stellar account which created the asset. |
limit | number The optional limit for which the account trusts the issuing account. |
Trustline created successfully
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
The Stellar transaction service enables the creation and submission of signed transactions.
Transfers an asset between 2 accounts. The source account (or optional payment channel account) must have sufficient XLM balance to pay the transaction fee.
X-Idempotency-Key | string Client generated unique key to guarantee this transaction is only applied once. |
X-TOTP-Code | string When using APP_TOTP approval, pass the TOTP code in this header. |
Payment request object
sourceCfAccountIdentifier required | object (AccountIdentifier) |
destinationCfAccountIdentifier required | object (AccountIdentifier) |
amount required | number The amount to pay. |
assetCode required | string The code of the asset to use. For XLM, use 'native'. For custom assets, the assetIssuer field is also required. |
assetIssuer | string The Stellar address of the issuer of the custom asset. This is only required when using non-native assets. |
paymentChannelCfAccountIdentifier | object (AccountIdentifier) |
additionalApprovers | Array of object (AccountIdentifier) An optional list of ChainFront accounts required to approve this transaction. |
memo | string An optional memo to include with this transaction. |
Payment request accepted
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Transaction already submitted (duplicate idempotency key)
Signs a pre-built transaction encoded as XDR. Use this if you need to submit a transaction to the Stellar network that is not directly supported by the ChainFront APIs.
X-Idempotency-Key | string Client generated unique key to guarantee this transaction is only applied once. |
X-TOTP-Code | string When using APP_TOTP approval, pass the TOTP code in this header. |
XDR encoded transaction object.
sourceCfAccountIdentifier required | object (AccountIdentifier) |
xdr required | string XDR encoded Stellar transaction string. |
paymentChannelCfAccountId | integer <int64> The optional ChainFront username of the account to be used as the payment channel. This account will be used to pay transaction fees. If not set, the source account will be used to pay all fees. |
additionalSigners | Array of object (AccountIdentifier) An optional list of ChainFront accounts required to sign this transaction. |
Transaction accepted
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Transaction already submitted (duplicate idempotency key)
Queries the status of a Stellar transaction based on the ChainFront transaction id.
transactionId required | string Transaction identifier |
Stellar transaction
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
The Ripple (XRP) account service supports the creation of accounts on the XRP Ledger. A high-entropy private key is generated and stored securely in the ChainFront vault. This key never leaves the vault, and can only be used to sign transactions if the required multi-factor approvals have been granted.
Returns the Ripple account details for the given account and Ripple address
cfAccountId required | integer <int64> cfAccountId |
Ripple account details
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Create a new Ripple account. The seed, private and public key are created from a high entropy random number; all performed within the secure environment. The private key is created within the secure environment and is never viewable nor transmitted between servers.
cfAccountId required | integer <int64> Account identifier |
rippleAccount
blacklistAddresses | Array of string An optional list of addresses for which this account is prohibited to transact. |
whitelistAddresses | Array of string An optional list of addresses for which this account is allowed to transact. If empty, there are no restrictions on who this account can transact with (subject to any optional blacklist addresses. |
Account created successfully
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Set account details on a Ripple account
cfAccountId required | integer <int64> Account identifier |
rippleAddress required | string rippleAddress |
rippleAccountSet
flag | integer <int32> Ripple account flag to set. |
clearFlag | integer <int32> Ripple account flag to clear |
domain | string The domain name which owns this account. |
Account details set successfully
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Create a new trustline for a Ripple account
cfAccountId required | integer <int64> Account identifier |
rippleAddress required | string rippleAddress |
rippleAccountTrustline
currencyCode required | string The currency code. |
currencyIssuer required | string The address of the Ripple account which issued the currency. |
limit required | number The limit for which the account trusts the issuing account. |
Trustline created successfully
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
The Ripple transaction service enables the creation and submission of signed transactions.
Signs a pre-built transaction. Use this if you need to submit a transaction to the Ripple network that is not directly supported by the ChainFront APIs.
X-Idempotency-Key | string Client generated unique key to guarantee this transaction is only applied once. |
X-TOTP-Code | string When using APP_TOTP approval, pass the TOTP code in this header. |
XDR encoded transaction object.
sourceCfAccountIdentifier required | object (AccountIdentifier) |
txJson required | string Ripple JSON transaction string. |
paymentChannelCfAccountId | integer <int64> The optional ChainFront username of the account to be used as the payment channel. This account will be used to pay transaction fees. If not set, the source account will be used to pay all fees. |
additionalSigners | Array of object (AccountIdentifier) An optional list of ChainFront accounts required to sign this transaction. |
Transaction accepted
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Transaction already submitted (duplicate idempotency key)
Transfers an asset between 2 accounts. The source account (or optional payment channel account) must have sufficient XRP balance to pay the transaction fee.
X-Idempotency-Key | string Client generated unique key to guarantee this transaction is only applied once. |
X-TOTP-Code | string When using APP_TOTP approval, pass the TOTP code in this header. |
Payment request object
sourceCfAccountIdentifier required | object (AccountIdentifier) |
destinationCfAccountIdentifier required | object (AccountIdentifier) |
amount required | number The amount to pay. |
assetCode required | string The code of the asset to use. For XRP, use 'native'. For custom assets, the assetIssuer field is also required. |
assetIssuer | string The Ripple address of the issuer of the custom asset. This is only required when using non-native assets. |
paymentChannelCfAccountIdentifier | object (AccountIdentifier) |
additionalApprovers | Array of object (AccountIdentifier) An optional list of ChainFront accounts required to approve this transaction. |
memo | string An optional memo to include with this transaction. |
Payment request accepted
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Transaction already submitted (duplicate idempotency key)
Queries the status of a Ripple transaction based on the ChainFront transaction id.
transactionId required | string Transaction identifier |
Ripple transaction
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
The Ethereum account service supports the creation of accounts on the Ethereum network. In the sandbox environment, accounts are created on the Ropsten testnet. A high-entropy private key is generated and stored securely in the ChainFront vault. This key never leaves the vault, and can only be used to sign transactions if the required multi-factor approvals have been granted.
Returns the Ethereum account details for the given account and Ethereum address
cfAccountId required | integer <int64> cfAccountId |
Ethereum account details
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Create a new Ethereum account. The private and public key are created from a high entropy random number; all performed within the secure environment. The private key is created within the secure environment and is never viewable nor transmitted between servers.
write:ethereum_accounts
) cfAccountId required | integer <int64> Account identifier |
Account to create.
blacklistAddresses | Array of string An optional list of addresses for which this account is prohibited to transact. |
whitelistAddresses | Array of string An optional list of addresses for which this account is allowed to transact. If empty, there are no restrictions on who this account can transact with (subject to any optional blacklist addresses. |
Account created successfully
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Currently in preview, the Ethereum contract service supports the creation and invocation of contracts on the Ethereum network.
Returns a paginated list of all contracts associated with this account.
cfAccountId required | integer <int64> Account identifier |
A list of contract accounts
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Create a new contract
cfAccountId required | integer <int64> Account identifier |
The contract to create.
solidityAbi required | string Solidity ABI of this contract. Generated by 'solcjs --abi my_contract.sol.' |
solidityBytecode required | string Solidity bytecode of this contract. Generated by 'solcjs --bin my_contract.sol'. |
params | Array of string If required by the contract constructor, pass parameters to the constructor using this array. |
value | number If needed by this contract, the amount of wei to fund the contract account. |
gasLimit | number The gas limit in wei for the transaction. |
Contract created successfully
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Returns contract details for the given contract name
cfAccountId required | integer <int64> Account identifier |
contractName required | string Name of contract |
Contract details
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Invoke a contract
cfAccountId required | integer <int64> Account identifier |
contractName required | string Name of contract |
X-Idempotency-Key | string Client generated unique key to guarantee this transaction is only applied once. |
X-TOTP-Code | string When using APP_TOTP approval, pass the TOTP code in this header. |
ABI payload indicating the function and data to call on the contract.
methodSignature required | string The contract method signature to execute. |
params | Array of string If required by the contract method, pass parameters to the method using this array. |
gasLimit | number The gas limit in wei for the transaction. |
Transaction details
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Transaction already submitted (duplicate idempotency key)
The Ethereum transaction service enables the creation and submission of signed transactions.
Transfers Ether between 2 accounts. The source account must have sufficient balance to pay the gas fee.
X-Idempotency-Key | string Client generated unique key to guarantee this transaction is only applied once. |
X-TOTP-Code | string When using APP_TOTP approval, pass the TOTP code in this header. |
Payment request object
sourceCfAccountIdentifier required | object (AccountIdentifier) |
destinationCfAccountIdentifier required | object (AccountIdentifier) |
amount required | number Amount to pay, in wei |
additionalSigners | Array of object (AccountIdentifier) An optional list of ChainFront accounts required to sign this transaction. |
memo | string An optional memo to include with this transaction. |
gasLimit | number The gas limit in wei for the transaction. If not set, the gas limit will be 21000 wei. |
Successful operation
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Transaction already submitted (duplicate idempotency key)
Transfers ERC-20 tokens between 2 accounts. The source account must have sufficient balance to pay the gas fee.
X-Idempotency-Key | string Client generated unique key to guarantee this transaction is only applied once. |
X-TOTP-Code | string When using APP_TOTP approval, pass the TOTP code in this header. |
Token payment request object
sourceCfAccountIdentifier required | object (AccountIdentifier) |
destinationCfAccountIdentifier required | object (AccountIdentifier) |
tokenAccountName required | string Name of the account which has the ERC-20 token contract |
amount required | number Amount of ERC-20 tokens to transfer. |
additionalSigners | Array of object (AccountIdentifier) An optional list of ChainFront accounts required to sign this transaction. |
gasLimit | number The gas limit in wei for the transaction. If not set, the gas limit will be 21000 wei. |
Accepted
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Transaction already submitted (duplicate idempotency key)
Queries the status of an Ethereum transaction based on the ChainFront transaction id.
transactionId required | string Transaction identifier |
Ethereum transaction
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Currently in preview, the bitcoin account service supports creating new bitcoin accounts. A high-entropy private key is generated and stored securely in the ChainFront vault. This key never leaves the vault, and can only be used to sign transactions if the required multi-factor approvals have been granted.
Returns the Bitcoin account details for the given account and Bitcoin address
cfAccountId required | integer <int64> cfAccountId |
Bitcoin account details
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Create a new Bitcoin account. The private and public key are created from a high entropy random number; all performed within the secure environment. The private key is created within the secure environment and is never viewable nor transmitted between servers.
cfAccountId required | integer <int64> Account identifier |
bitcoinAccount
blacklistAddresses | Array of string An optional list of addresses for which this account is prohibited to transact. |
whitelistAddresses | Array of string An optional list of addresses for which this account is allowed to transact. If empty, there are no restrictions on who this account can transact with (subject to any optional blacklist addresses. |
Account created successfully
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Currently in preview, the bitcoin transaction service enables the creation and submission of signed transactions.
Transfer bitcoin between 2 accounts. The source account must have sufficient unspent transaction outputs to pay the transaction fee.
X-Idempotency-Key | string Client generated unique key to guarantee this transaction is only applied once. |
X-TOTP-Code | string When using APP_TOTP approval, pass the TOTP code in this header. |
Payment request object
sourceCfAccountIdentifier required | object (AccountIdentifier) |
destinationCfAccountIdentifier required | object (AccountIdentifier) |
amount required | number The amount of currency to pay. |
currencyType required | string Enum:"BTC" "SATOSHI" The type of currency specified in the amount field. |
additionalApprovers | Array of object (AccountIdentifier) An optional list of ChainFront accounts required to approve this transaction. |
memo | string An optional memo to include with this transaction. |
Payment request accepted
Invalid request
Invalid or missing credentials
User not authorized to perform this operation
Transaction already submitted (duplicate idempotency key)
Unable to process payment request (insufficient funds, etc)
Queries the status of a Bitcoin transaction based on the ChainFront transaction id.
transactionId required | string Transaction identifier |
Bitcoin transaction
Invalid request
Invalid or missing credentials
User not authorized to perform this operation