Recourse Allocation In P2P Framework Yoni Peleg Outline Resource Allocation Cryptographic Graph Theory Open subjects • Previous and current work on resource allocation in MAS. • P2P Framework, Multi-Hop Cellular Networks: – Overview & Motivation – Problems in these models – Resource Allocation in these models • Solving the difficulties with: – Cryptographic methods – Random graph theory Resource Allocation Overview Resource Allocation Cryptographic Graph Theory Open subjects • Allowing an agent to use other agents’ resources in order to complete its task. • Works in resource allocation can be divided into 2 main areas: – Economical (Marketplace) – Matching Economics Resource Allocation Resource Allocation Cryptographic Graph Theory Open subjects • Assumes a central marketplace (usually doesn’t refer to its implementation). • Sellers and buyers meet in the marketplace in order to trade resources. • Solves questions about the price of the resources: – Will an equilibrium be reached? – How long does it take to reach the equilibrium? – What is the price of the resources in the equilibrium point? Economics Resource Allocation (cont.) Resource Allocation Cryptographic Graph Theory Open subjects • A lot of sellers (easy to find an agent with an available resource). • All the available resources are identical. Market Place Matching Resources Resource Allocation Cryptographic Graph Theory Open subjects • Resources are rare – Only a few agents have resources to share. • Resources are not necessarily identical – For example, using the resource of a closer agent might be preferable due to communication costs. • Cooperative / Non-Cooperative Environments – Agents might not share their resource for free. • Task: Match a supplier to each consumer. The Contact Net Resource Allocation Cryptographic Graph Theory Open subjects • A fundamental work in resource allocation: – Each consumer starts an auction for a resource. – All suppliers participate in the auction. – The consumer chooses the best possible offer. • Big disadvantage: Using broadcast. Task Announcement Manager Centralized Match-Mark Resource Allocation Cryptographic Graph Theory Open subjects • We’ll have a special new agent (a matchmark) that will: – Hold a list of all consumers / suppliers (will get a message from the other agents anytime they supply / need a resource). – Match appropriate <consumer, supplier> couples. • Disadvantages: – Hot Spot – Inefficient (not scalable for systems with a big number of agents) Distributed Match-Mark Resource Allocation Cryptographic Graph Theory Open subjects • The (suppliers, consumers) list is distributed between many agents. • Each agent can also be a matchmark. Distributed Match-Mark – lower bounds Resource Allocation Cryptographic Graph Theory Open subjects • Lower bound is known if the matchmarks can’t pass information between each other: – One match-mark that is familiar with O( ) agents exists. – An agent that is familiar with O( ) matchmarks exists. • Can be improved to O( ) if the max distance in a graph between a supplier and a consumer is k. • Can we do better by allowing matchmarks to pass information between each other? P2P Framework properties Resource Allocation Cryptographic Graph Theory Open subjects • Symmetric – All the agents have the same contribution to the matching process. • Distributed Control – The control of the system is distributed between all the agents. – System is more robust, no hot spot. P2P Framework properties (cont.) Resource Allocation Cryptographic Graph Theory Open subjects • Simple agents. • Each agent has connections only to a constant number of other agents. Algorithm For A Cooperative Environment Resource Allocation Cryptographic Graph Theory Open subjects • Parameters: – TTL – How deep in the network the message will arrive. – TimeOut – How long to wait for a response. – d – To how many neighbors to send a message when searching for a resource. Algorithm For A Cooperative Environment Resource Allocation Cryptographic Graph Theory Open subjects • Algorithm (Vanzin 2006): – When an agent ‘a’ needs a resource, it sends a message to d of its neighbors. ‘a’ attaches to the message the TTL parameter. – Each agent that receives the message, reduces 1 from the TTL parameter, and passes the message forward (with the new TTL). Algorithm For A Cooperative Environment Resource Allocation Cryptographic Graph Theory Open subjects • Algorithm (Vanzin 2006): – An agent that can supply the resource will contact ‘a’ directly. – Stop passing the message when TTL reach 0. – If ‘a’ didn’t receive a resource by TimeOut it sends another request with a bigger TTL / d. Algorithm For A Cooperative Environment Resource Allocation Cryptographic Graph Theory Open subjects TTL = 3 d=2 s t Algorithm For A Cooperative Environment Resource Allocation Cryptographic Graph Theory Open subjects TTL = 32 d=2 s t Algorithm For A Cooperative Environment Resource Allocation Cryptographic Graph Theory Open subjects TTL = 321 d=2 s t Algorithm For A Cooperative Environment Resource Allocation TTL = 3210 Cryptographic Graph Theory Open subjects Algorithm Failed! d=2 s t Algorithm For A Cooperative Environment Resource Allocation Cryptographic Graph Theory Open subjects • Analysis of the algorithm (Vanzin 2006): – If d=1 • Random walk • Will find the resource in O(log(n)) (average case) • Long time to find a resource – d is large • Find the resource in shorter time • Big message complexity Non-Cooperative Environment Resource Allocation Cryptographic Graph Theory Open subjects • We’ll assume that agents only care about increasing their personal utility – We’ll ignore attacks like “denial of service” that only try to hurt the system. • We’ll have to pay an agent in order to use its resource – Auctions (like in the CNET). • We’ll have to pay other agents if we want them to pass our ‘seek for resource’ message. Difficulties In Non-Cooperative Environment Resource Allocation Cryptographic Graph Theory Open subjects • An agent may try to: – Get paid without passing a message. – Avoid paying other agents that pass its message. – Block bids of distant-agents • “Man in the middle” attack – Get paid for passing messages to a DECOY agent. – Register many copies of itself to the system. – Whitewash Multi Hop Cellular Phone Network Resource Allocation Cryptographic Graph Theory Open subjects • Regular cellular phone: – All calls are transferred through a central location. Multi Hop Cellular Phone Network Resource Allocation Cryptographic Graph Theory Open subjects • A possible problem in case of multiple calls in a small area. • Also relevant to sensors communications. Multi Hop Cellular Phone Network Resource Allocation Cryptographic Graph Theory Open subjects • An alternative: the calls will be routed by the cell-phones themselves. T S Difficulties Resource Allocation Cryptographic Graph Theory Open subjects • Problem: keeping the cell-phone on and passing other users messages costs money (battery). • The greedy user may keep his cell-phone off, and just take advantage of other users for passing his messages (free ride). Non-Economic Solutions Resource Allocation Cryptographic Graph Theory Open subjects • Hardware Solution: – Add hardware (like an OTP) to the cell-phones that will transfer the messages. – Home users can’t change the hardware (criminal organizations might be able to do so). – Task: the hardware should be as simple as possible. – Won’t work in a general P2P framework. Non-Economic Solutions Resource Allocation Cryptographic Graph Theory Open subjects • Repetitive solution: – Assume that any cell-phone can “listen” to the outgoing messages of the cell-phones close to it • Can’t understand the content of the message • Can tell if a message was sent – No user has incentive to send “fake” messages • They also cost buttery power – If a user didn’t forward your message – punish it in the future. – Doesn’t fit a general P2P model. Economic Solutions Resource Allocation Cryptographic Graph Theory Open subjects • Central Bank Solution (CBS): – A trusted (centralized) third party – All the agents have its public key • All the agents can verify that the bank has ‘signed’ a message Economic Solutions (CBS) Resource Allocation Cryptographic Graph Theory Open subjects • Naïve algorithm: – The consumer connects to the bank, and sends it the search message. – The bank signs this message and charges the consumer. – Any agent in the path: • Checks that the message is legitimate (the signature on the message is valid). • Send the bank a ‘receipt’ – a proof that it got the message (cryptographic hash signature), and the names of the previous and the next agents in the search path. Economic Solutions (CBS) Resource Allocation Cryptographic Graph Theory Open subjects • Naïve algorithm (cont.): – The bank will pay both the agent that sends the confirmation and the agents previous and after it in the search path. • This way, each agent will have incentive both to pass the message forward and to send the receipt. • Also, the bank can track the path and check that it’s legitimate. Economic Solutions (CBS) Resource Allocation Cryptographic Graph Theory Open subjects • Problem of the naïve algorithm: the entire control of the message distribution process passes through the bank – Back to centralized recourse allocation Economic Solutions (Sprite, Zhong 2003) Resource Allocation Cryptographic Graph Theory Open subjects • Possible distributed algorithm? – We can let the last agent on each search path serve as the bank. – It has no incentive to lie (it’ll only take money from the consumer and give it to the agents in the path). • Big problems: – Coalitions – Fake identities Micro-payment Scheme (Jakobsson 2003) Resource Allocation Cryptographic Graph Theory Open subjects • Use lottery tickets – When entering the system, each agent gets from the bank a secret personal random-number. – There exists a global function F: N X N -> {0,1} (known to all the agents in the system) that represents the lottery ticket. • The function returns ‘1’ (a win) with probability ‘p’ (parameter we can choose). • Cryptographic hash function Micro-payment Scheme (Jakobsson 2003) Resource Allocation Cryptographic Graph Theory Open subjects • Use lottery tickets (cont.) – The consumer sends the central bank the message it wants to distributes. – The bank charges the consumer for the distribution, adds to the message a random number and signs it. – Each middle-agent checks ‘F’ with the random number and its personal key to see if it has won. Micro-payment Scheme (Jakobsson 2003) Resource Allocation Cryptographic Graph Theory Open subjects • Use lottery tickets (cont.) – An agent connects to the central bank only if it won • In that case, also the previous agent and the next agents in the search path get paid. – Winning is rare (probability ‘p’) • The central bank is connected only at the beginning of a lookup for a resource and in a winning case. Micro-payment Scheme (Jakobsson 2003) Resource Allocation Cryptographic Graph Theory Open subjects • Use lottery tickets (cont.) – Agent has incentive to pass forward messages even if it didn’t win • The next agent might win and then it’ll get paid. – Possible attack: lie about the previous / next agent’s identity – can be solved with statistical methods. The “middle man” attack problem Resource Allocation Cryptographic Graph Theory Open subjects • Two different scenarios: – Regular P2P Framework: • An agent that wants to participate in the auction, may avoid forwarding the auction message to other agents in order to increase its probability of winning. – it’ll loose the payment for forwarding the bid. • An agent might publish “a bid” of its own in order to check what the other agents offer – cost money. The “middle man” attack problem Resource Allocation Cryptographic Graph Theory Open subjects • Two different scenarios (cont.): – Multi-hop cellular phones framework • A distant agent may not be able to connect to the manager of the auction directly. • A middle agent can decide to avoid passing a bid only if it’s a better offer than its own bid. – it’ll loose the payment for passing the bid. – The value of the bid can be sealed from the middle-agent using cryptographic methods. The “middle man” attack problem Resource Allocation Cryptographic Graph Theory Open subjects • Regular P2P framework Hi, my name is 32.13.1.6 and I’m looking for a resource X 32.13.1.6 56.91.0.1 22.2.8.3 The “middle man” attack problem Resource Allocation Cryptographic Graph Theory Open subjects Hi, my name is 56.91.0.1 and I’m looking for a resource X 56.91.0.1 32.13.1.6 22.2.8.3 The “middle man” attack problem Resource Allocation Cryptographic Graph Theory Open subjects I better bid bellow 900NIS 56.91.0.1 Resource X For 900 NIS From 22.2.8.3 32.13.1.6 22.2.8.3 The “middle man” attack problem Resource Allocation Cryptographic Graph Theory Open subjects Resource X For 899 NIS From 56.91.0.1 56.91.0.1 32.13.1.6 22.2.8.3 The “middle man” attack problem Resource Allocation Cryptographic Graph Theory Open subjects • The solution: – Look at the following network: Bob – All the agents want to participate in the auction. Avi – Bob and Cain need to choose (independently) whether to follow the protocol and pass David messages. David Cain The “middle man” attack problem Resource Allocation Cryptographic Graph Theory Open subjects • The solution: – Can be viewed as the following game table: Bob Cain Cooperate (follow the protocol) Bob Avi David Cain Defect (block David) Cooperate (follow the protocol) Defect (block David) x/3 y+x/3 y+x/3 y+x/3 0.5x y+x/3 x/3 0.5x x – payment if winning the auction y – payment for following the protocol The “middle man” attack problem Resource Allocation Cryptographic Graph Theory Open subjects • The game has two Nash equilibriums – Cooperate-Cooperate and Defect-Defect. • If there are k paths from David to Avi, it’s enough that the agents in one path cooperate to cause all the agents that defected to loose the game. • If an agent doesn’t participate in the auction, it has a dominate strategy to cooperate. The “middle man” attack problem Resource Allocation Cryptographic Graph Theory Open subjects • A reminder: d is the parameter that represents the number of neighbors each agent forward the auction message to • We would like to analyze the influence of the parameter d on the probability that there won’t be a single agent that appears in all the paths between two random agents. Uniform Model Resource Allocation Cryptographic Graph Theory Open subjects • The probability space: – A graph with n nodes, each node represents an agent. – Each vertex has d outgoing-edges (Gd-out graph). – The edges are drawn uniformly. • Reasonable model for P2P frameworks (for example – BitTorrent). • The following calculations will be done for d=3. Analysis Of The Uniform Model Resource Allocation Cryptographic Graph Theory Open subjects • What is the expected number of edges that enter the target agent? Probability that a random edge will enter the target vertex: 1 n 1 Probability that all the d edges don’t enter the d 1 target vertex: 1 n 1 Analysis Of The Uniform Model Resource Allocation Cryptographic Graph Theory Open subjects • What is the expected number of edges that enter the target agent? Probability that a vertex has an outgoing edge to d the target vertex: 1 1 1 n 1 Expected number of edges that will enter the target vertex: d d2 1 d O d n 1 1 1 n 1 1 1 2 n 1 n 1 n 1 Analysis Of The Uniform Model Resource Allocation Cryptographic Graph Theory Open subjects • Assume that we know the number of vertexes with distance of up do j from t: s t • What is the expected number of vertexes of distance j+1 from t? Analysis Of The Uniform Model Resource Allocation Cryptographic Graph Theory Open subjects • Assume that we know the number of vertexes with distance of up do j from t, What is the expected number of vertexes of distance j+1 from t? s X– #Distance t j+1 Y– #Distance j Z - #Distance less than j Analysis Of The Uniform Model Resource Allocation Cryptographic Graph Theory Open subjects Probability that a vertex has an outgoing edge to d a vertex in Y: Y 1 1 n Z Expected value of X: d Y n Y Z 1 1 nZ X – #dist j+1, Y – #dist j, Z – #dist<j Analysis Of The Uniform Model Resource Allocation Cryptographic Graph Theory Open subjects • We would like to see until what stage we can expect the number of vertexes of distance j to be at least twice the number of vertexes of distance j-1. Analysis Of The Uniform Model Resource Allocation Cryptographic Graph Theory Open subjects Lemma: Let {T1,T2,…,Tn} be a sequence of numbers such that for each i, Ti>1.5*Ti-1. Then: i 1 2i n : 2Ti T j j 1 Proof: By induction. i 2 2Ti 2*1.5* Ti 1 Ti 1 2Ti 1 Ti 1 T j j 1 Analysis Of The Uniform Model Resource Allocation Cryptographic Graph Theory Open subjects If we assume that in each step the number of vertexes of distance j is at least 1.5 times the number of vertexes of distance j+1 we’ll get that: 1 Z 1.5Y Thus by our assumption the expected value of X: Y 3 E X n 3Y 1 1 n X – #dist j+1, Y – #dist j, Z – #dist<j Analysis Of The Uniform Model Resource Allocation Cryptographic Graph Theory Open subjects • What is the probability that the number of vertexes doesn’t multiply by 1.5 (at least)? Chernoff bound (for Y=O(n)): Pr X 1.5Y e Y 48 For small Y the situation is less promising – 5% of the vertexes in the graph don’t have incoming edges! Still we can get reasonable results using the fact that Y is an integer. Analysis Of The Uniform Model Resource Allocation Cryptographic Graph Theory Open subjects • Conclusions: – if the number of vertexes of distance j from t is smaller than 0.1n then the number of vertexes of distance j+1 from t is at least 1.5 times the previous distance (with very high probability). – Best strategy for d=3 is TTL=log(0.1n). Analysis Of The Uniform Model Resource Allocation Cryptographic Graph Theory Open subjects • Conclusions (cont.): – Choosing TTL=log(0.1n)+2 will promise (with good probability) that no agent will be placed on all the paths between s to a random vertex t. – We can repeat the calculations for other values of d and their appropriate TTL. – Solution is robust against coalitions with constant size. • Results are supported by simulations Non Uniform Model Resource Allocation Cryptographic Graph Theory Open subjects • The probability space: – A graph with n nodes, each node represents an agent. – Agents are located uniformly on L X L square • L – a parameter. – Each vertex has d outgoing-edges (Gd-out graph). Non Uniform Model Resource Allocation Cryptographic Graph Theory Open subjects • The probability space (cont.): – Edge between vertexes u and v is drawn with probability: e dist u ,v Pr u, v E – Where: dist u ,v X u X v 2 D Yu Yv 2 ,D e distu ,v vV • Reasonable model for cellular phones network (in reality – using different parameters). Non Uniform Model Resource Allocation Cryptographic Graph Theory Open subjects • In order to reach all the vertexes in a search we need to set TTL=O(n) in worst case. … • Turns out that this also holds for our uniform model… Non Uniform Model Resource Allocation Cryptographic Graph Theory Open subjects • First, bound E(D): – Get maximum when an agent is located in the middle of the square, and minimum on the edge. • With high probability: 0.6n D n • Next, we would like to calculate the probability of a connection between vertexes s and t that goes through TTL vertexes. dist u ,v X u X v 2 Yu Yv 2 ,D e distu ,v vV Non Uniform Model Resource Allocation Cryptographic Graph Theory Open subjects • Draw rectangles around the straight line between s and t. s t • Since the probability for an edge drops exponentially, consider only paths from ‘s’ through vertexes inside the rectangles to ‘t’. dist u ,v X u X v 2 Yu Yv 2 ,D e distu ,v vV Non Uniform Model Resource Allocation Cryptographic Graph Theory Open subjects • Calculate the probability by: – Calculate the expected number of vertexes in each rectangle. – Calculate the probability for a path to any of the vertexes in the rectangle. • Problem: miss paths: s t dist u ,v X u X v 2 Yu Yv 2 ,D e distu ,v vV Open Subjects Resource Allocation Cryptographic Graph Theory Open subjects • Correct the analysis of the non-uniform model – Try to use circles that represent the error rate instead of rectangles. • Formalize the robustness of the model against random coalitions. • Gather formal simulation results. • Try to deal with the ability of an agent to conduct an auction for predicting the current best offer.