Skip to main content

Send a transfer

In this guide, you will learn how to send native funds between two addresses using the MARCO API.

Before you begin

Before you start, complete the following prerequisites:

1. Get permission to use the wallet

To grant privileges to the service account to use the sender's wallet, follow these steps:

  1. Open MARCO Console.

  2. On the left sidebar, go to Wallet Instances > Instances.

    Wallet instances list

  3. Choose the wallet that will sign the transaction.

  4. Open the Identity Permissions tab.

  5. In the Add Identity field, write the service account's email address that will make the API call.

    Wallet instances identity permissions

    note

    You can find the service account's email address in the Service Accounts > List Service account page on the MARCO Console.

  6. Click Add. This will add the service account to the list of identities with permission to view the wallet.

  7. Choose the service account from the list.

  8. In the Grant Role field, select Wallets user.

    Wallet instances grant role

  9. Click Grant. This will grant the service account permission to use the wallet.

2. Send the transaction

To send a transaction, you have two options:

  • Use the recipient's MARCO wallet id: Send a POST request to https://api-marco.finboot.com/resource-proxy/marco-cloud-wallet/api/v1/cloud-wallet/send-glo-transaction endpoint as follows:

    curl --location --request POST 'https://api-marco.finboot.com/resource-proxy/marco-cloud-wallet/api/v1/cloud-wallet/send-glo-transaction' \
    --header 'ApplicationToken: <APPLICATION_TOKEN>' \
    --header 'Authorization: Bearer <ACCESS_TOKEN>' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "glo":{
    "version":"0.1.0",
    "type":"transfer",
    "options":{
    "recipient":{
    "lookup_service":{"type":"marco","value":"marco"},
    "resource":"<RECIPIENT_WALET_ID>"
    },
    "amount":"<AMOUNT>"
    },
    "meta":{}
    },
    "walletId":"<SENDER_WALET_ID>",
    "password":"<SENDER_WALET_PASSWORD>",
    "options":{"secureSessionToken":null}
    }'

    Replace:

    • APPLICATION_TOKEN: The marpp token from the Get your API tokens guide.
    • ACCESS_TOKEN: The service account token from the Get your API tokens guide.
    • RECIPIENT_WALLET_ID: The resource ID of the wallet you want to send the transaction. For example, test-wallet-recipient.
    • AMOUNT: The number of native tokens you want to send. Your wallet must have at least this amount of tokens. For example, 0x0.
    • SENDER_WALLET_ID: The resource ID of the wallet you want to send the transaction from. For example, test-wallet-sender. This wallet must have at least the AMOUNT of native tokens you want to send.
    • SENDER_WALET_PASSWORD: The password of the wallet you want to send the transaction from.
  • Use the recipient's native address: Send the same request as the previous method, but define the recipient's native address in the glo.options.recipient field.

      ...
    "glo":{
    "version":"0.1.0",
    "type":"transfer",
    "options":{
    "recipient":{
    "lookup_service":{"type":"ledger","value":"<DLT_ID>"},
    "resource":"<RECIPIENT_WALLET_ADDRESS>"
    },
    "amount":"<AMOUNT>"
    },
    "meta":{}
    },
    ...

    Replace:

    • DLT_ID: One of the supported DLT's. For example, ethereum.
    • RECIPIENT_WALLET_ADDRESS: The native address of the wallet you want to send the transaction. For example, 0x1234567890abcdef1234567890abcdef12345678.
note

Depending on the DLT chosen, you might need to specify additional parameters in the GLO meta field. For example, the gasPrice information for Ethereum public network. For more information, refer to the GLO specification.

Once the request is sent, the API will return the transaction locator. For example:

{
"version": "0.0.1",
"ledgerId": "finboot-clique-v1",
"locator": "0x3647379f63fc5a6833a0fe6ac7e08e33eaeffa5d84404a977f41fd22da1c3bad",
"trl": {...},
"intent": "c0f9e7b7-cd26-4025-beae-b5a41dcc61af",
"receipts": [
{
"hash": "0x3647379f63fc5a6833a0fe6ac7e08e33eaeffa5d84404a977f41fd22da1c3bad"
}
]
}

3. Check the transaction status

Finally, you can check the transaction status using the transaction locator from the previous step. To do this, send a POST request to the https://api-marco.finboot.com/ledgeropsgateway/ledger/operation/transaction/search?ledgerId=<LEDGER_ID>&locator=<LOCATOR_ID> endpoint as follows:

curl --location --request GET 'https://api-marco.finboot.com/ledgeropsgateway/ledger/operation/transaction/search?ledgerId=<LEDGER_ID>&locator=<LOCATOR_ID>&withReceipt=true' \
--header 'ApplicationToken: <APPLICATION_TOKEN>' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <ACCESS_TOKEN>'

Replace:

  • APPLICATION_TOKEN: The marpp token from the Get your API tokens guide.
  • ACCESS_TOKEN: The access token from the Get your API tokens guide.
  • LEDGER_ID: The ID of the network associated to the that belongs to the ledger. For example, you can use LGR-3c8de984e49 for finboot-clique-v1 network. To get the list of ids, see Networks.
  • LOCATOR_ID: The locator ID of the transaction you sent in the previous step. For example, 0x3647379f63fc5a6833a0fe6ac7e08e33eaeffa5d84404a977f41fd22da1c3bad.

Once the transaction receives a confirmation, you should see status set to succeeded in the response.

{
"locator": "0x3647379f63fc5a6833a0fe6ac7e08e33eaeffa5d84404a977f41fd22da1c3bad",
"status": "succeeded"
}