Sie sind auf Seite 1von 67

Car Dealer Workshop

To get Familiar with

Oracle’s Blockchain Platform


Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Introduction
In a Blockchain, there is no closed, centrally managed repository of data, instead each
participant can read and validate the ledger, and its distributed nature ensures there is no
single point of failure. In this workshop, we will focus upon how Blockchain can bring
transparency and accountability to a complex supply chain, and enable real-time tracking of
assets.

The purpose of this session is to introduce you to multi-party Blockchain networks or consortia.
You will learn to

 Setup a Founder Organization


 Setup two Participants
 Create a Blockchain network with a founder and two participants
 Create channels
 Install and instantiate chaincode
 Execute chaincode from the command line (using curl)
 Execute chaincode using Postman
 Use a Web App to interact with a Blockchain (Optional)
 Create an Autonomous Data Warehouse for usage as RichHistory Database (Optional)
 Analyze data within the Autonomous Data Warehouse with Oracle Analytics (Optional)

Prerequisites
It is assumed that you have met the prerequisite as described in the document Car Dealer
Prerequisite. If not … well let’s say you are on your own ... right now ... and it’s not a good place
to be.

Last check
To successfully finish this workshop you will

1. Have to meet the Prerequisites as described in Car Dealer Prerequisite


2. Received this document 
3. Received the file MyCarTrace.zip (which holds the chaincode .. whatever that may be)
4. Received the file car-dealer-test-API.sh (which holds code to populate the Blockchain)
5. Received the file cartrace_web_app.zip (which holds a small Web App frontend)
6. Received the file car-dealer-append-parts-API.sh (which holds code to append extra data
to the Blockchain)

Got it all? On your marks …. 3 … 2 … 1 … GO!

Page 2 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Contents
Introduction .................................................................................................................................... 2
Prerequisites ................................................................................................................................ 2
Last check .................................................................................................................................... 2
Scenario........................................................................................................................................... 5
Pre-Work Rich History Database..................................................................................................... 6
Setting up the Blockchain Network ................................................................................................ 6
Create Instance for the Founder ................................................................................................. 7
Create Participant ........................................................................................................................ 9
Let a Participant Organization join the Network ....................................................................... 11
The Founder must export the Orderer settings to the Participant ........................................ 11
The Participant must import the Orderer settings received from the Founder .................... 13
The Participant must export it’s certificates .......................................................................... 15
The Founder needs to import the certificates from the Participant ..................................... 16
The Participant Exports information about its peer nodes.................................................... 18
The Founder imports Participants peer nodes information .................................................. 20
Create Second Participant ......................................................................................................... 21
Create Channels ......................................................................................................................... 21
Join Channels ............................................................................................................................. 23
Inform the founder of the participant nodes. ........................................................................... 25
Review the network................................................................................................................... 27
Installing Chaincode on your Network ...................................................................................... 28
Install & Instantiate Chaincode on the Founder .................................................................... 28
Install Chaincode on participant ............................................................................................ 34
Re-export Peer Information ................................................................................................... 36
Configure REST Proxy ............................................................................................................. 36
Initialize the Ledger....................................................................................................................... 38
Using Postman .............................................................................................................................. 45
The Web App................................................................................................................................. 49
What is a Rich History Database ................................................................................................... 51
Create an Autonomous Data Warehouse ................................................................................. 52
Add extra Transactions to the Ledger........................................................................................... 59
Create an Analytics Instance ......................................................................................................... 59
Connect Analytics Cloud to the Rich History Database ................................................................ 61
DIY Chaincode ............................................................................................................................... 66
Writing Chaincode ..................................................................................................................... 66
Hyperledger Fabric Documentation ....................................................................................... 66

Page 3 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Scenario
A large automaker aims to streamline their supply-chain by providing seamless integration to a
permissioned ledger (Blockchain) for the supply-chain software of its dealers. The end goal is to
reduce reconciliation efforts and the overall friction that comes with establishing an audit-trail
for vehicles and parts.

As the dealers may be competitors with one another, they obviously will not want other dealers
to be able to view the details of their transactions (or even that they are making transactions),
which is a barrier to simply opening up the dealer’s central supply chain systems for query. In
Blockchain Cloud Service, we can overcome this by using channels, which segregate
transactions from one another, and only enable those peers who are in that channel visibility of
those transactions.

In our scenario we are going to create a central manufacturer (Detroit Auto) and two dealers
(Sam and Jude), and separate them by channels, as per the diagram below:

These channels have separate ledgers that are visible only to the vehicle manufacturer and
specific dealer in that channel. While channels can have many more participants than just two,
and the network many more organizations (for instance, with multiple different parts
manufacturers), this simple model is sufficient for our scenario.

Page 5 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Pre-Work Rich History Database


If you plan to also do this workshop with respect to the Rich History Database then make sure
that you create *now* an Analytics Instance, see Create an Analytics Instance (since this is a
time consuming operation). While the Cloud creates your Analytics instance you can start with
the workshop.

You do not need to create an Autonomous Database Warehouse since this is not very time
consuming. However if you like to create it up front then see Create an Autonomous Data
Warehouse.

Setting up the Blockchain Network


In this example we need three instances. An instance for the (manufacturer) Detroit Auto, an
instance for Sam Dealer and an instance for Jude Dealer. Detroit Auto will be the founder of the
Blockchain Network. Sam Dealer will be a participating organization.

In real life Detroit Auto, Sam Dealer and Jude Dealer will all have their own Cloud Infrastructure
with their own Admins and users. You will mimic this in one Cloud Environment. You will be the
admin for Detroit Auto, Sam Dealer and Jude Dealer.

Login to your Oracle Cloud Tennant. This will bring you My Services:

Goto your the Dashboard:

Page 6 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

On the Dashboard select the Action menu (3 dots above each other) in the Blockchain Platform
tile and select Open Service Console

NOTE: If you do not see this tile you can select the gear next to Dashboard (top left
corner) and set Blockchain to Show. After this the Blockchain tile will be visible

NOTE 2: Or select the Hamburger menu in the top-left corner. Under services you will
find “Blockchain Platform” (which will bring you to the Blockchain Service Console).

