The transaction has been reverted enter image description hereto the initial state. i get transaction failed everytime

  • Please, share source code as text.
    – Ismael
    Jun 29, 2023 at 20:56

1 Answer 1


That is not the correct way to send ether from the user to the contract, you must do it in the call to buyCourse(), not inside. The contract cannot get ether from the user wallet, but receive it.

In your code, the contract is sending ether to itself, which is not possible and fails.

Look for the solution in the part where you call buyCourse()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.