Welcome to the key concepts section of mintBlue's Machine functionality. Here, you'll get a high-level understanding of the fundamental components of Machines. This overview lays the groundwork for further exploration of mintBlue's Machine functionality.
Let's dive in to explore each concept and build a Machine.
The core engine for running applications that interface with blockchain-driven architectures. Provides mechanisms for reading from and writing to the blockchain and invoking app-specific methods. In short, a machine requires:
- Application Logic
- Recorder (optional)
The App represents a class that contains the logic for your application interacting with a blockchain. Each App maintains a state and includes one or multiple functions that modify the state.
Example: Here's a simple SupplyChain class that keeps track of harvested coffee bean batches.
A Writer is responsible for writing actions to storage. Each function you call from your App will be sent to mintBlue using a transaction generated by the mintBlue SDK. The mintBlue platform then interacts with the blockchain to store your data, abstracting the complexity of blockchain technology.
The Writer uses the Data ouput type to store your function invocation and arguments. It allows the machine to iterate over all its transactions to build its latest state and enable time travel debugging.
Here's a snippet from the Writer implementation.
The Reader facilitates listening to transaction events on the blockchain using mintBlue and dispatching them accordingly as actions. It accepts your SDK token and a project ID to initialize the Reader.
After dispatching an action, you can add an optional Recorder that automatically creates in-memory snapshots. It allows you to time-travel the application state. Beyond that, you can manually create snapshots. It's up to you if and where to store these snapshots.
Here's the Recorder interface.
The mintBlue SDK is designed to handle the communication between your application and the blockchain, abstracting away the complexities of blockchain interaction.