This CorDapp is an example of how Auctions can be performed in a decentralized manner. Auction can be Open to all or Private (accessible only to selected few parties).
More about this usecase here
Instructions for setting up
git clone https://github.com/vardan10/cordapp-auction.git
./gradlew deployNodes- building may take upto a minute (it's much quicker if you already have the Corda binaries).
At this point you will have a notary node running as well as three other nodes and their corresponding webservers. There should be 7 console windows in total. One for the notary and two for each of the three nodes. The nodes take about 20-30 seconds to finish booting up.
Using the CorDapp via the UI:
Using the CorDapp via the console:
- Start the Auction In PartyA Console type:
start StartAuction itemName: "test", ItemDescription: "test", startPrice: 99, ExpiryDate: "2018-11-16T08:25:25.510045Z", AuctionParticipants: "O=PartyB,L=New York,C=US"
- Get Linear Id of Auction In any Console (Party A,B or C) type:
run vaultQuery contractStateType: com.example.state.Auction
Above will output a auction LinearId
- Make A Bid In PartyB or PartyC Console type:
start MakeBid amount: 120, AuctionReference: "<LinearId>"
- End A Auction In PartyAConsole type:
start EndAuction AuctionReference: "<LinearId>"
Using the CorDapp via the HTTP API's:
- Create Auction:
curl -X PUT 'http://localhost:10009/api/auction/create-auction?itemName=test&ItemDescription=test&startPrice=99&ExpiryDate=2018-11-16T08:25:25.510045Z&AuctionParticipants=O=PartyB,L=New%20York,C=US'
- List Auctions:
curl -X GET 'http://localhost:10009/api/auction/auctions'
- Make Bid:
curl -X PUT 'http://localhost:10012/api/auction/make-bid?amount=120&AuctionReference=<LINEAR_ID>'
- End Auction:
curl -X PUT 'http://localhost:10009/api/auction/end-auction?AuctionReference=<LINEAR_ID>'