Skip to main content

Solana / Transfer

To transfer tokens from one address to another on Solana, you will need:

  • The sending address
  • The receiving address
  • The amount of Solana

The Staking API will manage the rest.

Flow Diagram

Below is a complete diagram for the Solana Transfer flow:

Solana Transfer Flow Diagram

Actions


Create New Transfer Flow

To initiate the transfer process with Staking API, create a new flow with POST /api/v1/flows.

URL

https://solana-slate.datahub.figment.io/api/v1/flows

Request

  • flow : object
    • network_code* : string Network on which this flow operates (ex. solana).
    • chain_code* : string Chain on which this flow operates (ex. mainnet , testnet).
    • operation* : string The operation to perform (ex. transfer).

Response

  • id : string ID of the flow.
  • operation : string The Staking API operation being performed by this flow.
  • state : string The current state of the flow.
  • actions : array It includes the name & inputs of all next possible actions.
    • create_transfer_tx : Use this action to generate a transfer transaction to move SOL between accounts.
      • funding_account_pubkey : The public key of the wallet which will pay the transaction fee.
      • from_account_pubkey : The wallet that SOL will be originating from.
      • to_account_pubkey : The withdrawal address for the given validator.
      • amount : The amount of SOL to be transferred to the account. This field should be in full SOL, not in lamports (ie. if you want to transfer 5 SOL, return "amount": 5.0). The Staking API will translate the amount to lamports so you do not have to worry about the conversion factor. Lamports are fractional SOLs.
  • data : object Flow & transaction data.
Request
Example Response
{
"id": "6b8502c2-77b3-4541-a742-62ff337f0d15",
"operation": "transfer",
"state": "initialized",
"actions": [
{
"name": "create_transfer_tx",
"inputs": [
{
"name": "funding_account_pubkey",
"display": "Funding Account Pubkey",
"description": "",
"type": "string",
"validations": [],
"array": false,
"default_value": null
},
{
"name": "from_account_pubkey",
"display": "From Account Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "to_account_pubkey",
"display": "To Account Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "amount",
"display": "Amount",
"description": "in SOL",
"type": "decimal",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
}
]
}
],
"data": {
"from_account_pubkey": null,
"to_account_pubkey": null,
"amount": null,
"funding_account_pubkey": null,
"transfer_transaction": null
},
"network_code": "solana",
"chain_code": "devnet",
"created_at": "2023-02-28T09:32:03.904Z",
"updated_at": "2023-02-28T09:32:03.904Z"
}


Submit Transfer Data

After creating the new transfer flow, we need to submit the transfer data.

URL

https://solana-slate.datahub.figment.io/api/v1/flows/[:flow_id]/next

After collecting the required inputs as mentioned below, send a PUT request to /api/v1/flows/[:flow_id]/next to proceed to the next step.

Request

  • name* : create_transfer_tx
  • inputs* : object
    • from_account_pubkey* : string The address of the sender's account.
    • to_account_pubkey* : string The address of the wallet to which SOL will be transferred.
    • amount* : number — The amount of the tokens you want to transfer.
    • funding_account_pubkey : string Pubkey of the wallet which will pay the transaction fee.

Response

  • id : string ID of the flow.
  • operation : string The Staking API operation being performed by this flow.
  • state : string The current state of the flow.
  • actions : array It includes the name & inputs of all next possible actions.
  • data : object Flow & transaction data.
