Signing, Keystore and RLP encoding utilities for EVM / Ethereum / secp256k1 based blockchains

codecov Go Reference

Hyperledger FireFly Signer

A set of Ethereum transaction signing utilities designed for use across projects:

  • RLP Encoding and Decoding
  • Secp256k1 transaction signing for Ethereum transactions
    • Original
    • EIP-155
    • EIP-1559
  • Keystore V3 wallet implementation
    • Scrypt - read/write
    • pbkdf2 - read

A runtime JSON/RPC server/proxy to intercept eth_sendTransaction JSON/RPC calls

  • Lightweight fast-starting runtime
  • HTTP/HTTPS server
    • All HTTPS/CORS etc. features from FireFly Microservice framework
    • Configured via YAML
  • eth_sendTransaction implementation to sign transactions
    • If EIP-1559 gas price fields are specified uses 0x02 transactions, otherwise EIP-155
  • Makes some JSON/RPC calls on application's behalf
    • Queries Chain ID via net_version on startup
    • eth_account support
    • Trivial nonce management built-in (calls eth_getTransactionCount for each request)
  • File based wallet
    • Configurable caching for in-memory keys
    • Files in directory with a given extension matching {{ADDRESS}}.key/{{ADDRESS}}.toml
    • Customizable extension, and optional 0x prefix to filename
    • Files can be TOML/YAML/JSON metadata pointing to Keystore V3 files + password files
    • Files can be Keystore V3 files directly, with accompanying {{ADDRESS}}.pass files

Potential future contributions:

  • WebSockets support
  • Tessera private transaction signing for Quorum / Hyperledger Besu
  • Loading keys on startup
  • Caching list of keys in-memory
  • Regular expression to match address anywhere in filename (depends on caching list of keys)

Configuration

For a full list of configuration options see config.md

Example configuration

Two examples provided below:

Flat directory of keys

fileWallet:
    path: /data/keystore
    filenames:
        with0xPrefix: false
        primaryExt: '.key.json'
        passwordExt: '.password'
server:
    address: '127.0.0.1'
    port: 8545
backend:
    url: https://blockhain.rpc.endpoint/path

Directory containing TOML configurations

fileWallet:
    path: /data/keystore
    filenames:
        with0xPrefix: false
        primaryExt: '.toml'
  metadata:
        format: toml
        keyFileProperty: '{{ index .signing "key-file" }}'
        passwordFileProperty: '{{ index .signing "password-file" }}'
server:
    address: '127.0.0.1'
    port: 8545
backend:
    url: https://blockhain.rpc.endpoint/path

Example TOML:

[metadata]
description = "File based configuration"

[signing]
type = "file-based-signer"
key-file = "/data/keystore/1f185718734552d08278aa70f804580bab5fd2b4.key.json"
password-file = "/data/keystore/1f185718734552d08278aa70f804580bab5fd2b4.pwd"

License

Apache 2.0

References / credits

JSON/RPC proxy

The JSON/RPC proxy code was contributed by Kaleido, Inc.

Cryptography

secp256k1 cryptography libraries are provided by btcsuite (ISC Licensed):

https://pkg.go.dev/github.com/btcsuite/btcd/btcec

RLP encoding and keystore

Reference during implementation was made to the web3j implementation of Ethereum RLP encoding, and Keystore V3 wallet files (Apache 2.0 licensed):

https://github.com/web3j/web3j

Similar Resources

Moeing chain is an EVM&Web3 compatible sidechain for Bitcoin Cash

Full node client of smartBCH This repository contains the code of the full node client of smartBCH, an EVM&Web3 compatible sidechain for Bitcoin Cash.

May 9, 2022

EVM frontrunning tool

CAKE SNIPER FRONTRUNNING BOT =================================================== BEFORE STARTING: This bot require you to run the GETH client + use

May 16, 2022

An easy tool to apply transactions to the current EVM state. Optimized for MEV.

sibyl A more embedded version of fxfactorial/run-evm-code. This tool makes it easy to apply transactions to the current EVM state. Call it a transacti

May 8, 2022

Go-chain - EVM-compatible chain secured by the Lachesis consensus algorithm

ICICB galaxy EVM-compatible chain secured by the Lachesis consensus algorithm. B

Apr 20, 2022

A blockchains platform with high throughput, and blazing fast transactions

A blockchains platform with high throughput, and blazing fast transactions

Node implementation for the Avalanche network - a blockchains platform with high throughput, and blazing fast transactions. Installation Avalanche is

Oct 31, 2021

A naive and simple implementation of blockchains.

naivechain A naive and simple implementation of blockchains. Build And Run Download and compile go get -v github.com/kofj/naivechain Start First Node

May 8, 2022

Dijetsnetgo: a blockchains platform with high throughput, and blazing fast transactions

Dijetsnetgo: a blockchains platform with high throughput, and blazing fast transactions

Node implementation for the Avalanche network - a blockchains platform with high

