This page provides a step-by-step tutorial to deploy a sample app with Xooa’s blockchain platform-as-a-service (PaaS/BaaS). Xooa provides a permanent cloud end-point for the smart contract, enabling cloud-to-cloud integration, while retaining blockchain’s peer-to-peer capabilities.
If you are using Xooa for the first time and just want to go through the process of creating a blockchain app, then you need only log in to Xooa. That’s it. Nothing more to do. Read no further.
To deploy your smart contract, you can proceed with either of the below options:
- Have a GitHub repository with your smart contract and you need to tell Xooa where the smart contract is in the repository.
- Have the smart contract available in your local directory.
- Write the smart contract directly on the Xooa console.
The easiest way to do that is to fork Xooa’s repository, which contains the necessary files:
If you already have an existing blockchain smart contract, you can use that too.
Deploy the Smart Contract App
- In the Xooa console, go to Apps menu.
- Click Custom Smart Contracts tile.
Click Deploy Your First App.
Locate your smart contract:
- Select Local Upload, Write code, Public, Private, or Xooa GitHub as appropriate (if you want to try the sample, select Xooa Github).
- If you need to, search for your repository
- Click Select, and then click Next.
From Smart Contract, select the smart contract you want to deploy, the ledger you want to deploy on, the language of your smart contract, and click Deploy. This deploys the contract to Xooa and creates an identity that can access the ledger.
Yeah, you are almost done. Xooa is doing the blockchain heavy lifting. You will be redirected to the app’s dashboard when the process completes. Be sure to copy that API token.
Create an Identity
Go to the Identities tab, and then click Add New
Enter an identity name and under API Access Permission, select Read+Write.
Click Create. You’ll get a message that the identity has been enrolled and the API token generated.
Before you dismiss the message, click Copy, The token is now in the clipboard.
Store the token somewhere safe. You will need it to authorize every API request.
Xooa does not store the API token. If you lose the token, you will have to generate a new one, invalidating any existing API clients.
Write to the Blockchain Ledger
You have created your smart contract app and now you want to invoke a smart contract function. Here, we’ll demonstrate the
set function on the Get-Set smart contract. This function allows us to write data to the ledger. We can invoke functions directly from the API documentation, but you will need the API token you copied earlier.
In your Get-Set app, go to the API tab, and then click Explore API’s. The API Explorer, including the API documentation, opens.
In the top left, there is an input field for the API token. Paste the token you copied earlier here.
From the navigation, go to Smart Contract > Invoke Smart Contract Function.
In the fcn field, enter
set. The function set on the Get-Set smart contract will write to the ledger.
In the body field, enter the data you want to store in the ledger in the format:
[ "<key>", "<value>" ]
If your HTTP response code was 200, you have saved data in a blockchain ledger by using Xooa. Check instructions in the message or the API documentation for other return codes.
Read from the Blockchain Ledger
- To view transactions, go to Ledger > Transactions.
Click the Tx id to get additional details about the transaction
Easy client integration
Custom Smart Contract Videos
Deploy Hypeledger Fabric Smart Contract
Deploy Ethereum Smart Contract