Request
Example Response
{
"id": "6b8502c2-77b3-4541-a742-62ff337f0d15",
"operation": "transfer",
"state": "transfer_tx_signature",
"actions": [
{
"name": "refresh_transfer_tx",
"inputs": [
{
"name": "funding_account_pubkey",
"display": "Funding Account Pubkey",
"description": "",
"type": "string",
"validations": [],
"array": false,
"default_value": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy"
},
{
"name": "from_account_pubkey",
"display": "From Account Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy"
},
{
"name": "to_account_pubkey",
"display": "To Account Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "9c8oxENj8XrEM2EMadxUoifZgB1Vbc8GEYqKTxTfPo3i"
},
{
"name": "amount",
"display": "Amount",
"description": "in SOL",
"type": "decimal",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "1.0"
}
]
},
{
"name": "sign_transfer_tx",
"inputs": [
{
"name": "transaction_payload",
"display": "Transaction Payload",
"description": "",
"type": "signed_transaction",
"validations": [
{
"type": "sign_payload",
"options": {}
}
],
"array": false,
"default_value": null,
"signers": [
"Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy"
],
"transaction_payload": "010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000103f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347fdda76b682402ecb38e705b77d7eee793c587b6294a461c14ad89e7e161ade500000000000000000000000000000000000000000000000000000000000000008a20e5a91435e4f72d11db3e291b4797b6830cd2187f94596bca768ca81a5dff01020200010c0200000000ca9a3b00000000"
},
{
"name": "signatures",
"display": "Signatures",
"description": "",
"type": "array_of_signatures",
"validations": [],
"array": true,
"default_value": null,
"element_type": "signature_data",
"signers": [
"Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy"
],
"transaction_payload": "010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000103f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347fdda76b682402ecb38e705b77d7eee793c587b6294a461c14ad89e7e161ade500000000000000000000000000000000000000000000000000000000000000008a20e5a91435e4f72d11db3e291b4797b6830cd2187f94596bca768ca81a5dff01020200010c0200000000ca9a3b00000000",
"signing_payload": "01000103f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347fdda76b682402ecb38e705b77d7eee793c587b6294a461c14ad89e7e161ade500000000000000000000000000000000000000000000000000000000000000008a20e5a91435e4f72d11db3e291b4797b6830cd2187f94596bca768ca81a5dff01020200010c0200000000ca9a3b00000000",
"inputs": [
{
"name": "account_address",
"display": "Account Address",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "signature",
"display": "Signature",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
}
]
}
]
},
{
"name": "confirm_transfer_tx_by_hash",
"inputs": [
{
"name": "hash",
"display": "Hash",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
},
{
"name": "block_number",
"display": "Block Number",
"description": "",
"type": "integer",
"validations": [],
"array": false,
"default_value": null
}
]
}
],
"data": {
"from_account_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"to_account_pubkey": "9c8oxENj8XrEM2EMadxUoifZgB1Vbc8GEYqKTxTfPo3i",
"amount": "1.0",
"funding_account_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"transfer_transaction": {
"raw": "010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000103f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347fdda76b682402ecb38e705b77d7eee793c587b6294a461c14ad89e7e161ade500000000000000000000000000000000000000000000000000000000000000008a20e5a91435e4f72d11db3e291b4797b6830cd2187f94596bca768ca81a5dff01020200010c0200000000ca9a3b00000000",
"signing_payload": "01000103f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347fdda76b682402ecb38e705b77d7eee793c587b6294a461c14ad89e7e161ade500000000000000000000000000000000000000000000000000000000000000008a20e5a91435e4f72d11db3e291b4797b6830cd2187f94596bca768ca81a5dff01020200010c0200000000ca9a3b00000000",
"signed": null,
"hash": null,
"status": null,
"error": null,
"signatures": null,
"block_time": null
}
},
"network_code": "solana",
"chain_code": "devnet",
"created_at": "2023-02-28T09:32:03.904Z",
"updated_at": "2023-02-28T09:37:45.799Z"
}


Submit Signed Transfer Transaction for Broadcast

Before broadcasting the transaction, you must sign the transaction_payload you received in the previous step. After signing the transaction, send a PUT request to /api/v1/flows/[:flow_id]/next and the Staking API will broadcast the transaction to the network.

URL

https://solana-slate.datahub.figment.io/api/v1/flows/[:flow_id]/next

Request

  • name* : sign_transfer_tx
  • inputs* : object
    • transaction_payload* : Signed transaction payload from the previous step's response.
    • signatures : array of object The signatures array can be used instead of sending a transaction payload when the signing keys are kept in a custodial solution, such as Fireblocks. Refer to the guide Signing Transactions with the Fireblocks API for details.

Response

  • id : string ID of the flow.
  • operation : string The Staking API operation being performed by this flow.
  • state : string The current state of the flow.
    • transfer_tx_broadcasting : Transaction has been broadcast and is awaiting confirmation.
    • transferred : Transaction is confirmed and tokens are transferred.
  • actions : array It includes the name & inputs of all next possible actions.
  • data : object Flow & transaction data.
Request
Example Response
{
"id": "6b8502c2-77b3-4541-a742-62ff337f0d15",
"operation": "transfer",
"state": "transfer_tx_broadcasting",
"actions": [
{
"name": "wait",
"estimated_state_change_at": "2023-02-28T09:39:53.205Z",
"inputs": []
}
],
"data": {
"from_account_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"to_account_pubkey": "9c8oxENj8XrEM2EMadxUoifZgB1Vbc8GEYqKTxTfPo3i",
"amount": "1.0",
"funding_account_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"transfer_transaction": {
"raw": "010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000103f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347fdda76b682402ecb38e705b77d7eee793c587b6294a461c14ad89e7e161ade500000000000000000000000000000000000000000000000000000000000000008a20e5a91435e4f72d11db3e291b4797b6830cd2187f94596bca768ca81a5dff01020200010c0200000000ca9a3b00000000",
"signing_payload": "01000103f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347fdda76b682402ecb38e705b77d7eee793c587b6294a461c14ad89e7e161ade500000000000000000000000000000000000000000000000000000000000000008a20e5a91435e4f72d11db3e291b4797b6830cd2187f94596bca768ca81a5dff01020200010c0200000000ca9a3b00000000",
"signed": "01c9e6e53b2165b582192710482f23178d5c7a6d5666cc97f841e07cd983265033f73790fd6650b298ee908e5a42927a68212f6368029a4b9e4e5961e0ca24a70801000103f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347fdda76b682402ecb38e705b77d7eee793c587b6294a461c14ad89e7e161ade500000000000000000000000000000000000000000000000000000000000000008a20e5a91435e4f72d11db3e291b4797b6830cd2187f94596bca768ca81a5dff01020200010c0200000000ca9a3b00000000",
"hash": "538M3ptZsiHeDaRWX6RnFeuCbJcUwfDSU8YzDRBJnPx1AEQvk3to7n1VEWQyCz87oqZpsLC8obvxJNQizMCQauHZ",
"status": null,
"error": null,
"signatures": [
{
"account_address": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"signature": ""
}
],
"block_time": null
}
},
"network_code": "solana",
"chain_code": "devnet",
"created_at": "2023-02-28T09:32:03.904Z",
"updated_at": "2023-02-28T09:38:52.469Z"
}


