Skip to content
Logo

create

Creates a new local Cartesi machine instance from the given configuration and optional runtime configuration. Returns a CartesiMachine instance. This is the main entry point for instantiating a new machine in your application.

Function Signature

create(config: MachineConfig, runtimeConfig?: MachineRuntimeConfig, dir?: string): CartesiMachine

Example

import { ,  } from "@cartesi/machine";
 
const  = ({
    : {
        : 0x8000000, // 128MB of RAM
        : { : "linux.bin" },
    },
    : [
        {
            : { : "rootfs.ext2" },
        },
    ],
    : {
        : "echo Hello world!",
    },
});
 
// Run the machine until it yields or halts (default is MAX_MCYCLE)
const  = .();
if ( === .) {
    .("Machine halted");
}