# create

Creates a new local Cartesi machine instance from the given configuration and optional runtime configuration. Returns a [CartesiMachine](/cm/api/cartesi-machine) instance. This is the main entry point for instantiating a new machine in your application.

## Function Signature

```ts
create(config: MachineConfig, runtimeConfig?: MachineRuntimeConfig): CartesiMachine
```

## Example

```ts twoslash
import { create, BreakReason } from "@deroll/cm";

const machine = create({
    ram: {
        length: 0x8000000, // 128MB of RAM
        image_filename: "linux.bin",
    },
    flash_drive: [
        {
            image_filename: "rootfs.ext2",
        },
    ],
    dtb: {
        entrypoint: "echo Hello world!",
    },
});

// Run the machine until it yields or halts (default is MAX_MCYCLE)
const reason = machine.run();
if (reason === BreakReason.Halted) {
    console.log("Machine halted");
}
```
