Carti: A decentralized package manager for Cartesi Machines. What does this mean? Carti makes it possible for developers to define cartesi machine drives, boot specification, and add descriptive metadata to the components. This enables developers to share drives, and entire machines in json. The decentralized bit is that you can store, and share these components anywhere, there is no central repository. This means that you the developer are ultimately in control of how you want to serve your machine.
There are 3 main concepts that make up Carti. There are bundles
, carti-machine-package.json
, bundles.json
. In this section we'll go over them and
see how they relate.
Bundles are everything in Carti. Bundles describe cartesi rom, ram, and flash drives. Bundles look like.
{ bundleType: "flashdrive", name: "calculator-output", fileName: "output.raw", id: "baenrwia5pfe7b6dvoys33k7umgsbbixgpympwcfjpqowpaye3bghmrs24m", version: "0.0.1", uri: "https://github.com/createdreamtech/carti-sample/blob/feat/complete/output.raw" }
Bundles are created via the carti bundle add --help
command. When they are created or installed via carti install
or carti get
the are located in either the
global space ~/.carti/carti_bundles
or within the current working directory ./carti_bundles
. The bundles are installed in a id based fashion to disk. They are prefixed, via id and look like.
├── baenrwia5vqqvdu5chzjqq57tfo45z2txorpnmljeiuwemcibba43noqpvu │ ├── carti-meta.json │ └── linux-5.5.19-ctsi-2.bin ├── baenrwig2hfjzzeqmozb7sws6tyxmyazvuipjp5hxamtllifsokwh73eucy │ ├── carti-meta.json │ └── rootfs.ext2 └── baenrwigwdfweve3apyvwicc2zpmzz6vdhsg62xnmzhauruw6ud4dbbafuq ├── carti-meta.json └── rom.bin
The carti-meta.json is just the bundle data stored next to the asset, to enable faster indexing. In future this may change.
Bundles.json (schema) is the mechanism that makes sharing bundles possible. Whenever you publish a bundle you're adding that bundle to bundles.json. What this does is allow you to control when and how you release bundles that you're developing. Additionally, you control the listing, so if you want to unpublish something or keep multiple versions around, or keep an experimental development branch going you can simply commit this bundles.json to a git repository.
{ "bundles": [ { "bundleType": "flashdrive", "name": "calculator-input", "fileName": "input.raw", "id": "baenrwigmw66wmp2vwjejrmmlw5sbvwpsx3zjtnd7rep4oo6wd3glahtfl4", "version": "0.0.1", "uri": "https://github.com/createdreamtech/carti-sample/blob/feat/complete/input.raw" }, { "bundleType": "flashdrive", "name": "calculator-output", "fileName": "output.raw", "id": "baenrwia5pfe7b6dvoys33k7umgsbbixgpympwcfjpqowpaye3bghmrs24m", "version": "0.0.1", "uri": "https://github.com/createdreamtech/carti-sample/blob/feat/complete/output.raw" } ] }
Well any time you're calling carti bundle publish
you're taking a locally installed bundle and either directly publishing it to s3 using the storage, disk (in development mode) or uploading your bundle raw asset to a predetermined uri endpoint that users will fetch the data from ( this could even be git). When this happens
you then get an entry added to the listing. It's up to you when you make this known or how you make this none to your users.
Carti machine package is what we've been working towards. A portable description of a cartesi machine that allows you to describe dependencies that can be automatically resolved and shared with other developers. Simply put it allows you to describe dependencies, and how to resolve them. Additionally, it describes the operation of a machine. It is a superset of Cartesi Machine Config. In fact we use this to produce a cartesi machine config lua file to be used in the playground and other cartesi ecosystem.
All commands pretaining to the machine are prefixed by carti machine
. Carti machine relies on bundle data to add and refer to drives and boot configuration. Drives are added to machine config via carti machine add
. This mechanism looks at global and local bundles to allow you to select what bundle you'd like to refer to in the configuration. All bundles are refered to via content id. A machine config looks like this.
{ "assets": [ { "cid": "baenrwigwdfweve3apyvwicc2zpmzz6vdhsg62xnmzhauruw6ud4dbbafuq", "name": "default-rom", "fileName": "rom.bin" }, { "cid": "baenrwia5vqqvdu5chzjqq57tfo45z2txorpnmljeiuwemcibba43noqpvu", "name": "default-ram", "fileName": "linux-5.5.19-ctsi-2.bin" }, { "cid": "baenrwig2hfjzzeqmozb7sws6tyxmyazvuipjp5hxamtllifsokwh73eucy", "name": "default-root", "fileName": "rootfs.ext2" } ], "machineConfig": { "flash_drive": [ { "cid": "baenrwig2hfjzzeqmozb7sws6tyxmyazvuipjp5hxamtllifsokwh73eucy", "start": "0x8000000000000000", "label": "root", "length": "0x3c00000", "shared": false } ], "ram": { "cid": "baenrwia5vqqvdu5chzjqq57tfo45z2txorpnmljeiuwemcibba43noqpvu", "length": "0x4000000" }, "rom": { "cid": "baenrwigwdfweve3apyvwicc2zpmzz6vdhsg62xnmzhauruw6ud4dbbafuq" }, "boot": { "args": "ls" } }, "version": "0.0.0-development", "repos": [ "https://github.com/createdreamtech/carti-default" ] }
carti machine add boot
allows you to change set config. Note here boot
section pre computes a prefix that can be overriden with the prefix field. However, this prefix structures a preamble to the boot that orders the flash drives. This is automatically handled but can be overriden by setting prefix. carti machine add flash
Contribute to the project, even filing an issue is a great contribution, also let us know what missing we'd love to patch it up!