NOTE: All screenshots are for information purposes only! They will just give you feedback
to assure you that you are on the right spot. Do not take any information/settings in the
screenshot for granted. The text is always leading and correct!!

Create Instance for the Founder


In the Blockchain Cloud Service Console you will see this interface:

Page 7 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Depending on your configuration you might already have 1 or more instances. You will now
create a new instances for Detroit Auto (who is the founder of a new network). Click on Create
Instance:

The instance name should be DetroitAuto and give it a useful description. The notification email
should go to YOU! In the Region dropdown select the appropriate Region.
Make sure you have check marked Create a new Network and select the appropriate
Configuration. Select two Peers.

Click on Next (Upper Right Corner):

Verify all settings and click Create to create the Instance.

You can now wait until the instance has been created (very likely within 10
Minutes or even less) or create the first Participant within this Network. It’s up to you 
Once the instance is created you get an email similar to:

Page 8 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Create Participant
In this simulated setup all instances will be made in the same Cloud Infrastructure. Meaning
that you will create instances for Detroit Auto, Sam Dealer and Jude Dealer. In real life Detroit
Auto will create in their own Cloud Infrastructure an instance (and also create a new Network).
While Sam Dealer will create in the Cloud Infrastructure of Sam Dealer its own instance. Same
for Jude.

Creating an instance (and a new Network) and creating a participant is very similar. We will now
create an instance for Sam Dealer. Make sure you are in the Blockchain Cloud Service Console:

Again click on Create Instance:

Page 9 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Use SamDealer for instance name and give it a useful description. The notification email should
go to YOU! Select the Appropriate Region and make sure you un-check Create a new Network
(remember that this was already done by Detroit Auto). Sam Dealer will become a Participant
Organization within the Network.

Select the appropriate Configuration and number of peers (two will do).

Click Next:

Review the settings and if satisfied press Create.

Page 10 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

In the Blockchain Cloud Service Console you will see that is in the status Creating service. Again
you will receive an email once the instance is created.

You have to wait for this since we have to add Sam Dealer to the Blockchain network created by
Detroit Auto.

Let a Participant Organization join the Network


If a Participant joins the Network the following data exchanges must be executed by the
Founder and the Participant:

1. The Founder must export the Orderer settings to the Participant


2. The Participant must import the Orderer settings received from the Founder
3. The Participant must export it’s certificates
4. The Founder needs to import the certificates from the Participant
5. The Participant Exports information about its peer nodes
6. The Founder imports Participants peer nodes information

NOTE: Detroit Auto is the Founder, Sam Dealer is the Participant.

Now you know what to … let’s do it!

The Founder must export the Orderer settings to the Participant


In the Blockchain Cloud Service Console click on the hamburger menu of Detroit Auto:

This will pop up a menu. Select Blockchain Console:

Page 11 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

This is the Blockchain Cloud Service Console for Detroit Auto. Select the Network Tab:

Click on the Hamburger Menu in the DetroitAuto row. This will popup a menu where you will
select Export Orderer Settings:

Page 12 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

This will enable you to store the Orderer settings on your Hard Drive:

Save the file and make sure that the appropriate Blockchain administrator of the Participant
gets a copy of this file (   That’s you   ).

The Participant must import the Orderer settings received from the Founder
The Participant will receive from the Founder the Orderer settings. In the Blockchain Cloud
Service Console click on the hamburger menu of Sam Dealer:

Page 13 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

This will pop up a menu. Select Blockchain Console:

Here you see again instructions on what you need to do to join a Network. The sequence listed
here is a little bit different. The sequence is not that important, but make sure you exchange
the appropriate information (securely).

Go to the Network Tab:

Page 14 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Click on Orderer Settings and select Import to Import the Orderer settings you have received
from the Founder:

Press Submit

The Participant must export it’s certificates


Now you need to export your (Sam Dealer) certificates. While in the Network tab, click on the
hamburger menu in the SamDealer row. This will pop-up a menu and select Export Certificates
from it:

Page 15 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

This will collect the certificates and enable you to store them:

Save the file and make sure that the appropriate Blockchain administrator of the Founder gets a
copy of this file.

The Founder needs to import the certificates from the Participant


Open the Blockchain Cloud Service Console of the Detroit Auto (Founder) and select the
Network Tab:

Page 16 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Click on Add Organizations and upload the file holding the certificates from Sam Dealer:

Within this dialog you can add more than one organization. Using the + symbol enables you to
add more organizations in bulk. However in this case we just have one.

Click Add and you will get confirmation about the Success 

Page 17 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Click on Finish. Note that you now can see that the Network has two Organizations:

The Participant Exports information about its peer nodes


Open the Blockchain Cloud Service Console of the Sam Dealer (Participant) and select the
Nodes Tab. In the Nodes tab click on Export/Import Peers:

Page 18 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

This will enable you to export peer information, select both peers:

Press Export and store them on your Disk:

Page 19 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

The Founder imports Participants peer nodes information


Open the Blockchain Cloud Service Console of the Detroit Auto (Founder) and select the Nodes
Tab. In the Nodes tab click on Export/Import Peers:

Press Import and select the file you just created (at Sam Dealer):

It is also possible to import a (large) number of node information from various organizations on
your Blockchain network. Use the + sign for this. For now, we just have one. Press Import.

Have a look at the bottom of the node list, your two peers are now listed:

Page 20 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Create Second Participant


In the previous chapter you have added the first participant Sam Dealer. You will now add a
second participant called Jude Dealer. The process is exactly the same as explained in the
previous chapter, just replace Sam Dealer with Jude Dealer.

Remember what you needed to do to get this done:

1. The Founder must export the Orderer settings to the Participant


2. The Participant must import the Orderer settings received from the Founder
3. The Participant must export it’s certificates
4. The Founder needs to import the certificates from the Participant
5. The Participant Exports information about its peer nodes
6. The Founder imports Participants peer nodes information

I think you can do this now without looking back at previous pages. The GUI made it very easy
for you.

Would you take that as a challenge? If successfully succeeded, then you can request a free cup
of coffee from your instructor 

Once Finished (you have a Jude Dealer who is part of the just created Blockchain Network) you
can continue with the next chapter …

