Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions docs/faqs/faqs.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ has_children: true

Find answers to the most commonly asked FireFly questions.

This content is coming soon and will be guided by community interactions via Discord, meetups, webinars and other technical forums.
## How does FireFly enable multi-chain applications?
It's best to think about FireFly as a rich orchestration layer that sits one layer above the blockchain. FireFly helps to abstract away much of the complex blockchain functionality (such as data exchange, private messaging, common token functionality, etc) in a loosely coupled microservice architecture with highly pluggable components. This enables application developers to focus on building innovative Web3 applications.

If you have immediate questions please don't hesitate to reach out to us on the [Hyperledger Discord](https://discord.gg/hyperledger) in the `#firefly` channel.
There aren't any out of the box bridges to connect two separate chains together, but with a collection of FireFly instances across a consortium, FireFly could help listen for events on Blockchain A and take an action on Blockchain B when certain conditions are met.

## 📜 How do I deploy smart contracts?
In order to interact with a smart contract on a public or private Ethereum chain you need to first deploy it to the chain. Deployment means that you've sent a transaction with the compiled source code to the chain without a specified recipient and received a contract address that you and others on the network can use to interact with your contract.

Refer to the [Smart Contract Tutorial](../tutorials/custom_contracts/) for instructions to deploy a smart contract to your private networking using FireFly.

## 🦊 Can I connect FireFly to MetaMask?
Yes! Before you set up MetaMask you'll likely want to create some tokens that you can use to send between wallets on your FF network. Go to the tokens tab in your FireFly node's UI, create a token pool, and then mint some tokens. Once you've done this, follow the steps listed [here](https://hyperledger.github.io/firefly/tutorials/tokens/erc721.html#use-metamask) to set up MetaMask on your network.

## 🚀 Connect with us on Discord
If your question isn't answered here or if you have immediate questions please don't hesitate to reach out to us on [Discord](https://discord.gg/hyperledger_) in the `firefly` channel:
Binary file added docs/images/define_a_datatype.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/message_broadcast_initial.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/message_private_broadcast.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/images/message_view.png
Binary file not shown.
Binary file added docs/images/new_message_view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/swagger/swagger.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ has_children: false

This is the FireFly OpenAPI Specification document generated by FireFly

Note: The 'Try it out' buttons will not work on this page, because it's not running against a live version of FireFly. To actually try it out, we recommend using the [FireFly CLI](https://github.com/hyperledger/firefly-cli) to start an instance on your local machine, then have a look at the API spec there.
**Note**: The 'Try it out' buttons will not work on this page because it's not running against a live version of FireFly. To actually try it out, we recommend using the [FireFly CLI](https://github.com/hyperledger/firefly-cli) to start an instance on your local machine (which will start the FireFly core on port 5000 by default) and then open the Swagger UI associated with your local node by opening a new tab and visiting [http://localhost:5000/api](http://localhost:5000/api)

<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@3/swagger-ui.css">

Expand Down
69 changes: 53 additions & 16 deletions docs/tutorials/broadcast_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ nav_order: 4
## Additional info

- Key Concepts: [Broadcast / shared data](../overview/broadcast.md)
- Swagger: <a href="../swagger/swagger.html#/Default%20Namespace/postNewMessageBroadcast" data-proofer-ignore>POST /api/v1/namespaces/{ns}/messages/broadcast]</a>
- Swagger Reference: <a href="../swagger/swagger.html#/Default%20Namespace/postNewMessageBroadcast" data-proofer-ignore>POST /api/v1/namespaces/{ns}/messages/broadcast</a>

## Example 1: Inline string data

`POST` `/api/v1/namespaces/default/broadcast/message`
`POST` `/api/v1/namespaces/default/messages/broadcast`