Get Transfer Flow Status

To get the current state of the existing flow, send a GET request to /api/v1/flows/[:flow_id] using the flow ID from the previous step.

URL

https://solana-slate.datahub.figment.io/api/v1/flows/[:flow_id]

Request

  • None

Response

  • id : string ID of the flow.
  • operation : string The Staking API operation being performed by this flow.
  • state : string The current state of the flow.
    • transfer_tx_broadcasting : Transaction has been broadcast but not confirmed.
    • transferred : Transaction broadcasted and confirmed.
  • actions : array It includes the name & inputs of all next possible actions.
  • data : object Flow & transaction data.
Request
Example Response
{
"id": "e2285668-f6ab-4b77-9e96-edbcca63cd24",
"operation": "staking",
"state": "stake_account",
"actions": [
{
"name": "create_delegate_tx",
"inputs": [
{
"name": "validator_address",
"display": "Vote Account Public Key",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": null
}
]
},
{
"name": "assign_stake_account",
"inputs": [
{
"name": "stake_account_pubkey",
"display": "Stake Account Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "9UPYJp5pApSEaeCizrvqe6vx7hSj3ZPzVDLZHG4hxk3x"
},
{
"name": "funding_account_pubkey",
"display": "Funding Account Pubkey",
"description": "",
"type": "string",
"validations": [
{
"type": "presence",
"options": {}
}
],
"array": false,
"default_value": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy"
}
]
}
],
"data": {
"stake_account_pubkey": "9UPYJp5pApSEaeCizrvqe6vx7hSj3ZPzVDLZHG4hxk3x",
"create_stake_account_transaction": {
"raw": "020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009a17014be532f0085f0ffb9e98911d86f2e19539d8c2f97b47e1974e0a3d9d28d149448f401776e1e4fa25b7523e18a680bf153468df782af75f59c7ff0580d02000305f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f000000000000000000000000000000000000000000000000000000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d517192c5c51218cc94c3d4af17f58daee089ba1fd44e3dbd98a0000000026288b8d1932a012665045867e29aaaff8a08b472849903582e42b994b45203f0202020001340000000000286bee00000000c80000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc000000000030201047400000000f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a534f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a53400000000000000000000000000000000f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a534",
"signing_payload": "02000305f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f000000000000000000000000000000000000000000000000000000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d517192c5c51218cc94c3d4af17f58daee089ba1fd44e3dbd98a0000000026288b8d1932a012665045867e29aaaff8a08b472849903582e42b994b45203f0202020001340000000000286bee00000000c80000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc000000000030201047400000000f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a534f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a53400000000000000000000000000000000f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a534",
"signed": "0238e01c7c328cf82967071dda5d3eefb445bca087b967955c3ffd53a2a3ea0999a0aca1dddcb556a9df7e1316460e3f10cfa66c7ad90b685eacf39ab4f816500609a17014be532f0085f0ffb9e98911d86f2e19539d8c2f97b47e1974e0a3d9d28d149448f401776e1e4fa25b7523e18a680bf153468df782af75f59c7ff0580d02000305f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a5347de1a9be894d367a1544b885b2e3c4f9f7e79728ae5177f7b39c76a35112136f000000000000000000000000000000000000000000000000000000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc00000000006a7d517192c5c51218cc94c3d4af17f58daee089ba1fd44e3dbd98a0000000026288b8d1932a012665045867e29aaaff8a08b472849903582e42b994b45203f0202020001340000000000286bee00000000c80000000000000006a1d8179137542a983437bdfe2a7ab2557f535c8a78722b68a49dc000000000030201047400000000f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a534f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a53400000000000000000000000000000000f8c4898641adada76eeeee2de872d931bc58bfb2ce5b79734e32808cc501a534",
"hash": "28xHAnmmVY6A2wfwe4v1LeoeS3qPBYL4haajmswwfVZ4JVsobeTCzoksVjZjgzzKtbJpCnraCquUwTiYRvkXpoKb",
"status": "confirmed",
"error": null,
"signatures": [
{
"account_address": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"signature": ""
}
],
"block_time": "2023-02-28T07:55:33.000Z"
},
"funding_account_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"stake_authority_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"withdraw_authority_pubkey": "Hk5voGB7wh9HtXTeszbW7AFm3A4B94xWkXeeaqTYspqy",
"amount": "4.0",
"validator_address": null,
"delegate_transaction": null,
"delegation_active_amount": null,
"delegation_inactive_amount": null,
"delegation_status": null,
"delegation_status_error": null,
"estimated_active_at": null
},
"network_code": "solana",
"chain_code": "devnet",
"created_at": "2023-02-28T07:04:33.714Z",
"updated_at": "2023-02-28T07:55:56.620Z"
}