Name: Blockchain_for_TelcoRoaming
Owner: International Business Machines
Description: null
Created: 2018-05-21 16:14:36.0
Updated: 2018-05-22 05:07:34.0
Pushed: 2018-05-22 05:07:33.0
Homepage: null
Size: 11
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This is a proof of concept to demonstrate how Blockchain brings the CSPs on single Blockchain Hyperledger network which enables direct exchange of information with transactions that are immutable and executed based on consensus model using smart contract rules.
This business network defines:
Participants:
Home Operator
Roaming Partner
Assets:
Subscriber Sims
Transactions:
discovery
authentication
updaterate
callout
overagecheck
callend
callpay
addUser
There are four scenarions covered :
Roaming Partner
. discovery
trasaction is executed.
Roaming Partner
authenticates Roaming Subscriber as a visitor from Home Operator. authentication
transaction is executed.
Home Operator
register Roaming Subscriber accordingly. updaterate
transaction is executed.callout
and callend
trasactions are executed.
The charges for network usage are instantaneously recorded between Home Operator and Roaming Partner based on their agreement. callpay
trasaction is executed.addUser
transaction is executed.
Fraudulent Subscriber tries to registed to access the Home Operator network using the same MSISDN of an existing user
Authentication step identifies the subscriber and prevent the fraud. authentication
transaction is executed.callout
trasaction is executed.
Operator notifies the Overage Subscriber of the potential tariff change.overagecheck
trasaction is executed.Audience level : Intermediate Developers
If you have an IBM cloud lite account, you can also use the Starter Plan for 30 days to do this pattern.
To check that the structure of the files is valid, you can now generate a Business Network Archive (BNA) file for your business network definition. The BNA file is the deployable unit – a file that can be deployed to the Composer runtime for execution.
Use the following command to generate the network archive:
install
You should see the following output:
ting Business Network Archive
ing for package.json of Business Network Definition
Input directory: /Users/<user-name>/Documents/git-demo/roaming
d:
Description: Telecom Roaming Demo
Name: my-network
Identifier: my-network@0.0.1
ten Business Network Definition Archive file to
Output file: ./dist/my-network.bna
and succeeded
The composer archive create
command has created a file called my-network.bna
in the dist
folder.
You can test the business network definition against the embedded runtime that stores the state of 'the blockchain' in-memory in a Node.js process. From your project working directory, open the file test/foodTest.js and run the following command:
test
You should see the following output :
-network@0.0.1 test /Users/<user-name>/Documents/demo/roaming
cha --recursive
omposer.food.supply
? Transfer ProductListing to Importer (67ms)
? Exempt Check for ProductListing (98ms)
? Transfer ProductListing to Retailer (95ms)
passing (2s)
Open Composer Playground, by default the Basic Sample Network is imported.
If you have previously used Playground, be sure to clear your browser local storage by running localStorage.clear()
in your browser Console.
Now import the my-network.bna
file and click on deploy button.
You can also setup Composer Playground locally.
Once the bna is deployed , go to the test tab
To test your Business Network Definition, first click on the Test tab:
Create CSPs using transaction resetCSP
l:
tCSP {
ss (string, optional): The class identifier for this type ,
ed (string),
sactionId (string, optional): The instance identifier for this type ,
stamp (string, optional)
ple Value:
class": "org.gsc.roaming.resetCSP",
oneed": "string",
ransactionId": "string",
imestamp": "2017-10-05T07:24:24.743Z"
Create Subscribers using transaction resetMSISDN
l:
tMSISDN {
ss (string, optional): The class identifier for this type ,
ed (string),
sactionId (string, optional): The instance identifier for this type ,
stamp (string, optional)
ple Value:
class": "org.gsc.roaming.resetMSISDN",
oneed": "string",
ransactionId": "string",
imestamp": "2017-10-05T07:24:24.749Z"
Scenario 1 :
execute transaction discovery
class": "org.gsc.roaming.discovery",
sset": "string",
p": "string",
ocation": "string",
at": "string",
ong": "string",
ranstype": "string",
ransactionId": "string",
imestamp": "2017-10-05T07:24:24.724Z"
execute transaction authentication
class": "org.gsc.roaming.authentication",
sset": "string",
p": "string",
ranstype": "string",
oaming": "string",
lag": "string",
ransactionId": "string",
imestamp": "2017-10-05T07:24:24.657Z"
execute transaction updaterate
class": "org.gsc.roaming.updaterate",
sset": "string",
p": "string",
atetype": "string",
ranstype": "string",
ransactionId": "string",
imestamp": "2017-10-05T07:24:24.811Z"
Similar for other three scenarios.
Please start the local Fabric using the instructions.
Now change directory to the dist
folder containing my-network.bna
file and type:
ist
oser runtime install --card PeerAdmin@hlfv1 --businessNetworkName my-network
oser network start --card PeerAdmin@hlfv1 --networkAdmin admin --networkAdminEnrollSecret adminpw --archiveFile food-supply.bna --file networkadmin.card
oser card import --file networkadmin.card
You can verify that the network has been deployed by typing:
oser network ping --card admin@my-network
You should see the the output as follows:
connection to the network was successfully tested: events
version: 0.18.1
participant: org.hyperledger.composer.system.NetworkAdmin#admin
identity: org.hyperledger.composer.system.Identity#1f95efceac5421ad34d73130c8f16fbc2d29b7dce0c3425afb3b5f077242b1fc
and succeeded
To create the REST API we need to launch the composer-rest-server
and tell it how to connect to our deployed business network.
Now launch the server by changing directory to the roaming
folder and type:
.
oser-rest-server
Answer the questions posed at startup. These allow the composer-rest-server to connect to Hyperledger Fabric and configure how the REST API is generated.
admin@my-network
as the card name.never use namespaces
when asked whether to use namespaces in the generated API.No
when asked whether to secure the generated API.Yes
when asked whether to enable event publication.No
when asked whether to enable TLS security.Test REST API
If the composer-rest-server started successfully you should see these two lines are output:
server listening at: http://localhost:3000
se your REST API at http://localhost:3000/explorer
Open a web browser and navigate to http://localhost:3000/explorer
You should see the LoopBack API Explorer, allowing you to inspect and test the generated REST API. Follow the instructions to test Business Network Definition as mentioned above in the composer section.