Skip to content

Commit

Permalink
Merge pull request #213 from kaleido-io/ffcapi
Browse files Browse the repository at this point in the history
FFAPI implementation
  • Loading branch information
peterbroadhurst authored Apr 30, 2022
2 parents c4bafa3 + d20ab64 commit a2b26d6
Show file tree
Hide file tree
Showing 39 changed files with 3,429 additions and 163 deletions.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
{
"go.lintTool": "golangci-lint",
"cSpell.words": [
"ABIID",
"Debugf",
"ffcapi",
"ffcmocks",
"fftypes",
"hashicorp",
"Infof",
"kvstore",
"smconf",
"stretchr",
"Tracef",
"Unconfigured",
"Warnf"
]
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN go get github.com/kaleido-io/ethbinding
RUN go mod download
ADD . .
RUN cp go.mod.new go.mod
RUN make clean all
RUN make clean deps build

FROM debian:buster-slim
WORKDIR /ethconnect
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ endef
$(eval $(call makemock, internal/contractregistry, ContractStore, contractregistrymocks))
$(eval $(call makemock, internal/contractregistry, RemoteRegistry, contractregistrymocks))
$(eval $(call makemock, internal/eth, RPCClient, ethmocks))
$(eval $(call makemock, internal/ffc, FFCServer, ffcmocks))
$(eval $(call makemock, $$(SARAMA_PATH), Client, saramamocks))
$(eval $(call makemock, $$(SARAMA_PATH), ConsumerGroup, saramamocks))
$(eval $(call makemock, $$(SARAMA_PATH), ConsumerGroupSession, saramamocks))
Expand Down
71 changes: 38 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,44 @@
# github.com/hyperledger/firefly-ethconnect

[![codecov](https://codecov.io/gh/hyperledger/firefly-ethconnect/branch/master/graph/badge.svg?token=RWlSbY389z)](https://codecov.io/gh/hyperledger/firefly-ethconnect) [![Go Report Card](https://goreportcard.com/badge/github.com/hyperledger/firefly-ethconnect)](https://goreportcard.com/report/github.com/hyperledger/firefly-ethconnect)

- [github.com/hyperledger/firefly-ethconnect](#githubcomhyperledgerfirefly-ethconnect)
- [Ethconnect REST Gateway](#ethconnect-rest-gateway)
- [License](#license)
- [Example payloads](#example-payloads)
- [YAML to submit a transaction](#yaml-to-submit-a-transaction)
- [YAML to deploy a contract](#yaml-to-deploy-a-contract)
- [Why put a Web / Messaging API in front of an Ethereum node?](#why-put-a-web--messaging-api-in-front-of-an-ethereum-node)
- [Why Messaging?](#why-messaging)
- [The asynchronous nature of Ethereum transactions](#the-asynchronous-nature-of-ethereum-transactions)
- [Ethereum Webhooks and the REST Receipt Store (MongoDB)](#ethereum-webhooks-and-the-rest-receipt-store-mongodb)
- [Nonce management for Scale and Message Ordering](#nonce-management-for-scale-and-message-ordering)
- [Why Kafka?](#why-kafka)
- [Topics](#topics)
- [Messages](#messages)
- [Example transaction receipt](#example-transaction-receipt)
- [Example error](#example-error)
- [Running the Bridge](#running-the-bridge)
- [Installation](#installation)
- [Development environment](#development-environment)
- [Ways to run](#ways-to-run)
- [Running the Kafka->Ethereum bridge via cmdline params](#running-the-kafka-ethereum-bridge-via-cmdline-params)
- [Running the Webhooks->Kafka bridge via cmdline params](#running-the-webhooks-kafka-bridge-via-cmdline-params)
- [Example server YAML definition](#example-server-yaml-definition)
- [Tuning](#tuning)
- [Maximum messages to hold in-flight (maxinflight)](#maximum-messages-to-hold-in-flight-maxinflight)
- [Maximum wait time for an individual transaction (tx-timeout)](#maximum-wait-time-for-an-individual-transaction-tx-timeout)

## Ethconnect REST Gateway
[![codecov](https://codecov.io/gh/hyperledger/firefly-ethconnect/branch/main/graph/badge.svg?token=nO6ihSAzpV)](https://codecov.io/gh/hyperledger/firefly-ethconnect) [![Go Report Card](https://goreportcard.com/badge/github.com/hyperledger/firefly-ethconnect)](https://goreportcard.com/report/github.com/hyperledger/firefly-ethconnect)

## EthConnect - Hyperledger FireFly connector for Ethereum networks

This repo has evolved and now contains two related components of the Hyperledger FireFly
ecosystem.

## 1) FireFly EthConnect FFCAPI Connector - for public networks

See [FireFly architecture for public chains](https://hyperledger.github.io/firefly/overview/public_vs_permissioned.html#firefly-architecture-for-public-chains) in the Hyperledger FireFly
documentation for details on how the requirements for transaction
management in public chains (confirmations, gas management, policy-based
transaction re-submission) are managed.

In this architecture, the policy engine of
[FireFly Transaction Manager](https://github.com/hyperledger/firefly-transaction-manager) works in tandem with FireFly Core to form a sophisticated "brain" for managing
transactions through from submission to eventual mining (whether that
takes seconds, hours or days).

The connectors themselves are highly pluggable, and easy to build for a new
blockchain ecosystem. The first reference implementation of the FireFly Connector API (FFCAPI)
is provided in this repo:

- See the [internal/ffc](./internal/ffc) folder for that implementation

> A separate trimmed-down repository containing just a reference FFCAPI connector
> for EVM-based blockchain networks is a roadmap item for the Hyperledger FireFly community.
> Related to this is the [hyperledger/firefly-signer](https://github.com/hyperledger/firefly-signer)
> repo, which contains RLP encoding, and signing utility functions (Apache 2.0 licensed).
## 2) FireFly EthConnect REST Gateway - for permissioned chains

Since creation in 2018 a large amount of function has evolved through
use in production projects. Primarily this function has been driven by
private sidechains, using Quorum, Hyperledger Besu and Go-Ethereum with
finality friendly high-throughput consensus algorithms such as
IBFT and QBFT (and RAFT for latency optimized projects).

A Web and Messaging API, taking the hassle out of submitting Ethereum transactions:
- REST API generation for any ABI
- Reliable event streaming
- Reliable event streaming - using Apache Kafka
- High throughput tx submission
- Concurrency management
- Nonce management
Expand Down
24 changes: 14 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,44 +1,48 @@
module github.com/hyperledger/firefly-ethconnect

require (
github.com/Masterminds/semver v1.5.0
github.com/Shopify/sarama v1.32.0
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
github.com/bketelsen/crypt v0.0.4 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.1.3 // indirect
github.com/dsnet/compress v0.0.1 // indirect
github.com/ethereum/go-ethereum v1.10.17
github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8
github.com/go-openapi/jsonreference v0.19.6
github.com/go-openapi/spec v0.20.4
github.com/go-openapi/jsonreference v0.20.0
github.com/go-openapi/spec v0.20.5
github.com/go-openapi/swag v0.21.1 // indirect
github.com/gorilla/websocket v1.5.0
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d
github.com/hyperledger/firefly v1.0.0-rc.4.0.20220420070806-f5b009100566
github.com/hyperledger/firefly-transaction-manager v0.0.0-20220427021621-501ab78134f1
github.com/icza/dyno v0.0.0-20210726202311-f1bafe5d9996
github.com/julienschmidt/httprouter v1.3.0
github.com/kaleido-io/ethbinding v0.0.0-20220104211806-1a198c06124a
github.com/kaleido-io/ethbinding v0.0.0-20220405144420-999853435d9e
github.com/klauspost/compress v1.15.1 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/mholt/archiver v3.1.1+incompatible
github.com/microcosm-cc/bluemonday v1.0.18 // indirect
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d
github.com/nwaples/rardecode v1.1.3 // indirect
github.com/oklog/ulid/v2 v2.0.2
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.4.0
github.com/spf13/viper v1.8.1 // indirect
github.com/stretchr/testify v1.7.0
github.com/spf13/viper v1.11.0 // indirect
github.com/stretchr/testify v1.7.1
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/tidwall/gjson v1.14.0
github.com/tidwall/gjson v1.14.1
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/ulikunitz/xz v0.5.10 // indirect
github.com/x-cray/logrus-prefixed-formatter v0.5.2
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29 // indirect
golang.org/x/net v0.0.0-20220403103023-749bd193bc2b // indirect
golang.org/x/sys v0.0.0-20220403205710-6acee93ad0eb // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/net v0.0.0-20220418201149-a630d4f3e7a2 // indirect
golang.org/x/term v0.0.0-20220411215600-e5f449aeb171 // indirect
gopkg.in/yaml.v2 v2.4.0
)

Expand Down
Loading

0 comments on commit a2b26d6

Please sign in to comment.