Jan 18, 2022

Avalanche: a network composed of multiple blockchains

Coreth and the C-Chain Avalanche is a network composed of multiple blockchains.

May 7, 2022
Comments
  • Move to firefly-common dependency, and add config docs

    Move to firefly-common dependency, and add config docs

    • Moves over all dependences to firefly-common that are now there
    • Adds config.md auto-generation and link from README.md

    Depends on (go.mod pulls these in directly):

    • https://github.com/hyperledger/firefly-common/pull/4
  • Initial contribution from Kaleido

    Initial contribution from Kaleido

    See the README.md in the change for information.

    Leaving in draft for now as there are some additional parts of the initial contribution pending:

    • [x] README detailing references / credits
    • [x] secp256k1 cryptography wrapper (ISC License)
    • [x] Keystore V3 implementation (Scrypt + pbkdf2 derived keys, with AES/128/CTR encryption)
    • [x] RLP encoding / decoding
    • [x] Ethereum Transaction Encoding/Signing
      • [x] Original
      • [x] EIP-155
      • [x] EIP-1559
    • [x] Contribution of an existing JSON/RPC server framework for eth_sendTransaction based signing
      • [x] Configuration and logging in FireFly Microservice framework
      • [x] HTTPS JSON/RPC server
      • [x] eth_sendTransaction intercept
      • [x] Simple eth_getTransactionCount support for missing Nonce
      • [x] Address lookup to Keystore V3 file
      • [x] Batch JSON/RPC support
  • ABI encoder and decoder

    ABI encoder and decoder

    • [x] JSON parser for ABI defintion
    • [x] Modeling and verification for of all elemental types, arrays, and tuple types
      • [x] int<M>
      • [x] uint<M>
      • [x] address
      • [x] bool
      • [x] fixed<M>x<N>
      • [x] ufixed<M>x<N>
      • [x] bytes / bytes<M>
      • [x] function
      • [x] string
      • [x] tuple
      • [x] fixed arrays T[k]
      • [x] variable arrays T[]
      • [x] API access to parsed type tree for features such as Swagger/OpenAPI generation
    • [x] External input data mapping to ABI structure
      • [x] JSON types
      • [x] Go types
      • [x] Object style {"arg1": 123} input for function parameters/nested-tuples
      • [x] Array style [123] input for function parameters/nested-tuples
      • [x] API access to parsed value tree, mapped against type tree
    • [x] ABI data encoding / serialization
      • [x] Unit tests for all examples in https://docs.soliditylang.org/en/v0.8.13/abi-spec.html
    • [ ] ABI data decoding / parsing
    • [ ] JSON data serialization from value tree
    • [ ] README updates
Ethereum-vanity-wallet - A fork of https://github.com/meehow/ethereum-vanity-wallet but the key can be exported to a JSON keystore file

ethereum-vanity-wallet See https://github.com/meehow/ethereum-vanity-wallet This version: doesn't display the private key let's you interactively expo

Jan 2, 2022
Jan 18, 2022
Ethereum go-ethereum - Official Golang implementation of the Ethereum protocol

Go Ethereum Official Golang implementation of the Ethereum protocol. Automated b

Feb 17, 2022
Simple, fast and safe cross-platform linear binary stream communication protocol. AES key exchange based on ecc secp256k1

FFAX Protocol 2 dev 简体中文 Welcome to FFAX Protocol v2 Quick start go get github.com/RealFax/FFAX func example() { listener, err := net.Listen("tcp",

Mar 21, 2022
Ekliptic - Primitives for cryptographic operations on the secp256k1 curve, with zero dependencies and excellent performance

Ekliptic This package provides primitives for cryptographic operations on the se

Feb 17, 2022
a Golang sdk for working with DeFi protocols, and ethereum compatible blockchains
a Golang sdk for working with DeFi protocols, and ethereum compatible blockchains

A golang sdk for working with DeFi protocols and general utilities for working with ethereum-compatible blockchains. packages bclient bindings cli con

May 2, 2022
Akroma GO client - Akroma is an EVM based application development platform (smart-contracts).

Akroma Akroma is an EVM based application development platform (smart-contracts). Akroma will utilize a Masternode system, and build out an Oracle pla

Apr 22, 2022
LEO (Low Ethereum Orbit) is an Ethereum Portal Network client.

LEO LEO (Low Ethereum Orbit) is an Ethereum Portal Network client. What makes LEO different from other Portal Network clients is that it uses libp2p f

Apr 19, 2022
Go-ethereum - Official Golang implementation of the Ethereum protocol

Go Ethereum Official Golang implementation of the Ethereum protocol. Automated b

Jan 4, 2022
This library aims to make it easier to interact with Ethereum through de Go programming language by adding a layer of abstraction through a new client on top of the go-ethereum library.

Simple ethereum client Simple ethereum client aims to make it easier for the developers to interact with Ethereum through a new layer of abstraction t

May 1, 2022