How to fix this error: The transaction contains a predicate which failed to validate

I’m trying to get a super simple example for predicates to work, where the predicate takes no arguments and returns true.

In the small frontend the predicate is loaded, funds are sent to the predicate and subsequently I try to spend the funds in the predicate. Although the predicate should return true always, I get an error that validation failed.

The full repo (minimal example): GitHub - ewynx/predicate-practice-client1
This is where I’m spending funds in the predicate (or at least that is the intention): predicate-practice-client1/App.tsx at master · ewynx/predicate-practice-client1 · GitHub

Can someone tell me what I’m doing wrong or provide a working example?


Hi @elena, thanks for reaching out.

I can see that you have not set a high enough gas limit for that transaction to succeed. With this, it is deemed invalid as documented in the fuel specification. I was able to get your example to succeed with a gas limit of 64.


Thank you! This works.


you can try to contact on discord

1 Like

Discord is available yes, but a lot of information can get lost. The forum acts as a great source of truth in case others have the same problem.

Bit of additional information on the above also, may be helpful to yourself or others that land at this topic. The transfer function returns a TransactionResponse - source code. This class has a gasUsed attribute that can be used to inform your gasLimit on the request.

1 Like

Thanks, that’s helpful :pray:

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.