# Dfx ledger transfer() failed #InsufficientFunds

**URL:** <https://forum.dfinity.org/t/dfx-ledger-transfer-failed-insufficientfunds/37735>\
**Category:** Developers\
**Tags:** Functional-Programming\
**Created:** [November 25, 2024, 9:41am UTC](https://forum.dfinity.org/t/dfx-ledger-transfer-failed-insufficientfunds/37735 "2024-11-25T09:41:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ImSteffi](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/imsteffi/32/19792_2.png) [@ImSteffi](https://forum.dfinity.org/u/ImSteffi)\
**Post date:** [November 25, 2024, 9:41am UTC](https://forum.dfinity.org/t/dfx-ledger-transfer-failed-insufficientfunds/37735/1 "2024-11-25T09:41:43Z")

</div>

Hi guys, im so lost on why im getting `Transfer failed: #InsufficientFunds({balance = {e8s = 0}})`.

When clearly I have balance on both accounts. Have I wrote the transfer function wrong ?

`Buyer Account ID: "\96\61\9A\46\85\25\A7\E2\0A\02\B1\37\92\B0\03\62\BF\C3\1E\E7\BB\FD\11\39\CA\BD\14\9E\4E\F0\46\6D"`

`Seller Account ID: "\CF\8C\CC\CC\54\D5\63\80\14\E5\B2\85\D4\DA\32\53\51\13\3B\39\0A\58\A6\CD\48\E5\48\34\47\A8\01\3D"`

`Buyer Account Balance (e8s): 1_000_000_000`

`Seller Account Balance (e8s): 1_000_000_000`

`Transaction Amount (e8s): 100`

`Transaction Fee (e8s): 10_000`

`Transfer Payload: {amount = {e8s = 100}; created_at_time = null; fee = {e8s = 10_000}; from_subaccount = ?"\96\61\9A\46\85\25\A7\E2\0A\02\B1\37\92\B0\03\62\BF\C3\1E\E7\BB\FD\11\39\CA\BD\14\9E\4E\F0\46\6D"; memo = 1; to = "\CF\8C\CC\CC\54\D5\63\80\14\E5\B2\85\D4\DA\32\53\51\13\3B\39\0A\58\A6\CD\48\E5\48\34\47\A8\01\3D"}`

`Transfer failed: #InsufficientFunds({balance = {e8s = 0}})`

Front-end call sending both principals and the value :

 ![image](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/3X/2/5/25400bdc73e0ac13c1705d93c716ee8ee475cfc3.png)

Backend handling, Ledger is using icp\_ledger\_canister :

 ![image](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/3X/1/2/12e956dec2f34c78903d0a2b66f7f2b6544910d5.png)

---

<div class="post-metadata">

**Author:** ![rem.codes](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/rem.codes/32/40260_2.png) [@rem.codes](https://forum.dfinity.org/u/rem.codes)\
**Post date:** [November 25, 2024, 9:53am UTC](https://forum.dfinity.org/t/dfx-ledger-transfer-failed-insufficientfunds/37735/2 "2024-11-25T09:53:13Z")

</div>

i think you are going wrong on setting the `from_subaccount` on the transfer payload.

Don’t you need to the `caller` as the buyer?

`public shared ({ caller }) func transfer() ..`

> **[Caller identification | Internet Computer](https://internetcomputer.org/docs/current/motoko/main/writing-motoko/caller-id/#using-caller-identification)**
>
> Overview

can you verify that the subaccount from the caller has any balance?

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [November 25, 2024, 9:58am UTC](https://forum.dfinity.org/t/dfx-ledger-transfer-failed-insufficientfunds/37735/3 "2024-11-25T09:58:47Z")

</div>

^this. Maybe to clarify/reword the advice: `account_id != subaccount_id`. It looks a lot like you’re conflating the two concepts
