https://github.com/reiver/go-evmasm
Package evmasm provides tools for writing an assembler that turns assembly language into bytecodes for the Ethereum Virtual Machine (EVM), for the Go programming language.
https://github.com/reiver/go-evmasm
assemblers blockchain compilers cryptocurrency ethereum golang
Last synced: 23 days ago
JSON representation
Package evmasm provides tools for writing an assembler that turns assembly language into bytecodes for the Ethereum Virtual Machine (EVM), for the Go programming language.
- Host: GitHub
- URL: https://github.com/reiver/go-evmasm
- Owner: reiver
- License: mit
- Created: 2018-06-11T22:51:48.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-12T14:52:24.000Z (almost 8 years ago)
- Last Synced: 2025-01-25T13:08:23.994Z (over 1 year ago)
- Topics: assemblers, blockchain, compilers, cryptocurrency, ethereum, golang
- Language: Go
- Homepage: https://godoc.org/github.com/reiver/go-evmasm
- Size: 21.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-evmasm
Package **evmasm** provides tools for writing an assembler that turns assembly language into bytecodes for the Ethereum Virtual Machine (EVM), for the Go programming language.
## Documention
Online documentation, which includes examples, can be found at: http://godoc.org/github.com/reiver/go-evmasm
[](https://godoc.org/github.com/reiver/go-evmasm)
## Example
```go
assemblyCode := `push1 3 push1 2 add push1 1 mul`
var evmByteCodes bytes.Buffer
err := evmasm.Assemble(&evmByteCodes, assemblyCode)
```
The buffer evmByteCodes would then contain the equivalent of:
```go
[]byte{
0x60, 0x03, // push1 3
0x60, 0x02, // push1 2
0x01, // add
0x60, 0x01, // push1 1
0x02, // mul
}
```