Operations Procedure: demo1_sequence.sh

#!/bin/bash 
# This script contains a sequence of commands that run the software written for demonstration 1
# The demo has four players negotiating for stock swaps. A broker compares encrypted negotiation
# positions and finds any cases where an encrypted request for a swap matches an encrypted offer
# to swap stocks. All stocks are in the Dow Jones Industrial Average. The stock prices in the
# demonstration were current in May 2008 and do not reflect the current prices. 

# Here is the sequence of steps:

# 1. Write the negotiation positions and basic reports for all 4 players
./prepare_demo.sh

# 2. Tell players to begin negotiation by establishing a unique key for one-way encryption
# There is a different, unique key for each pair of players.
./demo1_establish_keys.sh

# 3. Tell each player to encrypt its negotiation position statements
./encrypt_positions.sh

# 4. Each party must now send the encrypted negotiation positions to the broker
./send_encrypted_positions.sh

# 5. Next, the broker compares the negotiation positions
python ./broker/compare_positions.py

# 6. Broker sends the encrypted basis for agreement statements back to the players
./return_encrypted_agreements.sh

# 7. The players must decrypt the agreements using the codebook they saved from the 
# encryption step. The following step causes all players to decrypt
python display_agreement.py ALL

# Before running the demo again with different parameters, use the following script to
# clean out the directories removing files from the previous session.

##./cleanup_demo.sh