https://github.com/nethermindeth/starknet.go
Golang Library for StarkNet/Cairo
https://github.com/nethermindeth/starknet.go
blockchain go golang nubia starknet
Last synced: 6 months ago
JSON representation
Golang Library for StarkNet/Cairo
- Host: GitHub
- URL: https://github.com/nethermindeth/starknet.go
- Owner: NethermindEth
- License: mit
- Created: 2022-01-03T22:48:44.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-05-12T16:14:24.000Z (6 months ago)
- Last Synced: 2025-05-12T16:38:50.996Z (6 months ago)
- Topics: blockchain, go, golang, nubia, starknet
- Language: Go
- Homepage: http://starknet-go.nethermind.io/
- Size: 15.1 MB
- Stars: 173
- Watchers: 17
- Forks: 127
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- Contributing: docs/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
Get the gopher Starkpilled
**starknet.go** will get your golang backends and WASM frontends to Starknet easily.
With simple abstractions for the Starknet RPC, account management and common
operations on the wallets. The package has excellent documentation for a smooth
0 to 1 experience.
# ๐ Features
- Seamless interaction with the Starknet RPC
- Tight integration with Juno
- Account management: Deploy accounts easily
- Good concurrency support
# Getting Started
- library documentation available at [pkg.go.dev](https://pkg.go.dev/github.com/NethermindEth/starknet.go).
- [simple call example](./examples/simpleCall) to make a contract call to a testnet contract.
- [deploy account example](./examples/deployAccount) to deploy a new account contract on testnet.
- [invoke transaction example](./examples/invoke) to add a new invoke transaction on testnet.
- [declare transaction example](./examples/simpleDeclare) to add a new contract on testnet.
- [deploy contract UDC example](./examples/deployContractUDC) to deploy an ERC20 token using [UDC (Universal Deployer Contract)](https://docs.starknet.io/architecture-and-concepts/accounts/universal-deployer/) on testnet.
- [typed data example](./examples/typedData) to sign and verify a typed data.
- [websocket example](./examples/websocket) to learn how to subscribe to WebSocket methods.
### Run Examples
***starknet simpleCall***
```sh
cd examples/simpleCall
go run main.go
```
> Check [here](examples/simpleCall/README.md) for more details
***starknet simpleDeclare***
```sh
cd examples/simpleDeclare
go run main.go
```
> Check [here](examples/simpleDeclare/README.md) for more details
***starknet deployAccount***
```sh
cd examples/deployAccount
go run main.go
```
> Check [here](examples/deployAccount/README.md) for more details
***starknet invoke***
```sh
cd examples/invoke
go run main.go simpleInvoke.go verboseInvoke.go
```
> Check [here](examples/invoke/README.md) for more details
***starknet deployContractUDC***
```sh
cd examples/deployContractUDC
go run main.go
```
> Check [here](examples/deployContractUDC/README.md) for more details.
***starknet readEvents***
```sh
cd examples/readEvents
go run main.go
```
> Check [here](examples/readEvents/README.md) for more details
***starknet typedData***
```sh
cd examples/typedData
go run main.go
```
> Check [here](examples/typedData/README.md) for more details.
***starknet websocket***
```sh
cd examples/websocket
go run main.go
```
> Check [here](examples/websocket/README.md) for more details.
Check [here](https://github.com/NethermindEth/starknet.go/tree/main/examples) for some FAQ answered by these examples.
### RPC
`starknet.go` RPC implements the Starknet [RPC v0.8.0 spec](https://github.com/starkware-libs/starknet-specs/releases/tag/v0.8.0)
| Method | Implemented (*) |
| ------------------------------------------ | ------------------ |
| `starknet_getBlockWithReceipts` | :heavy_check_mark: |
| `starknet_getBlockWithTxHashes` | :heavy_check_mark: |
| `starknet_getBlockWithTxs` | :heavy_check_mark: |
| `starknet_getStateUpdate` | :heavy_check_mark: |
| `starknet_getStorageAt` | :heavy_check_mark: |
| `starknet_getTransactionByHash` | :heavy_check_mark: |
| `starknet_getTransactionByBlockIdAndIndex` | :heavy_check_mark: |
| `starknet_getTransactionReceipt` | :heavy_check_mark: |
| `starknet_getTransactionStatus` | :heavy_check_mark: |
| `starknet_getClass` | :heavy_check_mark: |
| `starknet_getClassHashAt` | :heavy_check_mark: |
| `starknet_getClassAt` | :heavy_check_mark: |
| `starknet_getBlockTransactionCount` | :heavy_check_mark: |
| `starknet_call` | :heavy_check_mark: |
| `starknet_estimateFee` | :heavy_check_mark: |
| `starknet_estimateMessageFee` | :heavy_check_mark: |
| `starknet_blockNumber` | :heavy_check_mark: |
| `starknet_blockHashAndNumber` | :heavy_check_mark: |
| `starknet_chainId` | :heavy_check_mark: |
| `starknet_syncing` | :heavy_check_mark: |
| `starknet_getEvents` | :heavy_check_mark: |
| `starknet_getNonce` | :heavy_check_mark: |
| `starknet_addInvokeTransaction` | :heavy_check_mark: |
| `starknet_addDeclareTransaction` | :heavy_check_mark: |
| `starknet_addDeployAccountTransaction` | :heavy_check_mark: |
| `starknet_traceTransaction` | :heavy_check_mark: |
| `starknet_simulateTransaction` | :heavy_check_mark: |
| `starknet_specVersion` | :heavy_check_mark: |
| `starknet_traceBlockTransactions` | :heavy_check_mark: |
| `starknet_getStorageProof` | :heavy_check_mark: |
| `starknet_getMessagesStatus` | :heavy_check_mark: |
| `starknet_getCompiledCasm` | :heavy_check_mark: |
#### WebSocket Methods
| Method | Implemented (*) |
| ------------------------------------------ | ------------------ |
| `starknet_subscribeEvents` | :heavy_check_mark: |
| `starknet_subscribeNewHeads` | :heavy_check_mark: |
| `starknet_subscribePendingTransactions` | :heavy_check_mark: |
| `starknet_subscribeTransactionStatus` | :heavy_check_mark: |
### Run Tests
```go
go test -v ./...
```
### Run RPC Tests
```go
go test -v ./rpc -env [mainnet|devnet|testnet|mock]
```
### Run Benchmarks
```go
go test -bench=.
```
### Compatibility and stability
## ๐ค Contribute
We're always looking for passionate developers to join our community and
contribute to `starknet.go`. Check out our [contributing guide](./docs/CONTRIBUTING.md)
for more information on how to get started.
## ๐ License
This project is licensed under the **MIT license**.
See [LICENSE](LICENSE) for more information.
Happy coding! ๐
## Contributors โจ
Thanks goes to these wonderful people
([emoji key](https://allcontributors.org/docs/en/emoji-key)):

drspacemn
๐ป

Gregory Guillou
๐ป

Tarrence van As
๐ป

Alex Sumner
๐ป

Yun
๐ป

Zoraiz Mahmood
๐ป

Lucas @ StarkWare
๐ป

Coburn
๐ป

Larko
๐ป

oxlime
๐ป

Blaลพ Hrastnik
๐ป

Florian
๐ป

greged93
๐ป

Jean-Sรฉbastien Ney
๐ป

Kristijan Rebernisak
๐ป

Rian Hughes
๐ป

Carmen Irene Cabrera Rodrรญguez
๐ป

Josh Klopfenstein
๐ป

Antonio Quental
๐

Jelilat Anofiu
๐ป

Jorik Schellekens
๐

Akashneelesh
๐ก

Fico
๐ป

Bitcoinnoobie
๐ป

stranger80
๐ป

omahs
๐
This project follows the
[all-contributors](https://github.com/all-contributors/all-contributors)
specification. Contributions of any kind welcome!