Create Channels
The final step in setting up our multi-party blockchain network is to create channels for each of
the dealers, in order to segregate transactions from each dealer from the transactions of other
dealers. In our scenario, we want a separate channel for each of our two dealers.

To create these you need to navigate to the “Channels” tab in the founder organization’s
console (Detroit Auto).

Then click “Create Channel” and create a channel. Here are is the full walkthrough:

Page 21 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

And Press Submit (after submitting you will get a message that you cannot delete a channel,
accept this). You also may need to refresh your browser to see the result.

And for the judechannel:

And Press Submit (after submitting you will get a message that you cannot delete a channel,
accept this). You also may need to refresh your browser to see the result.

Final result looks like:

Page 22 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Look also in the top right corner, the bell might ring  Click on the bell to see the notifications.

Normally the messages are about success. Although you might get messages talking about Bad
Gateway. In that case go to the Addendum Everything you never wanted to know about the
API, and then return here.

Join Channels
These channels, at present, only contain Detroit Auto’s peer nodes. The dealers cannot create
transactions on these channels, nor view transactions on these channels, as they do not have
nodes which participate on them. However, as their Organizations were added at channel
creation, they are allowed to add their own peers to the channel.

In order to join the created channel, access the participant organization’s console. From there
navigate to the “Channels” tab and click on the hamburger menu for each peer node, then select
“Join Peers to Channel”.

Here is Sam Dealer:

Page 23 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Add the peers:

And press Join.

Page 24 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Got it? Now repeat the same for Jude Dealer!

It’s that damned easy that your instructor does not offer this as a challenge 

Inform the founder of the participant nodes.


In order to allow the founder to include the other organizations as endorsers of transactions,
they need to know about the other peer nodes. In order to do this, we export the node
information, and import it on the founder.

In the participant organizations, navigate to the “Nodes” tab, then click the “Export/Import
Peers” button to export the node information. Select both of the participant’s peers, then click
“Export” and save the resulting file.

We’ve done this before, right. So you can do it yourself. Go to the Console of Sam Dealer and
export peer information (store them on disk). And repeat this for the Jude Dealer

Once the node information has been exported, it can be imported into the founder from its
“Nodes” tab, via the “Export/Import” button and “Import” option. Upload both sets of remote
node configuration that you exported. The only thing new here is that you import the nodes
from both participants:

Page 25 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Use the + sign to get extra rows …. Remember  and press Import

Wow .. You got an unexpected popup:

Unexpected, unexpected .. only if you were sleeping  You imported them before.… but at that
time they were “just” peers. Now those (same) peers are also on a channel. Therefore the
configuration of the peers has changed. And this needs to be updated at the Founder.

Confirm (you are awakened now ).

If this process has been completed correctly, the peer nodes for the other organizations should
appear in the Nodes list, associated with the correct organization in the MSP ID column (which
stands for Membership Service Provider, which is responsible for keeping track of the
organizations who are involved in the network). Result is looking similar to:

Page 26 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Review the network


At this point we have built out a pretty good network, and it is pretty good looking too. This can
be seen by reviewing the structure of the network, which can be done by navigating to the

“Nodes” tab on the founder. Then click the topology view button which results in
something similar to:

You have to admit, not bad at all.

As you can see, this resembles the original plan we had for the network when discussing the
original scenario (though with the addition of the default channel as an internal channel). If
your topology doesn't look like the one shown here, or peers are not present in the list, check
what is missing, then import/export those components, or check the configuration of your
channels.

For those who got it right the first time, you are now allowed to get a coffee …. on your own
expense 

Page 27 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Installing Chaincode on your Network


While we have built a pretty good-looking network, it doesn't actually do anything yet. This is
where chaincode comes in (sometimes also referred to as Smart Contracts). Chaincode is the
code that runs your Blockchain network, defining what types of data are written during
transactions, providing logic around how transactions are executed and validating the
conditions under which they should be run. Chaincode initializes and manages ledger state
through transactions submitted by applications. A chaincode typically handles business logic
agreed to by members of the network.
Chaincode is written in golang, also known as GO, or in Java or JavaScript. Don't worry too
much if you are not familiar with golang (, Java or JavaScript), as the chaincode will be supplied.

To get our Blockchain to do something you have to …

Install & Instantiate Chaincode on the Founder


You have received the file MyCarTrace.zip. This zip file holds the chaincode. Now you need to
install it.

There are two options for installing chaincode, either Quick which is designed for one-click setup
of chaincode and includes a number of defaults, or Advanced; which allows for more fine-grained
control over the chaincode setup process.

For this exercise, we will use the Advanced option, which allows us to step through the process
and explain the meaning of each setting.

In the first step of Advanced Chaincode deployment, we are installing the chaincode on each of
our relevant peers. To do this, we can enter a chaincode name (here we are using ‘carTrace’),
version one (v1) and which peers to deploy to.

In this case, we are going to deploy to all of our peers since all our peers will be come, or can
become, endorsers. In networks which have both peers that endorse transactions, and peers
which simply store a copy of the ledger, this distinction is relevant.

NOTE: Take care with the Chaincode Name, as this needs to be consistent across all of
the Organizations on which the chaincode is installed.

Let’s go to the Founders (Detroit Auto) console and select the Chaincodes tab and click on
Deploy a New Chaincode:

Page 28 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Now click on Advanced Deployment and

 Enter carTrace as Chaincode Name;


 Version v1 for version
 Add both peers
 Upload the chaincode (MyCarTrace.zip)

Page 29 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Click “Next” to install the chaincode to the peers. You should receive a success message, and
you will be prompted to ‘instantiate’ the chaincode, which involves pushing it to the channels
on which it will run.

At this step, you will need to:

 Select the channel you are instantiating the chaincode for (samchannel);
  Select the local peers that will participate in the channel (peer0; peer1);
 While the default endorsement policy is probably adequate, we can specify here that we
want to ensure transactions include both of our organizations by adding their identities
to the policy then selecting that the transactions need to be signed by 2 out of 2
 Organizations;
 The initial parameters should be left as default, as this particular chaincode doesn’t
