Skip to content

Commit

Permalink
feat: Add bindings to emulator C API
Browse files Browse the repository at this point in the history
  • Loading branch information
mpernambuco committed Mar 14, 2024
1 parent 32fd18b commit 1ebe41e
Show file tree
Hide file tree
Showing 5 changed files with 1,252 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `Makefile` to help node developers setup their environment
- Added experimental sunodo validator mode
- Added instructions on how to run the node with Docker
- Added Cartesi Machine C API wrapper

### Changed

Expand Down
1 change: 1 addition & 0 deletions pkg/emulator/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
31 changes: 31 additions & 0 deletions pkg/emulator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Go bindings to the Cartesi Machine C API

## Quick Start

Ensure that the emulator headers and libraries are inslated or point to them with:
```
export CGO_CFLAGS="-I/foo/machine-emulator/src"
export CGO_LDFLAGS="-L/foo/machine-emulator/src"
```

Build
```
go build
```

Point to the directory containing the image files
```
export CARTESI_IMAGES_PATH=<path-to-image-files>
```

Run
```
./go-emulator --help
./go-emulator
./go-emulator --command="ls -l"
./go-emulator --max-mcycle=0 --store=/tmp/maquina
./go-emulator --load=/tmp/maquina --command="ls -l"
./go-emulator --load=/tmp/maquina --initial-hash --final-hash
./go-emulator --remote-address="localhost:5000"--load=/tmp/maquina --initial-hash --final-hash --command="ls -l"
```
Loading

0 comments on commit 1ebe41e

Please sign in to comment.