Skip to content

Commit c827d0e

Browse files
authored
Merge pull request #1636 from SundaeSwap-finance/cardano
Added cardano connector plugin
2 parents bbbe443 + a008d52 commit c827d0e

File tree

21 files changed

+3740
-22
lines changed

21 files changed

+3740
-22
lines changed

doc-site/docs/reference/config.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,82 @@ title: Configuration Reference
636636
|name|The name of the configured Blockchain plugin|`string`|`<nil>`
637637
|type|The type of the configured Blockchain Connector plugin|`string`|`<nil>`
638638

639+
## plugins.blockchain[].cardano.cardanoconnect
640+
641+
|Key|Description|Type|Default Value|
642+
|---|-----------|----|-------------|
643+
|batchSize|The number of events Cardanoconnect should batch together for delivery to FireFly core. Only applies when automatically creating a new event stream|`int`|`50`
644+
|batchTimeout|How long Cardanoconnect should wait for new events to arrive and fill a batch, before sending the batch to FireFly core. Only applies when automatically creating a new event stream|[`time.Duration`](https://pkg.go.dev/time#Duration)|`500`
645+
|connectionTimeout|The maximum amount of time that a connection is allowed to remain with no data transmitted|[`time.Duration`](https://pkg.go.dev/time#Duration)|`30s`
646+
|expectContinueTimeout|See [ExpectContinueTimeout in the Go docs](https://pkg.go.dev/net/http#Transport)|[`time.Duration`](https://pkg.go.dev/time#Duration)|`1s`
647+
|headers|Adds custom headers to HTTP requests|`map[string]string`|`<nil>`
648+
|idleTimeout|The max duration to hold a HTTP keepalive connection between calls|[`time.Duration`](https://pkg.go.dev/time#Duration)|`475ms`
649+
|maxConnsPerHost|The max number of connections, per unique hostname. Zero means no limit|`int`|`0`
650+
|maxIdleConns|The max number of idle connections to hold pooled|`int`|`100`
651+
|maxIdleConnsPerHost|The max number of idle connections, per unique hostname. Zero means net/http uses the default of only 2.|`int`|`100`
652+
|passthroughHeadersEnabled|Enable passing through the set of allowed HTTP request headers|`boolean`|`false`
653+
|requestTimeout|The maximum amount of time that a request is allowed to remain open|[`time.Duration`](https://pkg.go.dev/time#Duration)|`30s`
654+
|tlsHandshakeTimeout|The maximum amount of time to wait for a successful TLS handshake|[`time.Duration`](https://pkg.go.dev/time#Duration)|`10s`
655+
|topic|The websocket listen topic that the node should register on, which is important if there are multiple nodes using a single cardanoconnect|`string`|`<nil>`
656+
|url|The URL of the Cardanoconnect instance|URL `string`|`<nil>`
657+
658+
## plugins.blockchain[].cardano.cardanoconnect.auth
659+
660+
|Key|Description|Type|Default Value|
661+
|---|-----------|----|-------------|
662+
|password|Password|`string`|`<nil>`
663+
|username|Username|`string`|`<nil>`
664+
665+
## plugins.blockchain[].cardano.cardanoconnect.proxy
666+
667+
|Key|Description|Type|Default Value|
668+
|---|-----------|----|-------------|
669+
|url|Optional HTTP proxy server to connect through|`string`|`<nil>`
670+
671+
## plugins.blockchain[].cardano.cardanoconnect.retry
672+
673+
|Key|Description|Type|Default Value|
674+
|---|-----------|----|-------------|
675+
|count|The maximum number of times to retry|`int`|`5`
676+
|enabled|Enables retries|`boolean`|`false`
677+
|errorStatusCodeRegex|The regex that the error response status code must match to trigger retry|`string`|`<nil>`
678+
|initWaitTime|The initial retry delay|[`time.Duration`](https://pkg.go.dev/time#Duration)|`250ms`
679+
|maxWaitTime|The maximum retry delay|[`time.Duration`](https://pkg.go.dev/time#Duration)|`30s`
680+
681+
## plugins.blockchain[].cardano.cardanoconnect.throttle
682+
683+
|Key|Description|Type|Default Value|
684+
|---|-----------|----|-------------|
685+
|burst|The maximum number of requests that can be made in a short period of time before the throttling kicks in.|`int`|`<nil>`
686+
|requestsPerSecond|The average rate at which requests are allowed to pass through over time.|`int`|`<nil>`
687+
688+
## plugins.blockchain[].cardano.cardanoconnect.tls
689+
690+
|Key|Description|Type|Default Value|
691+
|---|-----------|----|-------------|
692+
|ca|The TLS certificate authority in PEM format (this option is ignored if caFile is also set)|`string`|`<nil>`
693+
|caFile|The path to the CA file for TLS on this API|`string`|`<nil>`
694+
|cert|The TLS certificate in PEM format (this option is ignored if certFile is also set)|`string`|`<nil>`
695+
|certFile|The path to the certificate file for TLS on this API|`string`|`<nil>`
696+
|clientAuth|Enables or disables client auth for TLS on this API|`string`|`<nil>`
697+
|enabled|Enables or disables TLS on this API|`boolean`|`false`
698+
|insecureSkipHostVerify|When to true in unit test development environments to disable TLS verification. Use with extreme caution|`boolean`|`<nil>`
699+
|key|The TLS certificate key in PEM format (this option is ignored if keyFile is also set)|`string`|`<nil>`
700+
|keyFile|The path to the private key file for TLS on this API|`string`|`<nil>`
701+
|requiredDNAttributes|A set of required subject DN attributes. Each entry is a regular expression, and the subject certificate must have a matching attribute of the specified type (CN, C, O, OU, ST, L, STREET, POSTALCODE, SERIALNUMBER are valid attributes)|`map[string]string`|`<nil>`
702+
703+
## plugins.blockchain[].cardano.cardanoconnect.ws
704+
705+
|Key|Description|Type|Default Value|
706+
|---|-----------|----|-------------|
707+
|connectionTimeout|The amount of time to wait while establishing a connection (or auto-reconnection)|[`time.Duration`](https://pkg.go.dev/time#Duration)|`45s`
708+
|heartbeatInterval|The amount of time to wait between heartbeat signals on the WebSocket connection|[`time.Duration`](https://pkg.go.dev/time#Duration)|`30s`
709+
|initialConnectAttempts|The number of attempts FireFly will make to connect to the WebSocket when starting up, before failing|`int`|`5`
710+
|path|The WebSocket sever URL to which FireFly should connect|WebSocket URL `string`|`<nil>`
711+
|readBufferSize|The size in bytes of the read buffer for the WebSocket connection|[`BytesSize`](https://pkg.go.dev/github.com/docker/go-units#BytesSize)|`16Kb`
712+
|url|URL to use for WebSocket - overrides url one level up (in the HTTP config)|`string`|`<nil>`
713+
|writeBufferSize|The size in bytes of the write buffer for the WebSocket connection|[`BytesSize`](https://pkg.go.dev/github.com/docker/go-units#BytesSize)|`16Kb`
714+
639715
## plugins.blockchain[].ethereum.addressResolver
640716

641717
|Key|Description|Type|Default Value|

doc-site/docs/reference/types/verifier.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ title: Verifier
2222
| `hash` | Hash used as a globally consistent identifier for this namespace + type + value combination on every node in the network | `Bytes32` |
2323
| `identity` | The UUID of the parent identity that has claimed this verifier | [`UUID`](simpletypes.md#uuid) |
2424
| `namespace` | The namespace of the verifier | `string` |
25-
| `type` | The type of the verifier | `FFEnum`:<br/>`"ethereum_address"`<br/>`"tezos_address"`<br/>`"fabric_msp_id"`<br/>`"dx_peer_id"` |
25+
| `type` | The type of the verifier | `FFEnum`:<br/>`"cardano_address"`<br/>`"ethereum_address"`<br/>`"tezos_address"`<br/>`"fabric_msp_id"`<br/>`"dx_peer_id"` |
2626
| `value` | The verifier string, such as an Ethereum address, or Fabric MSP identifier | `string` |
2727
| `created` | The time this verifier was created on this node | [`FFTime`](simpletypes.md#fftime) |
2828

doc-site/docs/swagger/swagger.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10076,6 +10076,7 @@ paths:
1007610076
type:
1007710077
description: The type of the verifier
1007810078
enum:
10079+
- cardano_address
1007910080
- ethereum_address
1008010081
- tezos_address
1008110082
- fabric_msp_id
@@ -10818,6 +10819,7 @@ paths:
1081810819
type:
1081910820
description: The type of the verifier
1082010821
enum:
10822+
- cardano_address
1082110823
- ethereum_address
1082210824
- tezos_address
1082310825
- fabric_msp_id
@@ -24457,6 +24459,7 @@ paths:
2445724459
type:
2445824460
description: The type of the verifier
2445924461
enum:
24462+
- cardano_address
2446024463
- ethereum_address
2446124464
- tezos_address
2446224465
- fabric_msp_id
@@ -25234,6 +25237,7 @@ paths:
2523425237
type:
2523525238
description: The type of the verifier
2523625239
enum:
25240+
- cardano_address
2523725241
- ethereum_address
2523825242
- tezos_address
2523925243
- fabric_msp_id
@@ -28173,6 +28177,7 @@ paths:
2817328177
type:
2817428178
description: The type of the verifier
2817528179
enum:
28180+
- cardano_address
2817628181
- ethereum_address
2817728182
- tezos_address
2817828183
- fabric_msp_id
@@ -28315,6 +28320,7 @@ paths:
2831528320
type:
2831628321
description: The type of the verifier
2831728322
enum:
28323+
- cardano_address
2831828324
- ethereum_address
2831928325
- tezos_address
2832028326
- fabric_msp_id
@@ -30530,6 +30536,7 @@ paths:
3053030536
type:
3053130537
description: The type of the verifier
3053230538
enum:
30539+
- cardano_address
3053330540
- ethereum_address
3053430541
- tezos_address
3053530542
- fabric_msp_id
@@ -37503,6 +37510,7 @@ paths:
3750337510
type:
3750437511
description: The type of the verifier
3750537512
enum:
37513+
- cardano_address
3750637514
- ethereum_address
3750737515
- tezos_address
3750837516
- fabric_msp_id
@@ -37575,6 +37583,7 @@ paths:
3757537583
type:
3757637584
description: The type of the verifier
3757737585
enum:
37586+
- cardano_address
3757837587
- ethereum_address
3757937588
- tezos_address
3758037589
- fabric_msp_id
@@ -37617,6 +37626,7 @@ paths:
3761737626
type:
3761837627
description: The type of the verifier
3761937628
enum:
37629+
- cardano_address
3762037630
- ethereum_address
3762137631
- tezos_address
3762237632
- fabric_msp_id
@@ -37637,6 +37647,7 @@ paths:
3763737647
type:
3763837648
description: The type of the verifier
3763937649
enum:
37650+
- cardano_address
3764037651
- ethereum_address
3764137652
- tezos_address
3764237653
- fabric_msp_id
@@ -37976,6 +37987,7 @@ paths:
3797637987
type:
3797737988
description: The type of the verifier
3797837989
enum:
37990+
- cardano_address
3797937991
- ethereum_address
3798037992
- tezos_address
3798137993
- fabric_msp_id
@@ -38111,6 +38123,7 @@ paths:
3811138123
type:
3811238124
description: The type of the verifier
3811338125
enum:
38126+
- cardano_address
3811438127
- ethereum_address
3811538128
- tezos_address
3811638129
- fabric_msp_id
@@ -40228,6 +40241,7 @@ paths:
4022840241
type:
4022940242
description: The type of the verifier
4023040243
enum:
40244+
- cardano_address
4023140245
- ethereum_address
4023240246
- tezos_address
4023340247
- fabric_msp_id
@@ -46983,6 +46997,7 @@ paths:
4698346997
type:
4698446998
description: The type of the verifier
4698546999
enum:
47000+
- cardano_address
4698647001
- ethereum_address
4698747002
- tezos_address
4698847003
- fabric_msp_id
@@ -47048,6 +47063,7 @@ paths:
4704847063
type:
4704947064
description: The type of the verifier
4705047065
enum:
47066+
- cardano_address
4705147067
- ethereum_address
4705247068
- tezos_address
4705347069
- fabric_msp_id
@@ -47083,6 +47099,7 @@ paths:
4708347099
type:
4708447100
description: The type of the verifier
4708547101
enum:
47102+
- cardano_address
4708647103
- ethereum_address
4708747104
- tezos_address
4708847105
- fabric_msp_id
@@ -47103,6 +47120,7 @@ paths:
4710347120
type:
4710447121
description: The type of the verifier
4710547122
enum:
47123+
- cardano_address
4710647124
- ethereum_address
4710747125
- tezos_address
4710847126
- fabric_msp_id
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
title: Cardano
3+
---
4+
5+
This guide will walk you through the steps to create a local FireFly development environment running against the preview node.
6+
7+
## Previous steps: Install the FireFly CLI
8+
9+
If you haven't set up the FireFly CLI already, please go back to the Getting Started guide and read the section on how to [Install the FireFly CLI](../../gettingstarted/firefly_cli.md).
10+
11+
[← ① Install the FireFly CLI](../../gettingstarted/firefly_cli.md){: .md-button .md-button--primary}
12+
13+
## Create the stack
14+
15+
A Cardano stack can be run in two different ways; using a local Cardano node, or a remote Blockfrost address.
16+
17+
### Option 1: Use a local Cardano node
18+
19+
> **NOTE**: The cardano-node communicates over a Unix socket, so this will not work on Windows.
20+
21+
Start a local Cardano node. The fastest way to do this is to [use mithril](https://mithril.network/doc/manual/getting-started/bootstrap-cardano-node/) to bootstrap the node.
22+
23+
For an example of how to bootstrap and run the Cardano node in Docker, see [the firefly-cardano repo](https://github.com/hyperledger/firefly-cardano/blob/1be3b08d301d6d6eeb5b79e40cf3dbf66181c3de/infra/docker-compose.node.yaml#L4).
24+
25+
The cardano-node exposes a Unix socket named `node.socket`. Pass that to firefly-cli. The example below uses `firefly-cli` to
26+
- Create a new Cardano-based stack named `dev`.
27+
- Connect to the local Cardano node, which is running in the [preview network](https://preview.cexplorer.io/).
28+
29+
```sh
30+
ff init cardano dev \
31+
--network preview \
32+
--socket /path/to/ipc/node.socket
33+
```
34+
35+
### Option 2: Use Blockfrost
36+
37+
The Cardano connector can also use the [paid Blockfrost API](https://blockfrost.io/) in place of a local Cardano node.
38+
39+
The example below uses firefly-cli to
40+
- Create a new Cardano-based stack named `dev`
41+
- Use the given blockfrost key for the preview network.
42+
43+
```sh
44+
ff init cardano dev \
45+
--network preview \
46+
--blockfrost-key previewXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
47+
```
48+
49+
## Start the stack
50+
51+
Now you should be able to start your stack by running:
52+
53+
```sh
54+
ff start dev
55+
```
56+
57+
After some time it should print out the following:
58+
59+
```
60+
Web UI for member '0': http://127.0.0.1:5000/ui
61+
Sandbox UI for member '0': http://127.0.0.1:5109
62+
63+
64+
To see logs for your stack run:
65+
66+
ff logs dev
67+
```
68+
69+
## Get some ADA
70+
71+
Now that you have a stack, you need some seed funds to get started. Your stack was created with a wallet already (these are free to create in Cardano). To get the address, you can run
72+
```sh
73+
ff accounts list dev
74+
```
75+
76+
The response will look like
77+
```json
78+
[
79+
{
80+
"address": "addr_test1...",
81+
"privateKey": "..."
82+
}
83+
]
84+
```
85+
86+
If you're developing against a testnet such as preview, you can receive funds from the [testnet faucet](https://docs.cardano.org/cardano-testnets/tools/faucet). Pass the `address` from that response to the faucet.

0 commit comments

Comments
 (0)