Giter VIP home page Giter VIP logo

zabi's Introduction


ZAbi logo

A zig library to interact with EVM blockchains

ZAbi logo

Overview

Zabi aims to add support for interacting with ethereum or any compatible EVM based chain.

Zig Versions

Zabi will support zig v0.13 in seperate branches. If you would like to use it you can find it in the zig-v0.13 branch where you can build it against zig 0.13.0. The main branch of zabi will follow the latest commits from zig and the other branch will be stable in terms of zig versions but not features from zabi.

Example Usage

const args_parser = zabi.args;
const std = @import("std");
const zabi = @import("zabi");
const Wallet = zabi.clients.wallet.Wallet(.http);

const CliOptions = struct {
    priv_key: [32]u8,
    url: []const u8,
};

pub fn main() !void {
    var gpa = std.heap.GeneralPurposeAllocator(.{}){};
    defer _ = gpa.deinit();

    var iter = try std.process.argsWithAllocator(gpa.allocator());
    defer iter.deinit();

    const parsed = args_parser.parseArgs(CliOptions, gpa.allocator(), &iter);

    const uri = try std.Uri.parse(parsed.url);

    var wallet = try Wallet.init(parsed.priv_key, .{ .allocator = gpa.allocator(), .uri = uri });
    defer wallet.deinit();

    const message = try wallet.signEthereumMessage("Hello World");

    const hexed = try message.toHex(wallet.allocator);
    defer gpa.allocator().free(hexed);

    std.debug.print("Ethereum message: {s}\n", .{hexed});
}

Usage

Explore the docs to find out more on how you can use or integrate Zabi in your project!

Features

  • Json RPC with support for http/s, ws/s and ipc connections.
  • EVM Interperter that you can use to run contract bytecode.
  • Wallet instances and contract instances to use for interacting with nodes/json rpc.
  • BlockExplorer support. Only the free methods from those api endpoints are supported.
  • Custom Secp256k1 ECDSA signer using only Zig and implementation of RFC6979 nonce generator.
  • Custom JSON Parser that can be used to deserialize and serialized RPC data at runtime.
  • ABI to zig types.
  • Support for EIP712.
  • Parsing of human readable ABIs into zig types with custom Parser and Lexer.
  • HD Wallet and Mnemonic passphrases.
  • RLP Encoding/Decoding.
  • SSZ Encoding/Decoding.
  • ABI Encoding/Decoding with support for Log topics encoding and decoding.
  • Parsing of encoded transactions and serialization of transaction objects.
  • Support for all transaction types and the new EIP4844 KZG commitments.
  • Support for OPStack and ENS.
  • Custom meta programming functions to translate ABI's into zig types.
  • Support for interacting with test chains such as Anvil or Hardhat.
  • Custom RPC server used to fuzz data. Support http, ws and ipc.
  • Custom cli args parser that translates commands to zig types and can be used to pass data to methods.
  • Custom data generator usefull for fuzzing.

And a lot more yet to come...

Goal

The goal of zabi is to be one of the best library to use by the ethereum ecosystem and to expose to more people to the zig programming language.

Contributing

Contributions to Zabi are greatly appreciated! If you're interested in contributing to ZAbi, feel free to create a pull request with a feature or a bug fix.
You can also read the contributing guide before submitting a pull request

Sponsors

If you find Zabi useful or use it for work, please consider supporting development on GitHub Sponsors or sending crypto to zzabi.eth or interacting with the drip platform where 40% of the revenue gets sent to zabi's dependencies. Thank you ๐Ÿ™

zabi's People

Contributors

dependabot[bot] avatar eltociear avatar omahs avatar raiden1411 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

zabi's Issues

TLS client index out of bounds

Describe the bug

There is a bug on the tls client that will cause index out of bound errors
ziglang/zig#15226

This mostly affects the Websocket client. This is a sporadic error and for now use the Websocket client with this in mind. You will most likely only get this error on subscription events

Steps To Reproduce

No response

Zig Version

v0.12.0-dev.3154+0b744da84

Anything else?

No response

Extend ENS support

Add support for parsing avatars and support for ENS Normalization using UTS-46

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.