require or use them
 There is no need for a Transient Map.
 And we will not use Private Data Collections

The completed configuration will look like the following (yes this is a screenshot which should
look exactly the same as in your instance):

Now Expand Endorsement Policy:

Page 30 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

You can use the Add Identity button to add rows. Make sure you have a Policy which requires 2
of 2 Organizations.

Once you are finished click Next (this process usually takes some time).

After instantiating the chaincode, we can expose it through the REST proxy to simplify its
invocation. Or in simple wording; developers who want to build an application on top of this
CarDealer blockchain can use the asynchronous SDK which is part of the standard Hyperledger
Fabric distribution. This means however that they have to become familiar with an
asynchronous SDK.

This instance of the CarDealer blockchain uses the Oracle Blockchain Platform (or Enterprise
Edition which is the On-Premise variant). It contains a synchronous REST API (this is what every
developer is used to) which can be accessed via the REST proxy. This will make life for
developers much easier. Let’s make the life of developers easier  (they might even reward
you in the future).

To be honest, this step is optional, and while we will complete it now (our goal is more or less
educational …), we will need to modify this configuration later due to the endorsement policy
which was configured. Don’t worry, you will be guided!

In order to expose the chaincode, select all REST proxies and all peers:

Page 31 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

And press Next. If everything went well you will be rewarded with:

The chaincode is now installed and instantiated on the samchannel on the founder (Detroit
Auto).

Page 32 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Now the second channel, judechannel. This is even easier since we already have installed the
chaincode. For judechannel you only need to instantiate it. To do this, expand the installed
carTrace, click the hamburger menu for the installed version (v1), and select Instantiate.

On this screen, select the judechannel, add both peers, and configure the endorsement policy as
before.

Page 33 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Click Instantiate.

Install Chaincode on participant


We will start installing the Chaincode at Sam Dealer. At the Console of Sam Dealer navigate to
the Chaincodes tab. This time, when we deploy the chaincode, we only need to install the
chaincode on the peers, since the chaincode was already instantiated on the channels by the
founder. To do this, we will once more use the Advanced mode of chaincode deployment.
In the “Install Chaincode” step, upload the same chaincode zip file (MyCarTrace.zip). Ensure the
name and version of the chaincode is identical to the name provided on the founder
organization, and that each of this organization’s peers are included in the “Target Peers”
selection:

Press Next.

Page 34 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Once the chaincode has been installed, there is no need to instantiate it, as instantiation is
channel-specific, not organization or peer specific.

Do not enter any data, but press the Close button.

Your result will look like (maybe you need to refresh your browser):

Page 35 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

We installed the chaincode at Sam Dealer. Repeat the same for Jude Dealer. The end result
voor Jude Dealer must be:

Re-export Peer Information


In order to expose our chaincode for consumption, we need to inform the founder organization
that this chaincode is now available on our participant’s peers. To do this, we will export the
node information once more, by clicking the Export/Import button from the Nodes tab, and
exporting the participant’s peer’s info.
Once the node information has been exported, it can be imported into the founder from its
Nodes tab, via the Export/Import button and Import option.

You’ve done this before, you’ll be fine 

Have a look at the nodes at Sam or Jude Dealer. Both do not know anything about the nodes of
the Founder. On the channels we have defined that 2 peers of each (2) organization must
endorse a transaction. If you don’t know the other peers of the other organization (in this case
the Founder) you will never get transactons on the Ledger.

Export the founder’s node information to each of the participants (Jude Dealer and Sam
Dealer).

Piece of cake … isn’t it 

NOTE: You might have figured out that it is wise to become friends with the Blockchain
admins (of other Organizations who will join your network, or where you will join their
network). I think you are right!

Configure REST Proxy


Blockchain Cloud service includes a REST Proxy to enable simple access to chaincode functions
from any HTTP client in an synchronous fasion.

Page 36 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

While the chaincode deployment process made the chaincode available externally via the REST
proxy, we specified that transactions require endorsement by multiple organizations (in our
case both, which are not configured by default in the REST proxy.

Remember what you did at the Founder for samchannel and also for judechannel:

and you enabled the REST proxy at the Founder:

In order to transactions to be appropriately endorsed, we need to update the proxy


configuration to include additional peer nodes. To be more precise, the peer nodes of the
dealers. Remember the proxy is at the Founder.
To do this, navigate to the Nodes tab (at the Founder) and locate the first REST Proxy node
(restproxy1).

Using the hamburger menu click on “Edit Configuration”.

Page 37 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Add Sam Dealer’s peers to the samchannel configuration, and then click the plus button to
expose the chaincode running on judechannel, such that the final configuration looks like the
below:

Then click Submit.

Optionally: Repeat this procedure for all REST proxies (restproxy2, restproxy3, restproxy4) you
have enabled. This enables you to not only use restproxy1 but all restproxies at the Founder
(DetroitAuto)

Optionally: You have now configured the REST proxy at the Detroit Auto. Repeat these steps at
Sam Dealer and at Jude Dealer (for all rest proxies e.g. restproxy1, restproxy2, restproxy3,
restproxy4). This enables you to not only use restproxy1 at the Founder (DetroitAuto) but all
restproxies at every Participant)

NOTE: If at At Sam (and/or Jude) Dealer you cannot add the peers from Detroit Auto …
what would be the reason? For a couple of beers your trainer will give you the right
answer 

NOTE: At Sam Dealer you can only configure the REST API for the samchannel and at
Jude Dealer you can only do it for the judechannel. Do you understand why?

You’ve done it!! Time to celebrate the birth of your first Blockchain Network. Open the
Champange bottles … or take a cup of coffee 

Initialize the Ledger


Now the chaincode has been uploaded and instantiated, you are able to invoke chaincode
functions and query the ledger. However the ledger is completely empty at the moment, so in
order to have some meaningful data to inspect, you have to add some sample data to the
ledger.

