Skip to content

Commit b039fb3

Browse files
shorshertrevorsc19
andauthored
FAQ and FireFly Tutorial Updates (#857) (#889)
Signed-off-by: Alex Shorsher <[email protected]> Co-authored-by: trevorsc19 <[email protected]>
1 parent 257e850 commit b039fb3

14 files changed

+135
-38
lines changed

docs/faqs/faqs.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ has_children: true
99

1010
Find answers to the most commonly asked FireFly questions.
1111

12-
This content is coming soon and will be guided by community interactions via Discord, meetups, webinars and other technical forums.
12+
## How does FireFly enable multi-chain applications?
13+
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.
1314

14-
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.
15+
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.
16+
17+
## 📜 How do I deploy smart contracts?
18+
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.
19+
20+
Refer to the [Smart Contract Tutorial](../tutorials/custom_contracts/) for instructions to deploy a smart contract to your private networking using FireFly.
21+
22+
## 🦊 Can I connect FireFly to MetaMask?
23+
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.
24+
25+
## 🚀 Connect with us on Discord
26+
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:

docs/images/define_a_datatype.png

84.5 KB
Loading
342 KB
Loading
128 KB
Loading
289 KB
Loading
339 KB
Loading

docs/images/message_view.png

-68.9 KB
Binary file not shown.

docs/images/new_message_view.png

516 KB
Loading

docs/swagger/swagger.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ has_children: false
99

1010
This is the FireFly OpenAPI Specification document generated by FireFly
1111

12-
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.
12+
**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)
1313

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

docs/tutorials/broadcast_data.md

Lines changed: 53 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ nav_order: 4
3434
## Additional info
3535

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

3939
## Example 1: Inline string data
4040

41-
`POST` `/api/v1/namespaces/default/broadcast/message`
41+
`POST` `/api/v1/namespaces/default/messages/broadcast`
4242

4343
```json
4444
{
@@ -52,12 +52,6 @@ nav_order: 4
5252

5353
## Example message response
5454

55-
Status: `202 Accepted` - the message is on it's way, but has not yet been confirmed.
56-
57-
> _Issue [#112](https://github.com/hyperledger/firefly/issues/112) proposes adding
58-
> an option to wait for the message to be confirmed by the blockchain before returning,
59-
> with `200 OK`._
60-
6155
```json
6256
{
6357
"header": {
@@ -96,7 +90,7 @@ It is very good practice to set a `tag` and `topic` in each of your messages:
9690
information you are publishing. It is used as an ordering context, so all
9791
broadcasts on a given topic are assured to be processed in order.
9892

99-
`POST` `/api/v1/namespaces/default/broadcast/message`
93+
`POST` `/api/v1/namespaces/default/messages/broadcast`
10094

10195
```json
10296
{
@@ -114,21 +108,45 @@ It is very good practice to set a `tag` and `topic` in each of your messages:
114108
]
115109
}
116110
```
111+
## Notes on why setting a topic is important
112+
113+
The FireFly aggregator uses the `topic` (obfuscated on chain) to determine if a
114+
message is the next message in an in-flight sequence for any groups the node is
115+
involved in. If it is, then that message must receive all off-chain private data
116+
and be confirmed before any subsequent messages can be confirmed on the same sequence.
117+
118+
So if you use the same topic in every message, then a single failed send on one
119+
topic blocks delivery of all messages between those parties, until the missing
120+
data arrives.
121+
122+
Instead it is best practice to set the topic on your messages to a value
123+
that identifies an ordered stream of business processing. Some examples:
124+
125+
- A long-running business process instance identifier assigned at initiation
126+
- A real-world business transaction identifier used off-chain
127+
- The agreed identifier of an asset you are attaching a stream of evidence to
128+
- An NFT identifier that is assigned to an asset (digital twin scenarios)
129+
- An agreed primary key for a data resource being reconciled between multiple parties
130+
131+
The `topic` field is an array, because there are cases (such as merging two identifiers)
132+
where you need a message to be deterministically ordered across multiple sequences.
133+
However, this is an advanced use case and you are likely to set a single topic
134+
on the vast majority of your messages.
117135

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

120138
Here we make two API calls.
121139

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

124-
- You can also just post JSON to this endpoint
142+
- You can also just post JSON to this endpoint
125143

126-
2. Broadcast a message referring to that data
144+
2) Broadcast a message referring to that data
127145

128-
- The Blob attachment gets published to shared storage
129-
- This happens the first time a broadcast happens on a data attachment
130-
- A pin goes to the blockchain
131-
- The metadata goes into a batch with the message
146+
- The Blob attachment gets published to shared storage
147+
- This happens the first time a broadcast happens on a data attachment
148+
- A pin goes to the blockchain
149+
- The metadata goes into a batch with the message
132150

133151
### Multipart form post of a file
134152

@@ -191,3 +209,22 @@ Just include a reference to the `id` returned from the upload.
191209
]
192210
}
193211
```
212+
213+
## Broadcasting Messages using the Sandbox
214+
All of the functionality discussed above can be done through the [FireFly Sandbox](../gettingstarted/sandbox.md).
215+
216+
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.
217+
218+
In the sandbox, enter your message into the message field as seen in the screenshot below.
219+
220+
![Initial Broadcast Message](../images/message_broadcast_initial.png)
221+
222+
Notice how the `data` field in the center panel updates in real time.
223+
224+
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.
225+
226+
![Broadcast Result](../images/message_broadcast_sample_result.png)
227+
228+
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
229+
230+
![Successful Broadcast Transaction](../images/firefly_first_successful_transaction.png)

0 commit comments

Comments
 (0)