Ticket scalping for popular events has been a problem even in the pre-Internet era; however, with the digital technology becoming ubiquitous, scalping looked like a solved problem for a brief moment—it made sense too, the tickets became digital and available through websites, and all one had to do was enter their credit card details online and click Buy.This brief period of fair distribution lasted mostly during the dawn of the Internet. What happened later and is still happening today is that the ticket scalping returned at a much grander scale—something that the pre-Internet speculators could only dream of.Today ticket scalping is run through automated scalping bots, there are even claims of insider scalping, and some well-known media like Pitchfork just putting it bluntly that scalping won’t go away.What this tutorial offers is a very basic CorDapp on the Corda blockchain platform to give an idea and a steer in the direction of how the scalping problem can be solved.In this tutorial you will:
Build a CorDapp.
Upload the CorDapp to your Corda nodes.
Connect to the nodes in shell and run the CorDapp.
Build and run a webserver that connects to your Corda node and interacts with the CorDapp.
This tutorial will guide you through building and deploying a CorDapp that immutably registers ticket distribution with ticket distributors.The ticket registration is done by running noScalpDapp on Corda nodes.What noScalpDapp does is it lets the nodes running it send each other mutually signed transactions with the event name and the number of tickets distributed. All verified by a notary.In this framework, one node equals one ticket distributor. A distributor can be anything you want and geographically located wherever. Since one distributor equals one node, it can be a node that only you own or it can be a community-owned node. The idea is that the initial ticket distributor—as there is always one originating source—must provably distribute the tickets to a number of nodes; these nodes can, in turn, redistribute the tickets to other nodes.
NAME — any event name that you are distributing the tickets to.
QUANTITY — the number of tickets you are distributing.
LEGAL_NAME — the legal name of the node you are distributing the tickets to. This cannot be the same node you are currently connected to. To get the node’s legal name, see View node access details.
The following example distributes 6000 tickets to the TOOL band show in Singapore to node ND-123-456-789:
Copy
>>> start noScalpFlow eventName: "TOOL Singapore show", ticketQuantity: 6000, toDistributor: "OU=Organization-ND-123-456-789, O=Organization, L=Singapore, C=SG"✓ Starting ✓ Generating transaction based on the distribution parameters. ✓ Verifying the distribution constraints. ✓ Signing transaction with our private key. ✓ Gathering the other distributor's signature. ✓ Collecting signatures from counterparties. ✓ Verifying collected signatures. ✓ Obtaining notary signature and recording the distribution transaction. Requesting signature by notary service Requesting signature by Notary service Validating response from Notary service ✓ Broadcasting transaction to participants▶︎ DoneFlow completed with result: SignedTransaction(id=AF8EE5E63678B00161EB0124AB46AFE1579584AAE558F5E8F1AA00A764597D8B)
Check the registered transaction on the node where you ran the transaction and on the node that received the transaction.To check the transaction:
Copy
run vaultQuery contractStateType: com.noScalpDapp.states.noScalpState
This will print the registered transaction details.Example:
Once you have your Corda network with noScalpDapp running, you can start a webserver to interact with the nodes.The webserver is a Spring Boot implementation.For a general webserver implementation, see Interaction tools: Using Spring Boot webserver.For this tutorial, the webserver implementation is in the clients directory of the CorDapp repository that you cloned at the start of the tutorial.Components:
To be able to connect to your Corda node, you must configure the webserver with the connection details.The webserver connection details are in clients/build.gradle under task runDistributor:
Connect to localhost:50005 in your browser. This will show the legal name of the node you are connected to and the Distribute tickets button.
Click Distribute tickets.
In the To distrubutor field, choose the node to distribute the tickets to. This will pick up all your peer nodes in your Corda network. Make sure that the node you select is also running the noScalpDapp.
Provide Ticket quantity and Event name.
Click Create distribution.
This will create and run the transaction.Refresh the page to see your distribution under Registered distributions.
The GET requests are defined via @GetMapping in MainController.kt.The POST requests are defined via @PostMapping in MainController.kt.A GET request example to see the legal name of the node the webserver is connected to:
This tutorial guided you through the basics of buildling and running a CorDapp.You connected to one of your nodes through shell. You ran a transaction between two nodes running the same CorDapp represented by a contract and a workflow JAR files uploaded on both nodes.You also built and ran a Spring Boot webserver. You interacted with the CorDapp through the webserver user interface and API.
Director of Developer Experience @ Chainstack Talk to me all things Web320 years in technology | 8+ years in Web3 full time years experienceTrusted advisor helping developers navigate the complexities of blockchain infrastructure