First we need to figure out what the URL is off the REST proxy. You will use the REST proxy at
the Founder (that is also the organization who in real life would actually build cars and its
components. Go to the nodes tab of the Founder and you will find the list of all nodes.

Page 38 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

The full route to restproxy1 is in the above screenshot (your route will be different but still
somewhat similar):

https://2C22DAA03C5B4BBC99FC83C3A5011CF5.blockchain.ocp.oraclecl
oud.com:443/restproxy1

Make a note of this, it’s called your REST_ADDRESS!! In a few moments you will discover why
you need to take a note of this.

Now it gets a little bit tricky:

If you have a Windows Computer but lack the Linux SubSystem; you must jump to the next
chapter Using Postman. Don’t worry, the only downside is that your ledgers will not be
populated with initial transactions. However, this is something which also can be done with
Postman. All the transactions which were added to the ledgers by the shell script are listed in
the Addendum Initialize the ledgers. In a few moments you will see how to use Postman and
you can use this data to add (some) initial transactions to the ledgers.

If you have a Linux Workstation, or a Windows Computer with the Linux SubSystem installed;
you can continue and populate the Blockchain (or more precise Ledgers) with initial
transactions using a shell script.

You received a file called car-dealer-test-API.sh file. This is a Linux shell script which will help
you to populate the ledger with transactions. Now you might think … Linux … I’m on Windows!
Yes you probably are, but one of the prerequisites was that you have installed the Windows
SubSystem for Linux. The only thing you need to do is get this file to the Linux SubSystem.
Sounds difficult ….. is easy. Let’s fire up that Subsystem, do the following:

1. From the Windows Start Menu Click on the Linux SubSystem you have installed:

Page 39 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

2. In this document openSUSE Leap 15 is used, but any Linux SubSystem will do; it wil open
some sort of command window:

3. Welcome to Linux. If you are unfamiliar with Linux, just do as you’re told  you will be
guided.

You need to make a few small modifications to the car-dealer-test-API.sh file. Open car-dealer-
test-API.sh This is a Linux file, we won’t go into details but you need to open it in WordPad,
Notepad cannot be used!

Page 40 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

You need to update this file:

a. Set MANU_NAME to Detroit Auto (the manufacturer)


b. Set DEALER_A_NAME to SamDealer
c. Ser DEALER_B_NAME to JudeDealer
d. Set DEALER_A_CHANNEL to samchannel
e. Set DEALER_B_CHANNEL to judechannel
f. Set CC_NAME to carTrace
g. Set CC_VERSION to v1
h. Set REST_ADDR to your REST Address of resproxy1 at Detroit Auto (now you
know why you had to take note of this)
i. Make sure USER is set to “”
j. Make sure PASSWORD is set to “”
k. Scroll down to line 59 (it holds the word exit, you can actually search for it since
it’s the only exit in the whole file). Insert at the beginning of this line a # if it’s not
already there. So if it is:

exit

Change it into:

# exit

Now we need to get this file to the Linux Subsystem:

1. Select all text via the icon Select all in the ribbon or via <CONTROL>+a
2. In the selected text Right Click and select Copy from the popup menu

Page 41 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

3. Now select the Linux command window and type in Linux the command vi car-dealer-
test-API.sh

4. Hit the <Enter> key


5. Press <i> key (this will show at the bottom of your screen - - INSERT - -

6. Now Click on the little icon on the left in the title bar and select Edit -> Paste (don’t do
<Ctrl>+<v> … will not work  )

Page 42 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Results in

7. Hit the <ESC> key (you will see that - - INSERT - - will disappear)
8. Now enter twice capital-z (<shift>+<z> <shift>+<z>). This will save the file and exit the
editor.
9. Well done!! Not everybody is capable of using the vi editor. I’m proud you did it!!
10. If somebody shouts EMACS … hit him    (this is a joke only understood by Linux
users …)
11. Now enter the command chmod +x car-dealer-test-API.sh in the Linux command
window.
12. Waaauuuwwwwww you are becoming a Linux Expert. Carry on the good work!!

We now have a script which will create transactions in our Blockchain Network. To run the
script type ./car-dealer-test-API.sh and hit <Enter>. This runs the script, it will ask for your
username and password (the same username and password as you used to login to the Oracle
Cloud). Please note both are visible!!

Page 43 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Some information will be shown to you:

Relax!

If you encounter failures, then have a look at your ledger (Channels → samchannel or
judechannel → Ledger and find out what went wrong. In case of (Gateway) Time out please
read the Addendum: Everything you Never wanted to know about the API and return here after
reading.

Great job! Well done, you’ve added transactions to the Ledger!

Type exit followed by <ENTER> and you will leave the Linux SubSystem. You can also close
WordPad.

Page 44 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Using Postman
To create transactions (using the above shell script) within the ledgers we used curl to interact
over the REST API with the ledgers. That’s not the only way to interact. You could also use
Postman.

Start Postman and select POST as method; the host is the REST_ADDRESS you’ve used before
extended with the REST path; /bcsgw/rest/v1/transaction/invocation. Which will result in
something like:

https://2C22DAA03C5B4BBC99FC83C3A5011CF5.blockchain.ocp.oraclecloud.com:443/restprox
y1/bcsgw/rest/v1/transaction/invocation

NOTE: You are going to invoke a method. Full details can be found in the
documentation: https://docs.oracle.com/en/cloud/paas/blockchain-cloud/rest-api/op-
bcsgw-rest-v1-transaction-invocation-post.html

Set the TYPE in in the Authorization tab to BasicAuth and enter your username and password:

Goto the Headers tab and add a new key: Content-Type with the value application/json.

NOTE: Don’t’ worry about the Authorization key. This will be automatically generated.

Switch to the Body tab. Within the body tab we will add the “payload”. The payload must be
describing the method and corresponding args which must be executed.

For non-techies: If you want to interact with the Ledger(s) to read or write transactions you
must use commands (techies call it methods), which the ledger, or better, the chaincode
understands. Commands might also need extra information (techies call this args or
arguments).

Page 45 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

For example: increase number of available cars of model DS21 with 4. Here the command is
increase. The extra information is DS21 and 4 (the sequence of extra information does matter
 ). In the table below we just discuss the 4 commands with extra information which we will
use. Don’t worry too much about it.

For techies: The methods and args are defined within the chaincode. Remember you uploaded
the chaincode via a ZIP file. This chaincode holds all methods (plus args) you can use to interact.
Later on you can examine all possible methods and corresponding args. Here we keep it to the
following 4 methods and corresponding args:

Method Arguments
initVehiclePart serialnumber: string
assembler: string
assembly date: timestamp
name: string
owner: string
recall: boolean
recall date: timestamp
initVehicle chassisnumber: string
manufacturer: string
model: sting
assembly date: timestamp
airbagserialnumber: string
owner: string
recall: boolean
recall date: timestamp
transferVehiclePart serialnumber: string
current owner: string
new owner: string
transferVehicle chassisnumber: string
current owner: string
new owner: string

NOTE: times are expressed as unix timestamps – i.e. seconds since 1st Jan, 1970

We will use the initVehiclePart with the appropriate arguments. This results in the following
payload:

{
"channel":"samchannel",
"chaincode":"carTrace",
"method":"initVehiclePart",
"args":["abg1313", "bermuda-parts", "1502688979", "airbag
1313", "DetroitAuto", "false", "1502688979"],
"chaincodeVer":"v1"
}

In Postman: Select the tab Body, click on raw and paste the above payload.

Page 46 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Now hit the (blue) Send button.

After a while, hopefully not too much while, you will receive a response. Either success, which
you can recognize if you get something similar to:

But you really get lucky if you get something like:

You lucky bastard! However don’t panic!! Keep calm!! Read the Addendum Everything you
Never wanted to know about the API. And then return here.

Now you got the idea, experiment and enjoy it!

In case you run out of ideas to experiment; have a look at all the transactions which were
issued by the shell script to initialy populate the ledgers. It is in the Addendum Initialize the
ledgers.

When you’ve added some transactions then it might be interesting to go back to the Channels
tab at Detroit Auto. Suppose you added transactions on the samchannel; click on the
samchannel name. This will bring you to:

Page 47 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

You are actually now looking at a table which can show you all the content of a “block”. Click on
a row and scroll down:

Ever wondered why each block only holds one transaction???

Everything “next” is Optional. And actually you need to be a little bit of a techie  to
understand it.

Page 48 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Hit Login

On this page we are able to transfer vehicles and vehicle parts. In the previous query you found
that vehicle part abg1234 is owned by …. (on the screenshot it’s Citroen, in your instance it
might be different). Let’s transfer it to Sam Dealer. Please update the appropriate fields (and
select the right channel) in the form:

And click on Transfer vehicle part.

What is a Rich History Database


All transactions are within the Ledger. But what if you would like to do analytics on the
transactions. The simple answer is, execute chaincode which support you in retrieving
info/data from the ledger.

Page 51 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Actually this is done if you go into the Blockchain Console, into the Channels, into a specific
channel, into the ledger. You will go down to the blocks of the ledger and be able to analyze a
block:

However that is not convenient. The normal process for people who do analytics is that they
open their favorite Analytics tool (let’s assume Oracle Analytics Cloud); connect it to a database
or Data Warehouse and do whatever they need to do.

That is something completely different compared to chaincode. Two options; teach them
chaincode or get the data into a database (or data warehouse) and give them access to the
database.

The first one is probably dead-end-street, therefore the Oracle Blockchain Planform developers
went for the second. They enabled a connection between a peer on a channel and an Oracle
Data Warehouse. A Data Warehouse is bottom line a database … so we have the analytics
people happy again.

Let’s party and …….

Create an Autonomous Data Warehouse


On the Cloud Dashboard, you will find the Autonomous Data Warehouse tile (if not you can
customize your dashboard and make it visible):

Page 52 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Click on the hamburger menu in the lower right corner and select “Open Service Console”.

On the left select your compartment (not root!!!), the stat (Any State) and workload type
(ADW). Then click on Create Autonomous Database. After this, you will be enabled to enter the
details of your database in a (long) window. Here we discuss each part of the details:

We are going to use the database as a Autonomous Data Warehouse.

Page 53 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

The ADW will be created in the Comp_AtH compartment (in your case it will be different but
NEVER use the root compartment). It’s called CarDealer in the display and the actual database
name will also be CarDealer (you can choose whatever you like).

Since this is just for a workshop 1 core and 1 Tb will be (more) then sufficient.

Here you set the password for ADMIN. Choose whatever you think is appropriate as password;
maybe “Password4Cardealer” is good one 

Page 54 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

This will be different for all of us. Contact your Cloud Admin if you don’t know.

Press Create Autonomous Database

This will result in something similar to:

Watch the orange Icon. It is now provisioning and very soon it will become green:

And ready to be used.

Click on the DB Connection button:

Page 55 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

This windows holds a few pieces of information we need to have when we configure the Rich
History DB within the Blockchain. You will need to have Wallet (download it and remember
where you have put it  ).

When you download the Wallet you need to create a password for the wallet. Choose one
(maybe Password4Wallet is a good idea  )

You also need the TNS Name. Select the “LOW” TNS Name (CarDealer_LOW).

Now return to the Blockchain Console of Detroit Auto. In the upper right corner you will find a
hamburger menu. Click on it and select Configure Rich History.

Page 56 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

It will offer you to configure the Rich History Database (or better it’s settings):

Enter the data which is requested and upload the Wallet. Press Save. You will be informed of
the success 

Page 57 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Click on the X to close this window.

Now jump to the Channels tab and select the samchannel (this will be highlighted):

On the right of samchannel you see a hamburger menu. Click on it and select Configure Rich
History. This will bring you to:

Check Enable Rich History and press Save.

You have now created and configured the Rich History Database. Next step is ….

Page 58 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Add extra Transactions to the Ledger


There are already transactions in the ledger, however the Data Warehouse is empty. We need
to execute (extra) transactions which will create an even bigger Ledger and while these
transactions are executed OBP will make sure that they are also replicated to the Rich History
Database.

Sounds difficult … no it’s easy. Remember you had to initialize the Ledger with the car-dealer-
test-API.sh script (see Initialize the Ledger for the full details). You have to redo this, however
there is one change: do *NOT* use the script car-dealer-test-API.sh but use car-dealer-append-
parts-API.sh.
The procedure to execute is exactly the same as described in Initialize the Ledger only the name
of the script has changed.

Do it now!

When you have finished this, you can continue with …..

Create an Analytics Instance


The first step is getting access to Oracle Analytics Cloud:

Press Create Instance:

Page 59 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

DIY Chaincode
You have now discovered all the ins and outs of the Oracle Blockchain Platform. And it is very
likely that you have figured out the real tricks within a Hyperledger Fabric blockchain are
actually done within the chaincode. For real developers there’s no more fun that actually
writing your own chaincode.

However before you actually can write chaincode it is important that you understand the basic
concepts.
A good starting point for this is The Developers Guide which can be found at
https://www.oracle.com/webfolder/s/assets/ebook/developing-dapps-oracle-
blockchain/index.html

For a developer the fun starts at page 25 since the previous 24 pages were already discussed (in
more detail) in this document 

Writing Chaincode
It is way beyond the purpose of this workshop to make you a real chaincode programmer.
Nevertheless we like to help you getting started with setting up some groundwork. I assume
you have developer experience  but no Go Lang and Chaincode history.

Where to start? A few hints:

Hyperledger Fabric Documentation


Always a very good place to get knowledge. For developers checkout https://hyperledger-
fabric.readthedocs.io/en/latest/chaincode4ade.html

Writing Chaincode in Golang – the OOP way


From my point of view a great starting point is: https://codeburst.io/writing-chaincode-in-
golang-the-oop-way-4be3bb261dae
The funny thing about this one is that it’s about “cars”. Actually some sort of recognition while
reading this document should occur  LOL 

Hyperledger Fabric Go – Writing chaincode


An alternative is: https://github.com/hlf-go/writing-chaincode This is an excellent document for
your first steps in Go Lang and Hyperledger Fabric Chaincode.

OBP Documentation
You can also find background info within the Oracle Blockchain Platform documentation. Have
a look at https://docs.oracle.com/en/cloud/paas/blockchain-cloud/user/write-chaincode.htm

Finally
If you get stuck, you still have your friend El Goog and if you value your privacy; consider using a
Duck.

Success and have a lot of Fun!

Page 66 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Conclusion
In this workshop you have seen how to:

 Setup a Founder Organization


 Setup two Participants
 Create a Blockchain network with a founder and two participants
 Create channels
 Install and instantiate chaincode
 Execute chaincode from the command line (using curl)
 Execute chaincode using Postman
 Probably created a Rich History Database
 Probably did some simple analytics on the Rich History Database
 You might also may have set the first steps in Chaincode programming

Page 67 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Addendum: Everything you never wanted to know about the API


The API is a great way to interact with the Blockchain. The nature of the Hyperledger Fabric
Blockchain is an asynchronous world. Not all programmers are used to this, currently 99% of
the (computer) world goes synchronous.

So one of the tricks the API executes is transforming an asycrhonous world into a synchronous
world. Which is great, but, as for all things in life, there is a backside.

If the API sends a asynchronous request to the blockchain how long should it wait to get a
response. An API cannot except its client (or caller) to wait forever. Therefore configuration for
timing has been added. However it is still possible to

 do an API request;
 the API converts from synchronous to asynchronous;
 waits for a (little) while;
 but within the configured timeslot no response from the blockchain is received;
 send you an error.

In that case you get errors which are related to the gateway.

Example:

If you get errors like this, (in the first) check the transactons on the ledger , (for the second)
check your environment. Are all peers present, are all channels present etc.

To distinguish between a reel Gateway error and a (somesort of) fake one, needs experience.
Give it time.

Other example:

An invocation request returns 504 Gateway Time-out:

Page 68 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

If you get this error then you need to have a look at the content of the ledger. You will see, or
you might already know, that there is no separate Ledger tab, so where to look?
Remember where a ledger is attached to? Indeed every channel has a ledger. On the Founder,
or a participant who has access on the channel, goto the Channel tab; click on the appropriate
channel; make sure you have the Ledger view and walk through the blocks.

You can click on a block row which will show you the transaction ID (TxID), which you can
expand:

Can I do something about it? Yes you can. Remember that you had to configure the REST proxy
nodes:

Page 69 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

At the top you can configure, for each node, the proposal wait time and transaction wait time
(both in mSec).

Page 70 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Addendum: Managing Access to Blockchain Cloud Service


By default, the user who provisioned the blockchain organization is assigned every role within
the blockchain instance, i.e. they can do everything. However, most teams aren’t teams of one,
and you will need to grant access to other users. In order to do this, you will need to work with
your Oracle Cloud Identity Administrator.

From the Oracle Cloud ‘My Services’ page, navigate to the ‘Users’ section, then click the Identity
Console button. Both of these are found in the top right of the page:

From the Identity Console (which is Oracle Identity Cloud), navigate to the Applications page
from the sidebar by clicking the hamburger menu in the top left of the page.
Locate your blockchain instance in the list – it is of the form OABCSINST_<instance name>, then
click to open the details.

Navigate to the Application Roles tab, then click the hamburger menu for the role you wish to
manage, then assign or revoke access to users or groups of users as required.

The relevant roles for most use cases are BCS Administrator, which provides the ability to
manage the organization through the Blockchain Cloud Service console, and the
RESTPROXYn_User roles, which allow users to invoke chaincode that is exposed through the
REST Proxy.

See also the documentation at https://docs.oracle.com/en/cloud/paas/blockchain-


cloud/administer/set-users-and-application-roles.html#GUID-D699B305-8F77-43E8-9C76-
07E2B5CA9609

Page 71 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Addendum: Initialize the ledgers


An overview on how the ledgers where (more or less) initialized. You may have used different
channel and/or dealer names. You can easily use this to copy and paste content into Postman.

Create 5 parts for Sam Dealership

{"channel":"samchannel",
"chaincode":"carTrace",
"method":"initVehiclePart",
"args":["abg1234", "panama-parts", "1502688979", "airbag 2020", "DetroitAuto", "false",
"1502688979"],
"chaincodeVer":"v1"}

{"channel":"samchannel",
"chaincode":"carTrace",
"method":"initVehiclePart",
"args":["abg1235", "panama-parts", "1502688979", "airbag 4050", "DetroitAuto", "false",
"1502688979"],
"chaincodeVer":"v1"}

{"channel":"samchannel",
"chaincode":"carTrace",
"method":"initVehiclePart",
"args":["ser1236", "panama-parts", "1502688979", "seatbelt 10020", "DetroitAuto", "false",
"1502688979"],
"chaincodeVer":"v1"}

{"channel":"samchannel",
"chaincode":"carTrace",
"method":"initVehiclePart",
"args":["win1237", "panama-parts", "1502688979", "windshield auto201", "DetroitAuto",
"false", "1502688979"],
"chaincodeVer":"v1"}

{"channel":"samchannel",
"chaincode":"carTrace",
"method":"initVehiclePart",
"args":["bra1238", "bobs-bits", "1502688979", "brakepad 4200", "DetroitAuto", "false",
"1502688979"],
"chaincodeVer":"v1"}

Transfer parts to Sam from DetroitAuto

{"channel":"samchannel",
"chaincode":"carTrace",
"method":"transferVehiclePart","args":["bra1238", "DetroitAuto", "SamDealer"],
"chaincodeVer":"v1"}

Page 72 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

{"channel":"samchannel",
"chaincode":"carTrace",
"method":"transferVehiclePart","args":["win1237", "DetroitAuto", "SamDealer"],
"chaincodeVer":"v1"}

{"channel":"samchannel",
"chaincode":"carTrace",
"method":"transferVehiclePart","args":["ser1236", "DetroitAuto", "SamDealer"],
"chaincodeVer":"v1"}

Create 2 vehicles for Sam owned by DetroitAuto

{"channel":"samchannel",
"chaincode":"carTrace",
"method":"initVehicle",
"args":["dtrt10001", "DetroitAuto", "a coupe", "1502688979", "abg1235", "DetroitAuto",
"false", "1502688979"],
"chaincodeVer":"v1"}

{"channel":"samchannel",
"chaincode":"carTrace",
"method":"initVehicle",
"args":["dtrt10002", "DetroitAuto", "big pickup", "1502688979", "abg1234", "DetroitAuto",
"false", "1502688979"],
"chaincodeVer":"v1"}

Transfer the airbags to the vehicles

{"channel":"samchannel",
"chaincode":"carTrace",
"method":"transferPartToVehicle",
"args":["abg1235", "dtrt10001"],
"chaincodeVer":"v1"}

{"channel":"samchannel",
"chaincode":"carTrace",
"method":"transferPartToVehicle",
"args":["abg1234","dtrt10002"],
"chaincodeVer":"v1"}

Transfer the vehicles to Sam

{"channel":"samchannel",
"chaincode":"carTrace",
"method":"transferVehicle","args":["dtrt10001", "DetroitAuto", "SamDealer"],
"chaincodeVer":"v1"}

Page 73 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

{"channel":"samchannel",
"chaincode":"carTrace",
"method":"transferVehicle","args":["dtrt10002", "DetroitAuto", "SamDealer"],
"chaincodeVer":"v1"}

{"channel":"samchannel",
"chaincode":"carTrace",
"method":"queryVehiclePartByOwner","args":["SamDealer"],
"chaincodeVer":"v1"}

Create 5 parts for Jude Dealership

{"channel":"judechannel",
"chaincode":"carTrace",
"method":"initVehiclePart",
"args":["abg1239", "bobs-bits", "1502688979", "airbag w020", "DetroitAuto", "false",
"1502688979"],
"chaincodeVer":"v1"}

{"channel":"judechannel",
"chaincode":"carTrace",
"method":"initVehiclePart","args":["abg1240", "bobs-bits", "1502688979", "airbag w030",
"DetroitAuto", "false", "1502688979"],
"chaincodeVer":"v1"}

{"channel":"judechannel",
"chaincode":"carTrace",
"method":"initVehiclePart","args":["whl1241", "wizzard-auto", "1502688979", "wheel 28374",
"DetroitAuto", "false", "1502688979"],
"chaincodeVer":"v1"}

{"channel":"judechannel",
"chaincode":"carTrace",
"method":"initVehiclePart","args":["win1242", "panama-parts", "1502688979", "windshield
auto201", "DetroitAuto", "false", "1502688979"],
"chaincodeVer":"v1"}

{"channel":"judechannel",
"chaincode":"carTrace",
"method":"initVehiclePart","args":["sen1243", "wizzard-auto", "1502688979", "sensor p228",
"DetroitAuto", "false", "1502688979"],
"chaincodeVer":"v1"}

Page 74 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

Addendum: Direct Access to Rich History Database


If you consider yourself not a techie or you are a techie but have no clue with respect to
databases … skip this 

How do you verify the integration is working between Oracle Blockchain Platform and the
Autonomous Data Warehouse? SQL Developer Download, install and open SQL Developer.

Create a new connection and enter the necessary details:

Connection Name: <yourc_choice>


Username: ADMIN (in my case)
Password: <pwd associated to the username>
Connection Type: ‘Cloud Wallet’
Configuration File: <upload wallet file>
Service: <same service_name as you’ve entered in the Blockchain dialog>

Click Test to see if connection is working. If everything is OK, click Save.

On the main window, expand the new DB Connection:

Now, let’s have a look at what we’ve got from the Blockchain.

Expand the tables section and have a look at the available tables. (Maybe amongst others) in
your Autonomous Dataware House, you’ll find the ‘CarChannel’ related tables:

Enabling Rich History provides you with 3 tables with data from the Blockchain ledger:

Page 75 of 83
Car Dealer Workshop Version 8/11/2019 Arjan ten Hoopen

History table
This table contains ledger history. The data in this table tells you the chaincode ID, key used, if
the transaction was valid, the value assigned to the key, and so on.

State Table
This table contains data values replicated from the state database. You’ll query the state table
when you create analytics about the state of the ledger.

LatestHeight Table (Last)


This table is used internally by Oracle Blockchain Platform to track the block height recorded in
the rich history database. It determines how current the rich history database is and if all of the
chaincode transactions were recorded in the rich history database. You can’t query this
database for analytics.

Page 76 of 83

Das könnte Ihnen auch gefallen