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
git clone https://github.com/vardan10/cordapp-auction.git
cd cordapp-auction
./gradlew deployNodes
- building may take upto a minute (it's much quicker if you already have the Corda binaries)../kotlin-source/build/nodes/runnodes
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.
- PartyA:
localhost:10009/web/example/
- PartyB:
localhost:10012/web/example/
- PartyC:
localhost:10015/web/example/
- 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>"
- 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>'
Unit Tests
Please Feel free to submit PR's with any Upgrade/Modification.