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
61 changes: 43 additions & 18 deletions docs/about-settlemint/4_components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ build a blockchain application.
style={{ display: 'block', margin: '0 auto' }}
/>
The first step to building anything on SettleMint is to [create an application](../../using-platform/create-an-application).
You can think of an application as the collection of resources that you need to build your blockchain application. This includes
a blockchain network, smart contracts, middleware, storage, and integrations.{' '}
You can think of an application as the collection of resources that you need to build
your blockchain application. This includes a blockchain network, smart contracts,
middleware, storage, and integrations.{' '}

## Add a Blockchain Network and Node

Expand All @@ -38,8 +39,9 @@ a blockchain network, smart contracts, middleware, storage, and integrations.{'
style={{ display: 'block', margin: '0 auto' }}
/>
After creating a blockchain application, you now need to [add a blockchain network](../../using-platform/add-a-network-to-an-application)
and node to your application. SettleMint offeres a variety of different [blockchain networks](../supported-blockchains) to
choose from whatever your usecase may be. Networks need nodes to support the blockchain to run, once a [network is created](../../using-platform/add-a-node-to-a-network/)
and node to your application. SettleMint offeres a variety of different [blockchain
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this intentional?

networks](../supported-blockchains) to choose from whatever your usecase may be.
Networks need nodes to support the blockchain to run, once a [network is created](../../using-platform/add-a-node-to-a-network/)
then a node is also added automatically.{' '}

## Create a Smart Contract
Expand All @@ -51,30 +53,53 @@ then a node is also added automatically.{' '}
height="70%"
style={{ display: 'block', margin: '0 auto' }}
/>
Smart Contracts allow us to run code on the blockchain. Developing a smart contract by [adding a smart contract set](../../using-platform/create-smart-contract-set/),
is an important step to reaching the business and product goals of your blockchain application.
Smart Contracts allow us to run code on the blockchain. Developing a smart contract
by [adding a smart contract set](../../using-platform/add_smart_contract_sets/create_smart_contract_set),
is an important step to reaching the business and product goals of your blockchain
application.

## Add a Middleware

<img src={middleware} alt="Middleware" width="70%" height="70%" style={{ display: 'block', margin: '0 auto' }} />
Blockchain applications produce data that lives on the blockchain, but we need to be able to access that data in order to
use it. Creating a [middleware](../../using-platform/middleware/) allows us SettleMint currently offers two middleware services:
The Graph and Smart Contract Portal Middleware.{' '}
<img
src={middleware}
alt="Middleware"
width="70%"
height="70%"
style={{ display: 'block', margin: '0 auto' }}
/>
Blockchain applications produce data that lives on the blockchain, but we need to
be able to access that data in order to use it. Creating a [middleware](../../using-platform/middleware/)
allows us SettleMint currently offers two middleware services: The Graph and Smart
Contract Portal Middleware.{' '}

## Add Storage

<img src={storage} alt="Storage" width="70%" height="70%" style={{ display: 'block', margin: '0 auto' }} />
Your blockchain application may need to store data. Blockchains are good for running different processes in a decentralized
way but can be costly to store large amounts of data. SettleMint offers [two storage options](../../using-platform/storage/):
<img
src={storage}
alt="Storage"
width="70%"
height="70%"
style={{ display: 'block', margin: '0 auto' }}
/>
Your blockchain application may need to store data. Blockchains are good for running
different processes in a decentralized way but can be costly to store large amounts
of data. SettleMint offers [two storage options](../../using-platform/storage/):
IPFS (decentralized) and MinIO (centralized) S3 storage.

## Add an Integration

<img src={storage} alt="Integration" width="70%" height="70%" style={{ display: 'block', margin: '0 auto' }} />
Blockchains are not the only technology that your blockchain application may need to interact with. SettleMint offers an
[Integration Studio](../../using-platform/integration-studio) which allows you connect your blockchain application to other
technologies such as databases, APIs, and more. This tool is a low-code to which also offers a visualization of any business
logic included in your integration.
<img
src={storage}
alt="Integration"
width="70%"
height="70%"
style={{ display: 'block', margin: '0 auto' }}
/>
Blockchains are not the only technology that your blockchain application may need
to interact with. SettleMint offers an [Integration Studio](../../using-platform/integration-studio)
which allows you connect your blockchain application to other technologies such as
databases, APIs, and more. This tool is a low-code to which also offers a visualization
of any business logic included in your integration.

## Getting Started

Expand Down
135 changes: 135 additions & 0 deletions docs/using-platform/12_firefly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Firefly FabConnect

Firefly FabConnect is an open-source middleware that lets you interact with your Fabric network and the chaincode deployed on it. When you add the FabConnect middleware to your application on the SettleMint Platform, you automatically deploy a RESTful API to:

- Manage identities on your network.
- Send transactions to your chaincode.
- Check any transaction receipt.
- Create event streams and subscriptions.

:::warning

Before you start, make sure you are running:

- A Fabric Network.
- A Fabric smart contract set.

:::

## Manage Identities

Identities on a Fabric network are managed in two steps. First, a CA admin must register users. This is a process in which the CA admin gives an ID and secret to an identity. Then, the user of the identity enrolls the ID and secret pair to get a public/private key pair to sign transactions.

Registering an identity can be done as follows using Firefly FabConnect:

```shell
curl --request POST \
--url https://fireflyfab-7853.gke-europe.settlemint.com/identities \
--header 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiYW1icm9pc2UiLCJlbWFpbCI6ImFtYnJvaXNlQHNldHRsZW1pbnQuY29tIiwicGljdHVyZSI6Imh0dHBzOi8vcy5ncmF2YXRhci5jb20v…' \
--header 'Content-Type: application/json' \
--data '{
"type": "client",
"name": "user3",
"attributes": {}
}'
```

This request returns the secret associated with name user3:

```shell

{
"name": "user3",
"secret": "fkrTKPOZZYWO"
}

```

The end user of that identity can enroll it as follows:

```shell

curl --request POST \
--url <https://fireflyfab-7853.gke-europe.settlemint.com/identities/user3/enroll> \
--header 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiYW1icm9pc2UiLCJlbWFpbCI6ImFtYnJvaXNlQHNldHRsZW1pbnQuY29tIiwicGljdHVyZSI6Imh0dHBzOi8vcy5ncmF2YXRhci5jb20v…' \
--header 'Content-Type: application/json' \
--data '{
"secret": "fkrTKPOZZYWO"
"attributes": {}
}'

```

## Sending Transactions

Assuming that you have a [chaincode deployed](../blockchain-guides/5_Hyperledger-Fabric/6_hyperledger-fabric-integration-tools.md) on your network, you can send a transaction through the middleware:

```shell

curl --request POST \
--url <https://fireflyfab-7853.gke-europe.settlemint.com//transactions> \
--header 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiYW1icm9pc2UiLCJlbWFpbCI6ImFtYnJvaXNlQHNldHRsZW1pbnQuY29tIiwicGljdHVyZSI6Imh0dHBzOi8vcy5ncmF2YXRhci5jb20v…' \
--header 'Content-Type: application/json' --data '{
"headers": {
"type": "SendTransaction",
"signer": "user3",
"channel": "default-channel",
"chaincode": "assetTransfer"
},
"func": "CreateAsset",
"args": [
"asset01", "blue", "5", "Alice", "500"
],
"init": false, "fly-sync": true
}'

```

This transaction creates an asset in the assetTransfer chaincode deployed on the Fabric network.

## Create Event Streams

Firefly FabConnect can also be used to stream events happening on your network. You can either use webhook or websocket to deliver the data.

This request create a stream using webhooks:

```shell

curl --request POST \
--url <https://fireflyfab-7853.gke-europe.settlemint.com/eventstreams> \
--header 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiYW1icm9pc2UiLCJlbWFpbCI6ImFtYnJvaXNlQHNldHRsZW1pbnQuY29tIiwicGljdHVyZSI6Imh0dHBzOi8vcy5ncmF2YXRhci5jb20v…' \
--header 'Content-Type: application/json' \
--data '{
"type": "webhook",
"name": "AssetTransfer",
"webhook": {
"url": "<https://myAssets.com/assetTransfer>",
"tlsSkipVerifyHost": "true"
}
}'

```

The response contains an event stream ID that is required to create a subscription:

```shell

curl --request POST \
--url <https://fireflyfab-7853.gke-europe.settlemint.com//subscriptions> \
--header 'Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiYW1icm9pc2UiLCJlbWFpbCI6ImFtYnJvaXNlQHNldHRsZW1pbnQuY29tIiwicGljdHVyZSI6Imh0dHBzOi8vcy5ncmF2YXRhci5jb20v…' \
--header 'Content-Type: application/json' \
--data '{
"payloadType": "string",
"name": "mySubscription",
"channel": "default-channel",
"signer": "user3",
"fromBlock": "0",
"stream": "es-92183185-01e3-4bc9-5433-348a640f5fe1",
"filter": {
"blockType": "tx",
"chaincodeId": "",
"eventFilter": ""
}
}'

```
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ title: Add a Smart Contract Set
description: Add a Smart Contract Set
sidebar_position: 1
---

# Add a Smart Contract Set

By using smart contract sets, you can add **business logic** to your application.

Smart contract sets are programs that run on the blockchain and define the rules of your use case. They are self-executing with an 'if this, then that' pattern and activate when predefined conditions are met, such as a smart contract that transfers the ownership of a car once a certain amount of money is transferred to the seller's account.

To expedite the process of writing and deploying smart contracts, we offer a [**template library**](/docs/using-platform/6_add_smart_contract_sets/1_%20smart_contract_templates.md) and an **Integrated Development Environment (IDE)**. The template library includes pre-built smart contract sets for specific use cases, which are easily customizable to match your needs.
To expedite the process of writing and deploying smart contracts, we offer a [**template library**](./1_smart_contract_templates.md) and an **Integrated Development Environment (IDE)**. The template library includes pre-built smart contract sets for specific use cases, which are easily customizable to match your needs.

## How to Add a Smart Contract Set

Expand All @@ -20,16 +21,16 @@ Click **Smart Contract Sets** in the left navigation, and then click **Add a Sma
Follow these steps to add the smart contract set:

1. Navigate to **Smart Contract Sets** and press **Add a Smart Contract Set**.
![Smart contract sets](../../../static/img/smart-contract-sets/add-set.png)
![Smart contract sets](../../../static/img/smart-contract-sets/add-set.png)
2. Select which of your **blockchain nodes** the smart contract set needs to be deployed to, and click **Continue**.
![Select node](../../../static/img/smart-contract-sets/select-node.png)
![Select node](../../../static/img/smart-contract-sets/select-node.png)
3. Choose a **template**. The IDE instance will contain a set of pre-built smart contract templates for your selected use case.
![Select template](../../../static/img/smart-contract-sets/select-a-template.png)
4. Choose a **Smart Contract Set Name** that will be easily recognizable in your dashboards, then select the **IDE User**.
![Select template](../../../static/img/smart-contract-sets/select-a-template.png)
4. Choose a **Smart Contract Set Name** that will be easily recognizable in your dashboards, then select the **IDE User**.
The IDE that comes with the smart contract set is a single-user application. This user can be you or another member of your organization.
![Select template](../../../static/img/smart-contract-sets/set-name.png)
![Select template](../../../static/img/smart-contract-sets/set-name.png)
5. Choose a **Deployment Plan**. Select the type, cloud provider, region, and resource pack. [More about deployment plans](/docs/launch-platform/managed-cloud-deployment/13_deployment-plans.md).
![Select template](../../../static/img/smart-contract-sets/cloud-provider.png)
![Select template](../../../static/img/smart-contract-sets/cloud-provider.png)
6. Review the resource cost for this smart contract set displayed at the bottom of the form. Click **Confirm** to add the smart contract set.

You are now ready to use the IDE to configure the smart contract set to your needs and deploy it. You will see your deployed smart contracts in the **Details tab**.
Expand All @@ -42,4 +43,3 @@ For protocol-specific information, please refer to the relevant section in our b
- [Binance Smart Chain Smart Contracts IDE](/docs/blockchain-guides/3_Binance-Smart-Chain/5_binance-smart-chain-integration-tools.md)
- [Polygon Smart Contracts IDE](/docs/blockchain-guides/4_Polygon/5_polygon-integration-tools.md)
- [Hyperledger Fabric Smart Contracts IDE](/docs/blockchain-guides/5_Hyperledger-Fabric/6_hyperledger-fabric-integration-tools.md)