Luniverse User Guide

루니버스 사용을 환영합니다!
이 페이지에서는 루니버스 서비스 사용 가이드를 제공합니다.
루니버스를 사용하여 다양한 디앱(DApp)을 제작해보세요.

Welcome to Luniverse!
This page provides a guide to using the Luniverse service.
Try to create various DApps by utilizing Luniverse.

Guides

Hyperledger Fabric Tutorial, Luniverstar

[Resource materials]
https://github.com/Lambda256/hyperledger-luniverstar-sample/archive/master.zip

Explanation on Demo DApp

Demo DApp is a simple service that allows you to fund idol groups, receive tokens as reward, and purchase products with the tokens. Front-end is developed with Vue.js and axios, and Back-end is developed with spring boot using Hyperledger Fabric official SDK. Back-end is linked to each comprising component of Hyperledger network and provides API that processes transaction into REST format.

Download DApp

  1. Download the resource material above and unzip the file. (hyperledger-luniverstar-sample-master.zip)

  2. Go to hyperledger-luniverstar-sample-master/standard directory.
    $ cd hyperledger-luniverstar-sample-master/standard

  3. Check for api chaincode directory.
    $ ls

DApp Front-end

  • Executing web server: You need to start a web server to access idol-funding Application on the browser. In this example, we provide web service using npm run serve. The example will be provided in the following order.
  1. Go to hyperledger-luniverstar-sample-master/standard directory.
    $ cd hyperledger-luniverstar-sample-master/standard
  2. Node.js is required to use npm. You can download it on node.js. Make sure download and install the LTS version. If you have installed it before, you can skip this process.
  3. Start web server to begin idol-funding Application.
    $ npm install
    $ npm run serve
  4. When your web server is successfully launched, log is shown as below.
DONE  Compiled successfully in 10488ms            

 
  App running at:
  - Local:   http://localhost:8080/ 
  - Network: http://172.17.43.38:8080/

  Note that the development build is not optimized.
      To create a production build, run npm run build.
  1. Access "http://localhost:8080" on browser. What you see now is an Idol Funding Demo, a web-application not connected to blockchain yet.

Deploying chaincode for idol-funding

Under chaincode directory, there are chaincode source and zip files for Go, Java and Node.js. Select a zip file for your desired language and deploy the file referring to the following link:
Deploying Chain Code

[Precautions]
At this point, what you need to be cautious of is that for Free Trial, you are using a shared network, so if the name of the chaincode you are trying to deploy matches the chaincode already deployed by another user, error would occur. Thus, we recommend naming chaincode by using something unique such as ID or date. Version expects strings of characters, not numbers. Therefore, you can enter in any format such as v1.0, 1.0, 1, etc. For Init Parameter, copy and enter the following text:
["funding","14","like","256","rwt","100000"]

Setting up Server

The server contains codes that directly connects to blockchain, so you need some settings. You can refer to "Preparing for DApp Development" in the Developing DApp on Hyperledger Fabric
to check the following instructions:

First, download a connection profile file about Fabric Network and move it to api directory.

  1. Go to api directory.
    $ cd hyperledger-luniverstar-sample-master/standard/api

  2. Move a downloaded yaml or json file to current directory.
    $ mv ~/Downloads/connection-profile.json ./

Executing Server

  1. Go to api directory.
    $ cd hyperledger-luniverstar-sample-master/free-trial/api
  2. Luniverstar run by maven, so you need to install maven first. You can install maven through Homebrew easily. If you have not installed Homebrew before, you can go to Homebrew and copy the installation command and paste it on terminal.
    Copy and paste the following command to install maven.
    $ brew install maven
    Check out if maven is installed successfully.
    $ mvn -v
    If maven version check is right, you are ready to run server.
  3. start server.
    $ mvn spring-boot:run -Dspring-boot.run.arguments=./connection-profile-Hyperledger_Free_Trial.yaml,channel name,chain code name,chain code version
    예시) $ mvn spring-boot:run -Dspring-boot.run.arguments=./connection-profile-Hyperledger_Free_Trial.yaml,mychannel,luniverstarTest,1.0
  4. Log is as follows after you start server.