```json
{
Expand All @@ -52,12 +52,6 @@ nav_order: 4

## Example message response

Status: `202 Accepted` - the message is on it's way, but has not yet been confirmed.

> _Issue [#112](https://github.com/hyperledger/firefly/issues/112) proposes adding
> an option to wait for the message to be confirmed by the blockchain before returning,
> with `200 OK`._

```json
{
"header": {
Expand Down Expand Up @@ -96,7 +90,7 @@ It is very good practice to set a `tag` and `topic` in each of your messages:
information you are publishing. It is used as an ordering context, so all
broadcasts on a given topic are assured to be processed in order.

`POST` `/api/v1/namespaces/default/broadcast/message`
`POST` `/api/v1/namespaces/default/messages/broadcast`

```json
{
Expand All @@ -114,21 +108,45 @@ It is very good practice to set a `tag` and `topic` in each of your messages:
]
}
```
## Notes on why setting a topic is important

The FireFly aggregator uses the `topic` (obfuscated on chain) to determine if a
message is the next message in an in-flight sequence for any groups the node is
involved in. If it is, then that message must receive all off-chain private data
and be confirmed before any subsequent messages can be confirmed on the same sequence.

So if you use the same topic in every message, then a single failed send on one
topic blocks delivery of all messages between those parties, until the missing
data arrives.

Instead it is best practice to set the topic on your messages to a value
that identifies an ordered stream of business processing. Some examples:

- A long-running business process instance identifier assigned at initiation
- A real-world business transaction identifier used off-chain
- The agreed identifier of an asset you are attaching a stream of evidence to
- An NFT identifier that is assigned to an asset (digital twin scenarios)
- An agreed primary key for a data resource being reconciled between multiple parties

The `topic` field is an array, because there are cases (such as merging two identifiers)
where you need a message to be deterministically ordered across multiple sequences.
However, this is an advanced use case and you are likely to set a single topic
on the vast majority of your messages.

## Example 3: Upload a blob with metadata and broadcast

Here we make two API calls.

1. Create the `data` object explicitly, using a multi-party form upload
1) Create the `data` object explicitly, using a multi-party form upload

- You can also just post JSON to this endpoint
- You can also just post JSON to this endpoint

2. Broadcast a message referring to that data
2) Broadcast a message referring to that data

- The Blob attachment gets published to shared storage
- This happens the first time a broadcast happens on a data attachment
- A pin goes to the blockchain
- The metadata goes into a batch with the message
- The Blob attachment gets published to shared storage
- This happens the first time a broadcast happens on a data attachment
- A pin goes to the blockchain
- The metadata goes into a batch with the message

### Multipart form post of a file

