diff --git a/docs/faqs/faqs.md b/docs/faqs/faqs.md index 536b2c22c2..179bcd04c9 100644 --- a/docs/faqs/faqs.md +++ b/docs/faqs/faqs.md @@ -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: \ No newline at end of file diff --git a/docs/images/define_a_datatype.png b/docs/images/define_a_datatype.png new file mode 100644 index 0000000000..f666146515 Binary files /dev/null and b/docs/images/define_a_datatype.png differ diff --git a/docs/images/firefly_first_successful_transaction.png b/docs/images/firefly_first_successful_transaction.png new file mode 100644 index 0000000000..4d59464558 Binary files /dev/null and b/docs/images/firefly_first_successful_transaction.png differ diff --git a/docs/images/message_broadcast_initial.png b/docs/images/message_broadcast_initial.png new file mode 100644 index 0000000000..12af9b1fbe Binary files /dev/null and b/docs/images/message_broadcast_initial.png differ diff --git a/docs/images/message_broadcast_sample_result.png b/docs/images/message_broadcast_sample_result.png new file mode 100644 index 0000000000..c7f6ca4661 Binary files /dev/null and b/docs/images/message_broadcast_sample_result.png differ diff --git a/docs/images/message_private_broadcast.png b/docs/images/message_private_broadcast.png new file mode 100644 index 0000000000..7655518af9 Binary files /dev/null and b/docs/images/message_private_broadcast.png differ diff --git a/docs/images/message_view.png b/docs/images/message_view.png deleted file mode 100644 index 67aa8af3bf..0000000000 Binary files a/docs/images/message_view.png and /dev/null differ diff --git a/docs/images/new_message_view.png b/docs/images/new_message_view.png new file mode 100644 index 0000000000..3d2b8b9282 Binary files /dev/null and b/docs/images/new_message_view.png differ diff --git a/docs/swagger/swagger.md b/docs/swagger/swagger.md index 12074d6b7f..890a16fe94 100644 --- a/docs/swagger/swagger.md +++ b/docs/swagger/swagger.md @@ -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) diff --git a/docs/tutorials/broadcast_data.md b/docs/tutorials/broadcast_data.md index ea8a617118..890859d71c 100644 --- a/docs/tutorials/broadcast_data.md +++ b/docs/tutorials/broadcast_data.md @@ -34,11 +34,11 @@ nav_order: 4 ## Additional info - Key Concepts: [Broadcast / shared data](../overview/broadcast.md) -- Swagger: POST /api/v1/namespaces/{ns}/messages/broadcast] +- Swagger Reference: POST /api/v1/namespaces/{ns}/messages/broadcast ## Example 1: Inline string data -`POST` `/api/v1/namespaces/default/broadcast/message` +`POST` `/api/v1/namespaces/default/messages/broadcast` ```json { @@ -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": { @@ -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 { @@ -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 @@ -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) diff --git a/docs/tutorials/define_datatype.md b/docs/tutorials/define_datatype.md index 12f559933b..4f429f7016 100644 --- a/docs/tutorials/define_datatype.md +++ b/docs/tutorials/define_datatype.md @@ -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": { @@ -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) \ No newline at end of file diff --git a/docs/tutorials/index.md b/docs/tutorials/index.md index d180a734dd..877f2dd071 100644 --- a/docs/tutorials/index.md +++ b/docs/tutorials/index.md @@ -6,5 +6,3 @@ has_children: true --- # Tutorials - - diff --git a/docs/tutorials/private_send.md b/docs/tutorials/private_send.md index 9f081d7d18..2e69fc2497 100644 --- a/docs/tutorials/private_send.md +++ b/docs/tutorials/private_send.md @@ -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 { @@ -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": { @@ -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 { @@ -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 { @@ -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 @@ -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 { @@ -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) \ No newline at end of file diff --git a/docs/tutorials/query_messages.md b/docs/tutorials/query_messages.md index 2f5c3ef814..36a00766cc 100644 --- a/docs/tutorials/query_messages.md +++ b/docs/tutorials/query_messages.md @@ -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