Git Product home page Git Product logo

bls-eth-swift's Introduction

GitHub Platform Swift support Swift Package Manager compatible

Note: this framework doesn't provide a way to derive Eth2 secret key (eip-2333). Please use your own implementation

bls-eth-swift

bls-eth-swift provides convenient way to integrate https://github.com/herumi/bls-eth-go-binary

Requirements

Good mood

Features

  • Easy to use
  • Precompiled sources
  • Safe to use with app extensions

Installation

Swift Package Manager

You can use Swift Package Manager and specify dependency in Package.swift by adding this:

.package(url: "https://github.com/MyEtherWallet/bls-eth-swift.git", .upToNextMajor(from: "1.0.0"))

XCFramework

XCFrameworks require Xcode 11 or later and they can be integrated similarly to how we’re used to integrating the .framework format. Please use a script bls_framework/build.sh to generate binary bls_framework.xcframework archive that you can use as a dependency in Xcode or you can use precompiled one.

bls_framework.xcframework is a Release (Optimized) binary that offer best available Swift code performance.

How to

import bls_framework
blsSecretKey
try BLSInterface.blsInit()

let serializedSecretKey = Data(hex: "455c0dc9fccb3395825d92a60d2672d69416be1c2578a87a7a3d3ced11ebb88d").bytes // [UInt8]

var secretKey = blsSecretKey.init()
blsSecretKeyDeserialize(&secretKey, &serializedSecretKey, numericCast(serializedSecretKey.count))
blsPublicKey
var publicKey = blsPublicKey.init()
blsGetPublicKey(&publicKey, &secretKey)
Eth2 Public Key
let PUBLIC_KEY_SIZE = 48
var publicKeyBytes = Data(count: PUBLIC_KEY_SIZE).bytes // [UInt8]
blsPublicKeySerialize(&publicKeyBytes, PUBLIC_KEY_SIZE, &publicKey)

return Data(publicKeyBytes)

Swift versions support

  • Swift 5.0 and newer, branch master

License

MIT

bls-eth-swift's People

Contributors

foboz avatar

Stargazers

 avatar

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.