Expand Down Expand Up @@ -191,3 +209,22 @@ Just include a reference to the `id` returned from the upload.
]
}
```

## Broadcasting Messages using the Sandbox
All of the functionality discussed above can be done through the [FireFly Sandbox](../gettingstarted/sandbox.md).

To get started, open up the Web UI and Sanbox UI for at least one of your members. The URLs for these were printed in your terminal when you started your FireFly stack.

In the sandbox, enter your message into the message field as seen in the screenshot below.

![Initial Broadcast Message](../images/message_broadcast_initial.png)

Notice how the `data` field in the center panel updates in real time.

Click the blue `Run` button. This should return a `202` response immediately in the Server Response section and will populate the right hand panel with transaction information after a few seconds.

![Broadcast Result](../images/message_broadcast_sample_result.png)

Go back to the FireFly UI (the URL for this would have been shown in the terminal when you started the stack) and you'll see your successful blockchain transaction

![Successful Broadcast Transaction](../images/firefly_first_successful_transaction.png)
45 changes: 41 additions & 4 deletions docs/tutorials/define_datatype.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ Status: `202 Accepted` - a broadcast message has been sent, and on confirmation
datatype will be created (unless it conflicts with another definition with the same
`name` and `version` that was ordered onto the blockchain before this definition).

> _Issue [#112](https://github.com/hyperledger/firefly/issues/112) proposes adding
> an option to wait for the message to be confirmed by the blockchain before returning,
> with `200 OK`._

```json
{
"header": {
Expand Down Expand Up @@ -169,3 +165,44 @@ time if it does not conform. On other nodes, bad data results in a `message_reje
]
}
```
## Defining Datatypes using the Sandbox
You can also define a datatype through the [FireFly Sandbox](../gettingstarted/sandbox.md).

To get started, open up the Web UI and Sanbox UI for at least one of your members. The URLs for these were printed in your terminal when you started your FireFly stack.

In the sandbox, enter the datatype's name, version, and JSON Schema as seen in the screenshot below.

```json
{
"name": "widget",
"version": "0.0.2",
"value": {
"$id": "https://example.com/widget.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Widget",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The unique identifier for the widget."
},
"name": {
"type": "string",
"description": "The person's last name."
}
}
}
}
```

![Defining a Datatype](../images/define_a_datatype.png)

Notice how the `data` field in the center panel updates in real time.

Click the blue `Run` button. This should return a `202` response immediately in the Server Response section and will populate the right hand panel with transaction information after a few seconds.

![Message Broadcast](../images/message_broadcast_sample_result.png)

Go back to the FireFly UI (the URL for this would have been shown in the terminal when you started the stack) and you'll see that you've successfully defined your datatype

![Successful Transaction](../images/firefly_first_successful_transaction.png)
2 changes: 0 additions & 2 deletions docs/tutorials/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ has_children: true
---

# Tutorials


37 changes: 25 additions & 12 deletions docs/tutorials/private_send.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ nav_order: 4

## Example 1: Pinned private send of in-line string data

`POST` `/api/v1/namespaces/default/send/message`
`POST` `/api/v1/namespaces/default/messages/private`

```json
{
Expand All @@ -76,10 +76,6 @@ nav_order: 4

Status: `202 Accepted` - the message is on it's way, but has not yet been confirmed.

> _Issue [#112](https://github.com/hyperledger/firefly/issues/112) proposes adding
> an option to wait for the message to be confirmed by the blockchain before returning,
> with `200 OK`._

```json
{
"header": {
Expand Down Expand Up @@ -116,7 +112,7 @@ Status: `202 Accepted` - the message is on it's way, but has not yet been confir
Set `header.txtype: "none"` to disable pinning of the private message send to the blockchain.
The message is sent immediately (no batching) over the private data exchange.

`POST` `/api/v1/namespaces/default/send/message`
`POST` `/api/v1/namespaces/default/messages/private`

```json
{
Expand Down Expand Up @@ -149,7 +145,7 @@ It is very good practice to set a `tag` and `topic` in each of your messages:
information you are publishing. It is used as an ordering context, so all
sends on a given topic are assured to be processed in order.

`POST` `/api/v1/namespaces/default/send/message`
`POST` `/api/v1/namespaces/default/messages/private`

```json
{
Expand Down Expand Up @@ -204,12 +200,10 @@ on the vast majority of your messages.

Here we make two API calls.

1. Create the `data` object explicitly, using a multi-party form upload

1) Create the `data` object explicitly, using a multi-party form upload
- You can also just post JSON to this endpoint

2. Privately send a message referring to that data

2) Privately send a message referring to that data
- The Blob is sent privately to each party
- A pin goes to the blockchain
- The metadata goes into a batch with the message
Expand Down Expand Up @@ -259,7 +253,7 @@ At this point the data has not be shared with anyone else in the network

Just include a reference to the `id` returned from the upload.

`POST` `/api/v1/namespaces/default/send/message`
`POST` `/api/v1/namespaces/default/messages/private`

```json
{
Expand All @@ -277,3 +271,22 @@ Just include a reference to the `id` returned from the upload.
}
}
```

## Sending Private Messages using the Sandbox
All of the functionality discussed above can be done through the [FireFly Sandbox](../gettingstarted/sandbox.md).

To get started, open up the Web UI and Sanbox UI for at least one of your members. The URLs for these were printed in your terminal when you started your FireFly stack.

Make sure to expand the "Send a Private Message" section. Enter your message into the message field as seen in the screenshot below. Because we are sending a private message, make sure you're in the "Send a Private Message" section and that you choose a message recipient

![Private Message Broadcast](../images/message_private_broadcast.png)

Notice how the `data` field in the center panel updates in real time as you update the message you wish to send.

Click the blue `Run` button. This should return a `202` response immediately in the Server Response section and will populate the right hand panel with transaction information after a few seconds.

![Private Message result](../images/message_broadcast_sample_result.png)

Go back to the FireFly UI (the URL for this would have been shown in the terminal when you started the stack) and you'll see your successful blockchain transaction. Compare the "Recent Network Changes" widget With private messages, your

![Successful Transaction](../images/firefly_first_successful_transaction.png)
2 changes: 1 addition & 1 deletion docs/tutorials/query_messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The FireFly Explorer is a great way to view the messages sent and received by yo

Just open `/ui` on your FireFly node to access it.

![Explore Messages](../images/message_view.png)
![Explore Messages](../images/new_message_view.png)

This builds on the APIs to query and filter messages, described below

Expand Down