diff --git a/docs/about-settlemint/4_components.mdx b/docs/about-settlemint/4_components.mdx index 06439c82..cae16320 100644 --- a/docs/about-settlemint/4_components.mdx +++ b/docs/about-settlemint/4_components.mdx @@ -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 @@ -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 +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 @@ -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 -Middleware -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.{' '} +Middleware +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 -Storage -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/): +Storage +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 -Integration -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. +Integration +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 diff --git a/docs/using-platform/12_firefly.md b/docs/using-platform/12_firefly.md new file mode 100644 index 00000000..6749d94f --- /dev/null +++ b/docs/using-platform/12_firefly.md @@ -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 \ + --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 \ + --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 \ + --header 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiYW1icm9pc2UiLCJlbWFpbCI6ImFtYnJvaXNlQHNldHRsZW1pbnQuY29tIiwicGljdHVyZSI6Imh0dHBzOi8vcy5ncmF2YXRhci5jb20v…' \ + --header 'Content-Type: application/json' \ + --data '{ +"type": "webhook", +"name": "AssetTransfer", +"webhook": { +"url": "", +"tlsSkipVerifyHost": "true" +} +}' + +``` + +The response contains an event stream ID that is required to create a subscription: + +```shell + +curl --request POST \ + --url \ + --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": "" +} +}' + +``` diff --git a/docs/using-platform/12_insights.md b/docs/using-platform/13_insights.md similarity index 100% rename from docs/using-platform/12_insights.md rename to docs/using-platform/13_insights.md diff --git a/docs/using-platform/6_add_smart_contract_sets/2_create_smart_contract_set.md b/docs/using-platform/6_add_smart_contract_sets/2_create_smart_contract_set.md index 37f39178..0be0e2e6 100644 --- a/docs/using-platform/6_add_smart_contract_sets/2_create_smart_contract_set.md +++ b/docs/using-platform/6_add_smart_contract_sets/2_create_smart_contract_set.md @@ -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 @@ -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**. @@ -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) -