ERC20 transferFrom Returned error: sender account not recognized

Hi ,

Maybe this is a stupid question but I just don’t understand…

I try to do token.transferFrom(accounts[0],accounts[1],10000,{from:receiver.address})
And got error: Returned error: sender account not recognized

A Contract can not be a spender ?

Please help
Thank you in advance

What I have tried …

$ truffle(development)> token = await SimpleToken.deployed()   
undefined

$ truffle(development)> receiver = await TokenReceiver.deployed()  
undefined

$ truffle(development)> token.approve(receiver.address,50000)

$ truffle(development)> (await token.allowance(accounts[0],receiver.address)).toString() 
'50000'

$ truffle(development)> token.transferFrom(accounts[0],accounts[1],10000,{from:receiver.address})
Uncaught Error: Returned error: sender account not recognized
1 Like

Hi @qoopme,

Once approving an allowance for the receiver contract, you can then call the doStuff function, which the smart contract includes transferFrom.

Only Externally Owned Accounts (EOAs) can initiate a transaction, which is why you can’t do {from:receiver.address}, and this results in sender account not recognized.

1 Like