https://github.com/alperencantez/gsolc
⛓️🛠️ Extendable wrapper for targeting Solidity compiler (solc) bindings in Go
https://github.com/alperencantez/gsolc
ethereum go solc v8-engine
Last synced: 13 days ago
JSON representation
⛓️🛠️ Extendable wrapper for targeting Solidity compiler (solc) bindings in Go
- Host: GitHub
- URL: https://github.com/alperencantez/gsolc
- Owner: alperencantez
- License: mit
- Created: 2024-04-03T18:52:09.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-01T07:04:10.000Z (almost 2 years ago)
- Last Synced: 2025-01-14T00:35:09.351Z (over 1 year ago)
- Topics: ethereum, go, solc, v8-engine
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gsolc
This Go package provides a basic Solidity compiler by leveraging the existing Solidity compiler package in Node.js. It uses the V8 engine bindings from Chromium to run the Node.js compiler within the Go environment.
## Table of Contents
- [Installation](#installation)
- [Dependencies](#dependencies)
- [Contributing](#contributing)
- [License](#license)
## Installation
### Prerequisites
Ensure you have the following installed:
- Go (1.19+)
### Steps
1. **Clone the repository:**
```sh
git clone https://github.com/alperencantez/gsolc.git
cd gsolc
```
2. **Build the Go package:**
```sh
cd ..
go build
```
## Usage
Here's a basic example of how to use the package:
```go
package main
import (
"fmt"
"log"
"github.com/alperencantez/gsolc"
)
func main() {
source := `pragma solidity ^0.8.0; contract HelloWorld { string public message = "Hello, World!"; }`
compiled, err := gscolc.Compile(source)
if err != nil {
log.Fatalf("Compilation error: %v", err)
}
fmt.Println("Compiled bytecode:", compiled.Bytecode)
}
```
## Dependencies
This project relies on the following dependencies:
- [Golang V8 Engine Bindings](https://github.com/rogchap/v8go)
- [Solidity Compiler (solc-js)](https://www.npmjs.com/package/solc)
## Contributing
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
1. Fork the repository.
2. Create a new branch (`git checkout -b feature-branch`).
3. Commit your changes (`git commit -m 'Add some feature'`).
4. Push to the branch (`git push origin feature-branch`).
5. Open a pull request.
## License
This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.