2019-12-24 16:59:10.478  INFO 12450 --- [           main] c.l.hledger.demo.DemoApplication         : Starting DemoApplication on Sucheolui-MacBookPro.local with PID 12450 (/Users/christin/work/demo-idol-funding/api/target/classes started by christin in /Users/christin/work/demo-idol-funding/api)
2019-12-24 16:59:10.481  INFO 12450 --- [           main] c.l.hledger.demo.DemoApplication         : No active profile set, falling back to default profiles: default
2019-12-24 16:59:11.265  INFO 12450 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8081 (http)
2019-12-24 16:59:11.274  INFO 12450 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-12-24 16:59:11.274  INFO 12450 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.29]
2019-12-24 16:59:11.324  INFO 12450 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-12-24 16:59:11.324  INFO 12450 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 788 ms
2019-12-24 16:59:11.455  INFO 12450 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-12-24 16:59:11.613  INFO 12450 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8081 (http) with context path ''
2019-12-24 16:59:11.616  INFO 12450 --- [           main] c.l.hledger.demo.DemoApplication         : Started DemoApplication in 1.398 seconds (JVM running for 1.716)

Calling for Transaction

Now you are ready to call service to blockchain. Access DApp client(http://localhost:8080) on the browser, choose your favourite boy bands or girl groups and try clicking on project funding. When you get the following log on the screen that you started the server, it’s successfully done.

2019-12-24 17:10:39.425  INFO 12450 --- [nio-8081-exec-6] c.l.hledger.dapp.ChaincodeExecuter       : [√] Got success response from peer peer0.org1.example.com => payload: rwt: 8100
2019-12-24 17:10:39.425  INFO 12450 --- [nio-8081-exec-6] c.l.hledger.dapp.ChaincodeExecuter       : [√] Got success response from peer peer1.org1.example.com => payload: rwt: 8100
2019-12-24 17:10:39.425  INFO 12450 --- [nio-8081-exec-6] c.l.hledger.dapp.ChaincodeExecuter       : Sending transaction to orderers...
2019-12-24 17:10:41.454  INFO 12450 --- [pool-1-thread-4] c.l.hledger.demo.DemoApplication         : Receive block event (number 27) from Peer{ id: 4, name: peer1.org1.example.com, channelName: mychannel, url: grpcs://hyper-4053561120315537863.luniverse.dev:8051}
2019-12-24 17:10:41.463  INFO 12450 --- [pool-1-thread-4] c.l.hledger.demo.DemoApplication         : Receive block event (number 27) from Peer{ id: 3, name: peer0.org1.example.com, channelName: mychannel, url: grpcs://hyper-4053561120315537863.luniverse.dev:7051}
2019-12-24 17:10:41.463  INFO 12450 --- [pool-1-thread-2] c.l.hledger.dapp.ChaincodeExecuter       : Orderer response: txid961be3a6204e27aee863a435cc19d2bf50276124310136f55a20fa1d8e26ab45
2019-12-24 17:10:41.463  INFO 12450 --- [pool-1-thread-2] c.l.hledger.dapp.ChaincodeExecuter       : Orderer response: block number: 27
2019-12-24 17:10:41.489  INFO 12450 --- [nio-8081-exec-6] c.l.hledger.dapp.ChaincodeExecuter       : [√] Got success response from peer peer0.org1.example.com => payload: 8100
2019-12-24 17:10:41.489  INFO 12450 --- [nio-8081-exec-6] c.l.hledger.dapp.ChaincodeExecuter       : [√] Got success response from peer peer1.org1.example.com => payload: 8100

Updated 8 months ago

Hyperledger Fabric Tutorial, Luniverstar


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.