Questions tagged [statemachines]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
3 views

Paying to Script when initializing a state machine

How does one verifiy the constraint mustPayToTheScript in the onchain code while initializing a state machine? Constraints seem to only be enforcable when a change of state is being undertaken and not ...
  • 785
0 votes
1 answer
36 views

How to make the ThreadToken for a StateMachine available to and verifiable by every participant?

In a StateMachine, TreadToken can be used for uniquely identifying the "genuine" UTxO sitting at the validator script of the StateMachine. A TreadToken is automatically created when the ...
  • 39
0 votes
0 answers
5 views

StateMachine smTransition type signature

In the State Machine, the smTransition function has the following type signature: smTransition :: State s -> i -> Maybe (TxConstraints Void Void, State s) The TxConstraints Void Void is ...
  • 39
0 votes
1 answer
27 views

Is it possible to upgrade a State Machine?

I wonder if it is possible to design a State Machine that has a special state transition that can upgrade the State Machine, meaning creating a new UTxO sitting at a new script address (instead of the ...
  • 39
0 votes
0 answers
11 views

Is it possible to mint and burn tokens using State Machine

In a use case I am considering, it requires some (not all) state transitions to mint some native tokens and some other state transitions to burn the native tokens. Taking into consideration of this ...
  • 39
1 vote
1 answer
29 views

To use state machine or not to use state machine? This is a question

Some validator scripts can be implemented with or without state machine. This is a decision that has to be made by the developer. I wonder what are the pros and cons of using state machine. What ...
  • 39
1 vote
2 answers
62 views

StateMachines on Testnet : How to step a client?

I want to run a statemachine on testnet. The SM runs in the emulator, and I can initialize on testnet, but if I try to make a new client it throws an error. The error comes from transition failure, ...
  • 383
0 votes
0 answers
31 views

How does ThreadToken work in State Machines?

Quick question on Week07. Can someone explain how the NFT token minting/burning is handled by the State machine exactly? Also, in the conditions of the transition function, looks like nftToFirst is ...
1 vote
1 answer
48 views

passing the thread token

In the firstGame function, we use the "logging" component of the contract to tell the thread token. It's not obvious to me where this is needed: is there an internal check in the runStep ...
1 vote
1 answer
149 views

Get public key into PubKeyHash and use it in mustBeSignedBy

A user provides me with his wallet pub key as BultinByteString (or Haskell string, fine either way). From that, I need to get the PubKeyHash, but I am not sure how to hash it or if I need to hash it ...
1 vote
1 answer
50 views

Referencing between scripts and application to state machines

(This is not related to CIP-33.) I want a validator to ensure another validator is also run. Naively I could construct one, get the hash, and hard code it into the other. Presumably two validators can'...
  • 383
1 vote
1 answer
43 views

StateMachine - keep the same value for the next state

I work with the StateMachine library, and I need to transition from state to another where the stateValue of the State is exactly the same. The problem is that when I try to do the transition, I get ...
1 vote
0 answers
90 views

How to use the plutus pab statemachine with RemoteWalletConfig for Nami and Yoroi

Looking at the demo contract provided in the plutus-apps folder, you can follow the example of the PayToWallet endpoint. In this endpoint, yieldUnbalancedTx provides the instance with an unbalanced TX....
1 vote
1 answer
57 views

How to create a smart contract constant variable?

I am using state machines to create a smart contract. How can I create a variable that will be defined by the user when it runs the first step of the state machine and that then can't be modified ...
  • 294
4 votes
1 answer
59 views

How to mint mint NFT with StateMachine

I would like to mint an NFT in a particular state of the state machine Does anyone know where I can find some examples?
2 votes
2 answers
253 views

Will Cardano ever have anything more than validators on-chain?

I have been looking into creating a blackjack game on the Cardano Blockchain. I started with learning Haskell, and writing a simple blackjack CLI game. It was heaps of fun and a bit of a learning ...
2 votes
0 answers
31 views

How to reuse data when updating Token using StateMachine

I'm currently creating a social network-like Dapp on plutus, and I've come across something I don't understand. My Dapp, for example, is NFT(for own identity)->RFT(for sell own content)->NFT(for ...
user avatar
0 votes
1 answer
67 views

Tried minting from transition in StateMachine an got error MintingPolicyNotFound

I changed transition function in Lecture 7 and added constraint for minting Constraints.mustMintValue: transition ts s r = case (stateValue s, stateData s, r) of (v, _, SetPrice p) | p >= 0 ...
  • 429
1 vote
2 answers
51 views

StateMachine validation failing

Transition function throws an error. Here it is. transition :: FreelanceContract -> State FContractDatum -> FContractRedeemer -> Maybe (TxConstraints Void Void, State FContractDatum) ...
2 votes
1 answer
64 views

Constraints.mustValidateIn in a StateMachine

I have an issue with Constraints.mustValidateIn in a StateMachine. In the case using Interval.to deadline everything works as expected. But in the case: Interval.from deadline the constraint is never ...
  • 56
2 votes
1 answer
59 views

How does smCheck work?

In the PPP lecture 7 state machines are introduced. They are used to make the guessing game more concise. One of the situations is where the first player has won and needs to prove their guess by ...