Dfx ledger transfer() failed #InsufficientFunds

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 :

Backend handling, Ledger is using icp_ledger_canister :

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() ..

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

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

1 Like