Transition function throws an error. Here it is.

transition :: FreelanceContract -> State FContractDatum -> FContractRedeemer -> Maybe (TxConstraints Void Void, State FContractDatum)
transition fc s r =
    case (stateValue s, stateData s, r) of
        _ -> Just (Constraints.mustBeSignedBy (freelancer fc) , State (FContractDatum 1 (Just 0)) (lovelaceValueOf 2))

Here is the wallet code for submitting the transaction

    case m of
        Nothing             -> throwError "Contract ouput not found"
        Just ((o, _), _) -> case tyTxOutData o of

            FContractDatum 0 Nothing -> do
                logInfo @String "Contract found. Accepting..."
                void $ mapError' $ runStep client Accept
                logInfo @String "Contract Accepted"

            _ -> throwError "unexpected datum"

And here is the error that is thrown when I run my trace. enter image description here

I have boiled this code down to its simplest parts, but still, the error persists. :/

  • How about troubleshooting by replacing Constraints.mustBeSignedBy (freelancer fc) with mempty? The Wallet sending the transaction might not belong to freelancer fc
    – Aoaddeola
    Commented Oct 20, 2021 at 3:33
  • I tried that too! Same error. Maybe my StateMachine setup is where the bug is... Commented Oct 20, 2021 at 12:50
  • Did you implement the smCheck function?
    – Aoaddeola
    Commented Oct 20, 2021 at 12:55

2 Answers 2


The problem is most probably caused by an omitted check function. Even if you do not use it, you have to specify it.


check :: FreelanceContract -> FContractDatum -> FContractRedeemer -> ScriptContext -> Bool
check _ _ _ _ = True


fCStateMachine :: FreelanceContract -> StateMachine FContractDatum FContractRedeemer
fCStateMachine fc = StateMachine
{ smTransition = transition fc
, smFinal = final
, smCheck = check fc
, smThreadToken = blah blah

with the assumption that the function pointing to your final state is final and your ThreadToken "blah blah" :)

  • Great minds think alike ;) Commented Oct 20, 2021 at 13:34
  • True that!!! xD
    – Aoaddeola
    Commented Oct 20, 2021 at 21:24

My StateMachine does not need any additional checks with the smCheck so I completely removed the field. The compiler complained only a little bit and gave me a warning that I had an uninitialized field. Turns out, this field is required for any transitions to be valid.

I added in this function which always returns True and the error was fixed.

check :: FContractDatum -> FContractRedeemer -> ScriptContext -> Bool
check _ _ _ = True

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.