text:
\section{Introduction}
A smart contract is a set of promises in the form of a computer program that executes securely on the blockchain and enforces the terms of the agreement among parties. This autonomous execution eliminates the need to trust and depend on the other party through reputation or by making promises which have little value in a cybercrime environment. Furthermore, the anonymity of transactions is guaranteed, and there is no need for parties to reveal their identities. In the criminal context, these characteristics of smart contracts are appealing and help to ensure that parties meet their expectations out of the deal once they agree on the terms. Cyber-attacks are continuously developing with the latest technologies. Moreover, several studies showed that it is possible to cause more devastating impacts by employing collaborative attacks \cite{vogt2007army, xu2008collaborative, vogt2006attack}, and some massive, sophisticated cyber-attacks with the collaboration of multiple parties have been reported \cite{enisa, computerweekly, DarkReading, nazario2009politically, jakobsson2012death}.

Juel et al. introduced the concept of Criminal Smart Contracts (CSC) and explored
the feasibility of abusing smart contracts for various types of crimes \cite{juels2016ring}. Since then, several studies have proposed new attacks implemented by CSCs \cite{kothapallibribery, chen2018game, velner2017smart, mccorry2018smart, judmayerpay, delgado2020blockchain}, or investigated solutions to overcome such attacks \cite{wang2019randomness, zhang2019game, marino2016setting}. These attacks target the blockchain network or are performed by a single attacker. However, launching a CSC-based collaborative attack that targets the real-world has two major challenges. Firstly, due to privacy
concerns, attackers cannot provide proof of their relative contribution to the CSC.
Secondly, the anonymity of blockchains' users leads to incomplete information about
the attackers.

In this paper, we propose and analyze the feasibility of collaborative attacks
in the real-world using CSCs as an intermediary among the attack-sponsor and the
attackers. In these attacks, the attack-sponsor, as a smart contract designer, does his best
to devise a mechanism that leads to a successful attack. In other words, he aims to
design a cheat-proof trading protocol that not only leads to a predictable and adoptable
attack-result but also considers the required conditions and awards to encourage the
participation of rational attackers. On the other side, from the attacker's point of view,
individual rationality and fair allocation of the award are expected, in proportion to
their effort. To study the feasibility of this idea, we study the case of a collaborative
denial of service (DDoS) attack using a CSC.

The major contributions of this paper can be summarized as follows:
\begin{itemize}
\item We present an architecture for real-world collaborative attacks based on
smart contracts.
\item We propose a CSC for the case of a collaborative DDoS attack.
\item We formulate the attackers' interaction as an incomplete information
game and prove that it has a unique dominant strategy equilibrium.
\item We model the proposed CSC as an incentive mechanism and prove that it
is a strategy-proof and budget-balanced mechanism.
\item Through numerical simulations, we demonstrate that the proposed
incentive mechanism provides individual rationality and fairness to the
collaborator attackers in its equilibrium.
\end{itemize}
The rest of this paper is organized as follows:

Section \ref{sec2} presents the studies related to our work. In Section \ref{sec3}, we discuss the attack
model. The game model and equilibrium analysis are discussed in Section \ref{sec4}. Section \ref{sec5}
explains the mechanism model and includes proofs of desired properties. The numerical
analysis is investigated in Section \ref{sec6}, and finally, Section \ref{sec7} concludes the paper.

\section{Related Work and Motivation}
\label{sec2}
Previous studies related to this paper can be categorized into three groups: criminal
smart contracts, collaborative attacks, and game and mechanism design for security. In
what follows, first, we address the current literature on CSCs. Then we consider the
motivation behind the collaborative attacks. Finally, we discuss the use of game theory
and mechanism design for security.

\subsection {Criminal Smart Contracts}
In \cite{juels2016ring}, Juel et al. were the first that introduced the concept of CSCs and argued that
a primary challenge criminals face in the construction of CSCs is that for a given crime,
a feasible CSC is commission-fair, meaning that neither the sponsor nor the perpetrator
of the crime can cheat. They demonstrated that CSCs for leakage of secrets and theft of
cryptographic keys are efficiently realizable. Besides, they showed that authenticated
data feeds\footnote[1]{The data provided by oracle outside the smart contract.} could facilitate CSCs for real-world crimes such as murder, arson, and DDoS
attacks. They provided the implementation of the CSCs as a proof of concept. Proposed CSCs by \cite{juels2016ring} reward the criminals for launching some real-world attacks (e.g., theft and murder).

Similarly, in this paper, we discuss a real-world DDoS attack in which the CSC acts only as an intermediary among the attack-sponsor and the attackers. Unlike \cite{juels2016ring}, we explore attacks that are carried out by several attackers (without any acquaintance or trust among them) who are jointly collaborating.

A detailed discussion of possible uses of smart contracts in the realm of cybercrime and how it be a substitute for trust is presented in \cite{brunoni2017smart}. Moreover, in \cite{o2017smart}, the author emphasized that during a coordinated criminal activity, an agreement that needs trust and involves taking risks can be substituted by smart contracts. Thus, collaboration becomes easier, less risky, and more common \cite{o2017smart}. In all of the mentioned studies, the
authors identified CSCs as an open research question, and future research should focus
on it.

Kothapalli et al. \cite{kothapallibribery} proposed the first detailed study of bribery implementation on
the blockchain, where the sponsor offers incentives to the bribee through a smart
contract. Besides, they used a system of incentives/disincentives to incentivize both
parties and showed that they all get their expected value.

Chen et al. \cite{chen2018game} modeled a bribery contract as a game implemented on the CSC in which
the sponsor tries to manipulate the result of another smart Contract's execution by
bribing users. They considered a situation where a bribee may establish multiple
criminal smart contracts with sponsors and strategically chooses the best. This game
ends up in competition between sponsors such that in any Nash equilibrium, a sponsor
cannot win the majority of the votes unless he/she controls more than 2
bribing budgets.

Velner et al. \cite{velner2017smart} presented an attack against mining pools implemented by a CSC that
rewards pool miners who withhold blocks. They showed that an adversary with a tiny
amount of computing power could execute this attack and, in theory, destroy all big
mining pools. In their attack, CSC works as insurance to guarantee the attackers'
payment, and therefore attackers need neither trust the sponsor's intentions nor his
ability to pay. McCorry et al. \cite{mccorry2018smart} proposes three smart contracts in which the sponsor bribes miners to pursue a mining strategy benefiting him.

Judmayer et al. \cite{judmayerpay} systematically analyzed and categorized bribing attacks. Bribing
attacks target incentive compatibility in the permission-less proof-of-work
cryptocurrencies, and assume that at least some miners act rationally, i.e., they accept
bribes to maximize their profit. Using CSCs, they propose two new, much cheaper
bribing attacks. The attacks are trustless for both parties and rely on out-of-band
payments thorough a different cryptocurrency that must support smart contracts.

In all of the mentioned bribery attacks, although multiple attackers launch these
attacks, their target is the blockchain and cryptocurrency network, so attackers can
individually provide proof of contribution to the CSC. However, when the attack target
is in the real world, the only way to communicate with the CSC such that it is neutral
to the attackers' interests is authenticated data feed. Note that in a criminal context, due
to anonymity concerns, it is not easy to determine or prove the extent of attackers'
involvement.

More recently, Delgado-Mohatar et al. \cite{delgado2020blockchain} proposed the first blockchain-based ransomware
schemes. In this attack, CSC enables new capabilities for ransomware (e.g., paying for
individual files or reimbursing the victim). They also discuss that once it is
implemented in a public blockchain, there is no feasible countermeasure.

Furthermore, some studies have been conducted to develop countermeasures against
CSCs. \cite{wang2019randomness} examined one of the proposed CSCs in \cite{juels2016ring} and showed that randomness might reduce its power. Zhang et al. \cite{zhang2019game} investigated the effect of data feeds on the validity of CSCs. They analyzed CSCs as state-based games and utilized Q-Learning to train data feeds' parameters so that the probability of reaching the criminal's desirable state decreases. Herlihy et al. \cite{herlihy2016blockchains} mentioned that it might be possible to offer rewards for more serious crimes, and removing the CSCs from the blockchain by a trusted authority would be a countermeasure. Marino et al. \cite{marino2016setting} discussed the different possibilities for altering or undoing smart contracts but always from a legal perspective and with the contract owner's permission.

\subsection{Collaborative Attacks}

In the cybersecurity literature, it is often assumed that there is one attacker in the
system, or a single attacker is controlling a set of compromised participants (e.g., botnet) \cite{xu2008collaborative}. However, this assumption does not always hold, since cyber-criminal
organizations (with different expertise) might be motivated to launch collaborative
attacks. Cybercriminals have collaborated in the past on malware and massive DDoS attacks \cite{enisa, computerweekly, DarkReading, nazario2009politically, jakobsson2012death}. Attackers trade goods, services, and money through the phishing marketplace and even advertise their demands \cite{abad2005economy}. Moreover, in the open market, botnets can be rented for spam campaigns and distributed denial of service
(DDoS) attacks \cite{networkworld}. This evidence of interconnected networks and collaboration
suggests a major in how threat actors work together in the underground market.

There are a few studies that have been undertaken to assess collaborative attacks. In \cite{zhou2010survey}, the authors briefly discussed large-scale coordinated attacks such as stealthy scans, worms, and DDoS attacks and highlighted challenges in detecting them. Xu \cite{xu2008collaborative} carried out an in-depth survey of collaborative attacks and collaborative defenses. He presented a framework for evaluating their effectiveness and characterizing them from the relevant perspectives. Emphasizing the need to consider collaborative attacks as a significant threat, Xu envisioned the need to defend collaborative attacks with collaborative defense.

Super-botnets are networks of many independent and small botnets that can be
coordinated for attacks. In comparison with large traditional botnets, they would be
versatile and resistant to countermeasures and more beneficial for adversaries \cite{vogt2007army,dagon2007taxonomy}.
Vogt et al. \cite{vogt2007army} studied the feasibility and structure of super-botnets through simulation and
explored new forms of attack that super-botnets can launch. Dagon et al. \cite{dagon2007taxonomy} proposed
a taxonomy of botnets based on their utility to the bot-master and their topological
structures. By using both simulation and real-world botnet experiments, their analysis
showed that random network models give botnets considerable resilience and classified
super-botnets as a special case of them \cite{dagon2007taxonomy}.

In this paper, we explore attacks that are carried out by several attackers (without
any acquaintance  or trust among them) who are jointly collaborating. We consider the
feasibility of collaborative attacks in the real-world using CSCs. To this end, we study the case of a collaborative DDoS attack.

\subsection{Game and Mechanism Design for Security}

Mechanism design is the science of defining rules through which individuals
interact, with respect to the desired outcome of the game induced by those rules. In other words, the designer defines a protocol with economic incentives in order to encourage users to participate and follow the protocol and hence preserve specific desired properties of the protocol \cite{phelps2010evolutionary}. A smart contract designer has the responsibility of designing a cheat-proof smart contract that aligns the individual interests with the designer's overall interests to achieve incentive compatibility \cite{wang2019blockchain}. Hence, before a smart contract is deployed onto the blockchain, by considering incentives and private information, its designer should ensure that his mechanism satisfies the required properties for a mechanism to function properly \cite{wang2019blockchain}, \cite{paul2020smart}.

In the context of CSCs, the attack-sponsor designs an incentive mechanism through the terms of a smart contract and deploys it on the blockchain. Depositing the attack
reward in the contract account, he incentivizes attackers' contributions, and after that,
the CSC performs all of the financial transactions.

Game-theory has been considered as a powerful tool for modeling and analyzing
behaviors of attackers and defenders in a broad range of security applications. Although
sophisticated cyber-attacks are usually launched by multiple parties \cite{xu2008collaborative}, most securitygames simplify all malicious agents as a single metaphorical "attacker" player \cite{merlevede2015game}.
Further, those few studies that have regarded multiple strategic attackers still have not
explicitly considered potential collaboration and interdependencies between them. This
abstraction is often justified owing to the vague and limited information of the attackers'
preferences \cite{merlevede2015game}. Thus, proper modeling of strategic adversaries in interdependent security games has been relatively unexplored in the literature \cite{laszka2014survey, merlevede2015game}.

Fultz et al. \cite{fultz2008distributed} developed a two-sided security game model of homogeneous strategic
attackers and defenders in which the attackers attempt to deny service, and the
defenders attempt to protect against the attacks. He showed that as the number of
attackers increase, attackers begin to suffer coordination problem just like defenders.
In addition, he argued that due to lack of coordination, the attackers eventually overattack, and this is costly for both sides, attackers, and defenders. In \cite{fultz2009blue}, Fultz et al.
extended their study and showed that its beneficial for attackers to pool their resources
on coordinated attacks rather than attacking independently, and future attackers would
rely on coordination media to attack simultaneously rather than autonomous agents.

In this paper, we discuss the feasibility of collaborative attacks in the
real-world, using CSCs. First, we propose a CSC for this attack. Then, to predict the
outcome of the attack and the parameters affecting it, we model the interaction among
the attackers as a static incomplete information game. Attackers are players who decide
on their relative contributions to the attack, and they do not have information about the
amount of contribution of other attackers. Next, we verify that the proposed CSC is
commission-fair (i.e., neither the sponsor nor the perpetrator of the crime can cheat),
and the incentive mechanism satisfies the necessary constraints to function (namely
individual rationality and incentive compatibility while ensuring budget balance). In
our attack, not only the smart contract reduces the need for trust, but it acts as a
participation incentive mechanism.

\section{Attack Model}
\label{sec3}
In this section, a high-level overview of the attack model and its general assumptions
are provided. We also give an example of performing a distributed denial of service
attack using this model to describe the system in detail.

The attack model is composed of three phases. In the first phase, an attack-sponsor
creates a CSC and publishes it on the Ethereum blockchain\footnote[2]{It must be noted that blockchain networks, other than Ethereum, can also facilitate the creation and hosting
	of smart contracts, including CSCs.} to establish the attack
coordination. For example, the sponsor specifies the attack duration and the criteria on
which it bases his evaluation of a successful attack. Moreover, the smart contract
requires both the attack-sponsor and the attackers to place a deposit into CSC's account.
More specifically, the attack-sponsor deposits an award, and the attackers make bets on
the success of the attack, which they risk losing if the attack-result is ultimately judged
to be unsuccessful according to the criteria mentioned in the CSC.

The second phase is the attack phase, in which the attackers launch the attack in
order to satisfy the predefined conditions of a successful attack and get the reward
promised in the CSC. In the third phase, after the specified attack duration is passed,
the CSC requests attack-result through an oracle service\footnote[3]{A transaction invokes a function in CSC that is responsible for requesting the specified oracle. Then, the oracle fetch the attack-result and execute a callback function to return the attack-result \cite{wohrer2018design}.} that is connected to the outside world. Then CSC allocates the money deposited in the account to the sponsor and the attackers based on the reward allocation function and the attack-result. The oracle, the reward allocation function, and the criteria of the sponsor's desired attack are registered in the smart contract, and are known to all parties before the attack phase.
\begin{figure}
	\includegraphics[width=0.5\textwidth]{fig3.png}
	\centering
	\caption{System Model}
	\label{Fig3}
\end{figure}

\subsection{Model assumptions}

We use the following assumptions for the system model:
\begin{itemize}
	\item Blockchain is trusted for correctness and availability. However, all of its internal
	states are exposed to the public and retains no private data.
	\item Smart contracts interact with users and other contracts with transactions, and every
	transaction commit after a bounded delay.
	\item Contractual parties are mutually distrustful, and they are regarded as independent
	risk-neutral\footnote[4]{While it is true that attackers are not always risk-neutral, we assume that is the case here for simplicity. For an analysis of non-risk neutral attackers, see \cite{qian2015robust}.} decision-makers.
	\item Attackers are rational strategic selfish agents, aiming to maximize their own profits.
\end{itemize}
These are standard assumptions in existing blockchain systems \cite{juels2016ring}

\subsection{Case Study: Voluntary Collaborative DDoS Attack}

\begin{figure}[ht]
	\centering
	\begin{subfigure}[b]{.49\textwidth}
		\centering
		\includegraphics[width=\textwidth]{fig1.png}

	\end{subfigure}
	\begin{subfigure}[b]{.49\textwidth}
		\centering
		\includegraphics[width=\textwidth]{fig2.png}

	\end{subfigure}
	\caption{Sequence diagram for a DDoS attack using CSC}
	\label{Fig12}
\end{figure}

In the case of a DDoS attack, the required attack-traffic for launching the sponsor's desired attack is denoted as $e_{th}$. We assume that this value is prior common knowledge. We define the attack-result $e_{tot}$ as the sum of the attackers' contributions for reaching to $e_{th}$. Therefore, as $\dfrac{e_{tot}}{e_{th}}$ converges to one, we call the attack more successful. In this section, we describe a voluntary collaborative attack in three phases for the popular example of a DDoS attack.

\paragraph{Phase1. Coordination and commitment.} The attack-sponsor determines a reward
allocation function and attack details in terms of smart contract rules. For instance, he specifies the server and a target in it that he wants to overwhelm\footnote[5]{The targets of DDoS attack are usually resources such as routers, links, firewalls and other defense systems, victim's computer and network infrastructure, victim's OS, and victim's applications \cite{hoque2015botnet}}. Moreover, he defines a measure for the evaluation of DDoS attack's impact on the victim in terms of metrics such as throughput, response time, and normal packet survival ratio.

Moreover, he specifies the time interval that he wishes the attack to be performed.
Then the sponsor publishes the smart contract on the Ethereum blockchain and deposits the attack award in the contract's account. In this phase, the attackers can evaluate the attack's cost and feasibility based on the specified details in the contract (e.g., required bandwidth of the attack and its duration ) \cite{segura2010modeling}. After that, until the beginning of the attack time interval, the attackers can submit their bets to the contract's account. The reward allocation function determines how the deposited money on CSC's account is allocated among attackers and the sponsor. It is one of the contract's rules that has a significant impact on the attackers' behavior and, therefore, on the attack-result.

In summary, a criminal smart contract for a typical DDoS attack includes the
following details:

\begin{itemize}
	\item target server address
	\item precise measure for the evaluation of DDoS attack's impact
	\item trusted oracle
	\item attack time interval
	\item reward allocation function
\end{itemize}

\begin{algorithm}

	\captionof{figure}{Smart contract's pseudo-code \\
		phase1: Coordination and commitment}
	\label{alg1}
	\begin{algorithmic}
		\STATE Initially deployed to Ethereum blockchain by an attack-sponsor $ \mathcal{S} $

		\textbf{Function called by the sponsor $ \mathcal{S} $}
		\hrule
		\STATE \textbf{init (} $ \$award, target\_server\_url, start\_time, end\_time, \$bet\_min $ \textbf{)}
		\STATE Assert ledger $ [\mathcal{S}] \geq \$award $
		\STATE Set ledger $ [\mathcal{S}] \coloneqq ledger [\mathcal{S}] - \$award $
		\STATE $ owner_address \coloneqq [\mathcal{S}] $
		\STATE $ bet\_min \coloneqq \$bet\_min $
		\STATE $ award \coloneqq \$award $
		\STATE $ target\_server\_url \coloneqq target\_server\_url $
		\STATE $ start\_time \coloneqq start\_time $
		\STATE $ end\_time \coloneqq end\_time $

		\STATE  struct $ Attacker( $
		\renewcommand{\algorithmiccomment}[1]{// #1}
		\ \ \ \COMMENT {Profile of each attacker}
		\STATE \ \ \   address $ account $
		\STATE \ \ \   uint $ bet $
		\STATE \ \ \   unit $ reward \ )$
		\STATE $ Attacker $ [ ] public $ Bettings $
		\ \ \ \COMMENT{List of all bets placed}
		\hrule
		\textbf{Function called by an attacker $ \mathcal{A} $}
		\hrule
		\textbf{commit (} $ \$bet $ \textbf{)}
		\IF {$ current time T < start\_time $ \AND $ \$bet > bet\_min $}
		\STATE Assert ledger $ [\mathcal{A}] \geq \$bet $
		\STATE Set ledger $ [\mathcal{A}] \coloneqq ledger [\mathcal{A}] - \$bet $
		\STATE $ Bettings $.push($ Attacker \{ $
		\STATE \ \ \   $ account: \ msg.sender, $
		\STATE \ \ \   $ bet: \ msg.value, $
		\STATE \ \ \   $ reward: \ 0 \ \}$
		\ENDIF
	\end{algorithmic}
\end{algorithm}

\begin{algorithm}

		\captionof{figure}{Smart contract's pseudo-code \\ phase3: Reward allocation}
		\label{alg2}
	\begin{algorithmic}
		\STATE \textbf{rewardAllocation ( )}
		\IF {$ current time T > end\_time $ }
		\STATE $ (ar, \sigma) \coloneqq $ \textbf{ requestDataFeed(}
		$ target\_server\_url, start\_time, end\_time $ \textbf{)}
		\STATE Assert \textbf{sigVer(} $ public_{key}, ar, \sigma $ \textbf{ )}
		\STATE \textbf{computePayments(} $ award, Bettings, ar $ \textbf{ )}
		\renewcommand{\algorithmiccomment}[1]{// #1}
		\ \ \ \COMMENT {Compute and update the $ Attacker.reward $ property for all attackers in bettings list}
		\STATE \textbf{transferPayments(} $ Bettings, owner_address $ \textbf{ )}
		\ \ \ \COMMENT {Pay attackers their reward and transfer the rest of the deposited money to the sponsor's account}
		\ENDIF
	\end{algorithmic}
\end{algorithm}
In this framework, when the conditions for the success of the attack are met,
attackers' payments are guaranteed to be made by the smart contract. Note that, the
communication of sponsor with the blockchain is in just one or two (in case of an
unsuccessful attack) transactions.

\paragraph{Phase2. The attack.} The attack phase takes place during the attack time interval. Individual attackers collaborate in the attack by sending appropriate attack-traffic to the target server\footnote[6]{While it is common that the target defends itself by identifying and filtering the attack-traffic, for simplicity we assume that attackers generate effective attack-traffic.}. For each attacker, the attack procedure is similar to the typical DoS attack (or DDoS attack in case of the collaboration of small botnets \cite{vogt2007army}), and the only difference is that the sponsor specifies the target server and attack time interval.

\paragraph{Phase3. Reward allocation.} At the end of the attack time interval, the CSC requests the attack-result from the oracle\footnote[7]{We assume that the oracle correctly reports the attack-result.}. Let reward $ M $ be all the deposited money on the
CSC's account, including attackers' bet and sponsor's award ($M=\sum_{i\in N}bet_i+AW$)
Then the CSC allocates reward $M$ among the sponsor and the attackers based on the
reward allocation function and the attack-result.

In this study, we propose a simple allocation function that allots reward $M$ to the
sponsor and the attackers according to the attackers' bets and the result of the attack. Based on this reward allocation function, the attackers' reward is linearly proportional
to the amount of their bet and the attack-result.

The CSC pseudo-code for a collaborative DDoS attack is shown in Figure \ref{alg1} and \ref{alg2}.We model a data feed as a sequence of pairs $ (ar, \sigma) $. Where $ ar $ is the attack-result based on
the specified measure for the evaluation of the attack's impact, and $ \sigma $ is a corresponding
digital signature. The data feed has an associated private/public key pair
$ (public_{key}, private_{key}) $ used to sign/verify signatures. We summarize the notations used in this paper in Table \ref{tab1}

	\begin{table}
	\floatpagestyle{empty}
	\caption{notation used in the paper}
	\label{tab1}
	\resizebox{\textwidth}{!}{
	\begin{tabular}{|l|l|}
		\hline
		Symbol &  Definition\\
		\hline
		$\mathcal{N}$ &  The set of attackers, $|\mathcal{N}|=n$ \\
		$bet_i$ &  the amount of betting of attacker $ i $ \\
		$bet_t$ & the total amount of bet $\sum_{i=1}^{n}bet_i$  \\
		$AW$ & the amount of award, deposited by the sponsor \\
		$e_{max}$& maximum possible attack-traffic\\
		$e_{th}$ & minimum attack-traffic required for a successful attack, $e_{th}<e_{max}$\\
		$e_i$ & the ratio of contribution of attacker $ i $ to the required traffic for
		\\ & a successful attack $e_{th}$, $ 0 \leq e_i \leq 1$ \\
		$\mathcal{E}$ & the set of all action profiles $ \hat e = (e_1, ..., e_n) $	\\
		$c$ & the average cost factor of attack-traffic generation for the specified attack \\
		$\mathcal{M}$ & the deposited money on the CSC's account, including attackers' bet
		\\ & and sponsor's award ($ M=\sum_{i\in N}bet_i+AW $) \\
		$ t_i $ & the private information (type) of attacker $ i $ ($ t_i = \frac{bet_i}{AW} $)	\\
		$ \mathcal{T} $ & 	the set of all type profiles ($ \hat t = (t_1,..., t_n) $) \\
		$ S(.) $ & the strategy function $S: T\rightarrow E$ specifies which action $ e_i $ is taken
		\\ & for every possible type $ t_i $, $ S^\star(t_i)=e_i^\star $ \\
		$ S^\ast(.,.) $ & player $ i $'s (with type $ t_i $) best response strategy $S^\star: T \times E \rightarrow E$
		\\ & to a given strategy profile $ \hat{e}_{-i} $, ($ S^\ast(t_i,\hat{e}_{-i}) = S^\ast(t_i) = e_i^\star $) \\
		$ e_{tot} $ & the sum of relative contributions of attackers to attack ($ e_{tot} = \sum_{i=1}^{n} e_i $ ) \\
		$ e_{tot}^\star $ & the sum of relative contributions of attackers to attack
		\\ & in the game equilibrium ($ e_{tot}^\star = \sum_{i=1}^{n} e_i^\star$ ) \\
		$ R(.,.) $ &  linear reward allocation function, $R(t_i,e_{tot})\rightarrow \mathbb{R}$ \\
		$ \dot{R}(.,.) $ & quadratic reward allocation function $\dot{R}(\hat t,e_{tot})\rightarrow \mathbb{R}$ \\
		$ Cost(.) $ & cost function, $ Cost(e_i) \rightarrow \mathbb{R}$ \\
		$ U(.,.) $ & utility function, $ U(t_i,e_{tot}) \rightarrow \mathbb{R}$ \\
		$ AR(.) $ & attack-result function ($ AR(\hat t) = e_{tot}^\star $)  \\
		$ P(.) $ & payment rule which defines a profile of attackers' payments
		\\ &  $ \hat p (\hat t) = \left (p_1(\hat t),..., p_n (\hat t)\right) $ to the mechanism $ \left (p_i
		(\hat t) = R(t_i, AR(\hat t) - t_i \times AW)\right) $ \\
		$ O $ & the set of possible outcomes $ o = (e_{tot}^\star, \hat p(\hat t)) $ \\
		$ G(.) $ & outcome function $ G: T\rightarrow O $ ($ G(\hat t) = (AR(\hat t), P(\hat t)) $ \\
		$ V(.,.) $ & valuation function $ V(e_{tot}^\star , t_i) \rightarrow \mathbb{R} $ \\
		$ P_i^\prime(.) $  & if attackers could prove their contribution it would be the fair payment
		\\ & to attackers $ \left( P_i^\prime (\hat e) = AW \times e_i \times e_{tot} \right)$ \\
		$ D_{rms} $ & the fairness-score, based on the root mean square of the difference between
		\\ & the mechanism payment and the fair payment \\
		$ \delta $ & a fixed-cost of Ethereum transaction fee \\
		\hline
	\end{tabular}}
\end{table}

\section{Game Model}
\label{sec4}
Due to privacy concerns, proving the attackers' contribution is challenging. What
complicates this problem is that selfish attackers do not care about the sponsor's goals,
and they would lie to get more share of the reward unless the sponsor gives them an
incentive to be honest, either by monetary payments or with some other rules he designs
in the smart contract. In the criminal context, attackers' behavior is rational and, even, predictable \cite{segura2010modeling, henderson2010predicting}. Therefore, under some assumptions, we can identify and analyze factors
that can influence the attacker's behavior and hence affect the attack-result.

However, we need to know the number of attackers and the amount of their bet to
be able to predict attackers' contributions and the attack-result. Since all the
transactions' information are accessible in the blockchain, we assume that the total
amount of bet on the successful attack ($ bet_t $), and the amount of award ($ AW $) are
publicly known. Whereas attackers' bets and the number of attackers are not publicly
known because each agent in the blockchain is identified only by its public key. In other
words, each attacker can submit several bets through multiple addresses he has created
on the blockchain. Thus, each attacker privately knows his true bet (consisted of several
smaller bets), even though all the transactions are public. Therefore, attackers have to
decide on two actions. First, before the attack phase starts, they should decide on a
betting strategy: each attacker can submit multiple bets that sum to his true bet or one
bet that is equal to his true bet. We call the latter strategy a truthful betting. Afterward,
in the attack phase, he should decide on the amount of contribution to the attack.
Different incentive mechanisms influence the behavior of rational attackers and the
result of their interactions. In other words, designing the rules through which
individuals interact can have a profound impact on the results of that interaction. For
example, how the reward is allocated among attackers influences the decisions of
attackers (their betting strategy and the amount of contribution to the attack).

In this section, using incentive theory and utilizing game theory, we model the
attackers' interaction to predict the attributes of the attack. First, for simplicity (without
loss of generality), we assume that attackers have submitted their bets (truthfully or
not), and we consider their actions as the amount of contribution to the attack. We
model the attackers' interactions as an incomplete information game in which each
attacker privately knows his own amount of bet. We show that each attacker's relative
contribution is independent of others' contributions and bets and is a function of his
own amount of bet.

In the next section, the rules which govern the interactions are modeled as a
mechanism. Applying the mechanism design theory, we study whether the attackers are
willing to bet truthfully. We show that CSCs can be designed to incentivize attackers
to bet truthfully before the attack phase. Notably, we show that a simple reward
allocation design will not only provide incentive compatibility, which discourages freeriders and rewards contributors but also achieve fairness in rewarding attackers and
make the attack-result predictable and adaptable for the sponsor.
\subsection{Interdependent Attackers Game (IAG)}
\label{sec41}
We study the interaction among a set of n interdependent strategic attackers as a
game with independent private values and strict incomplete information. The utility of
an attacker depends entirely on his own private information and not on any information
from other attackers; this property is called independent private values. Strict
incomplete information is a term that means we have no probabilistic information in
the model, i.e., we consider a worst-case scenario for missing information.

We assume that $ n $ attackers\footnote[8]{The words "player" and "attacker" will be used interchangeably throughout this work.} have bet on the success of the attack, and represent the set of attackers by $ N (|N|=n) $. For each attacker $ i $ Let $ t_i = \frac{bet_i}{AW} $ be the private information that he has, termed as type and $ bet_i $ is the (true) amount of his bet. Let $ AW $ be the deposited award of attack-sponsor on the CSC, and we assume it as an upper bound on attackers' amount of bet ($ 0<bet_i<AW $). So, the value of players' type is between zero and one. We assume that the estimation of required attack-traffic for launching the sponsor's desired attack is $ e_{th} $. Attacker $ i $'s relative contribution to $ e_{th} $ is his action, denoted by ei ($ 0<= e_i <=1 $). If attacker $ i $ is a free-rider attacker, he makes no effort to contribute in the attack, i.e., $ e_i = 0 $ and if $ e_i = 1 $ it means that he decides to fully launch the sponsor's desired attack.

Let $ T $ denote the set of all type profiles $\hat{t} =(t_1,…,t_n)$ and $ E $ denote the set of all action profile $\hat{e} = (e_1,…,e_n)$. Based on his type $ t_i $, player $ i $ chooses the action $ e_i \in (0,1] $. The strategy function $S: T\rightarrow E$ specifies which action $ e_i $ is taken for every possible type $ t_i $. Rational players will try to select a strategy that will lead to an outcome, maximizing their own utility. So, in the attack phase,
attacker $ i $ decides on the amount of his contribution to the attack, and his decision
depends on his strategy $ S(t_i) $.
Let $ M $ be all the deposited money on the CSC's account, including attackers' bet and
sponsor's award ($M=\sum_{i\in N}bet_i+AW$). After the attack phase, the CSC allocates the
reward $ M $ among attackers and the sponsor. Moreover, the CSC automatically transfers
their reward to blockchain addresses that they have provided.

The reward allocation function is one of the mechanism rules that has a significant impact on the attacker's preferred strategies and attack-result. In our proposed framework, the sponsor defines the reward allocation function
$ R: (0,1] \times [0,1]  \rightarrow\mathcal{R}  $
in the smart contract. In this study, we propose a simple allocation function that allots reward to attackers according to the amount of their bet and the attack-result
$ e_{tot} = \sum_{i\in N} e_i $.
We consider the following reward allocation function
\begin{equation}
\label{eq1}
	R\left(ti, e_{tot} \right) = \left( bet_t + AW \right) \times \frac{t_i}{\frac{bet_t}{AW}} \times e_{tot},
\end{equation}
where $ bet_t = \sum_{i\in N} bet_i  $
is the sum of all the attackers' bet.
Note that based on this reward allocation function, given fixed total bet bett , the attacker $ i $'s reward is linearly
proportional to his type  $ t_i = bet_i \times AW $ and the attack-result $ e_{tot} $.
Cost function calculates the cost of contributing to the attack. We represent the cost function for DDoS Attack by
$Cost\left(e_i\right): [0,1] \rightarrow \mathcal{R}^+$.
We assume that the cost function is strictly increasing and convex on its domain. The following cost function is a general
form, where $ exp(.) $ is the exponential function
\begin{equation}
\label{eq2}
	Cost\left(e_i\right)=c\times\frac{\exp{\left(e_i\right)}-1}{e_{max}-e_i}\ \ \ \ \ \ \ \ \ \ \ \forall i=1,..,n.
\end{equation}

The average cost factor of attack-traffic generation for the specified attack is denoted
by $ c $ and depends on the type of attack, the target's defensive power, and attackers'
resources. If the maximum possible attack-traffic is $ e_{max} $, then the cost of generating attack-traffic must diverge to infinity when the traffic approaches to $ e_{max} $. The resulting utility function
$ U: t_i \times [0,1] \rightarrow \mathcal{R} $ achieved by player $ i $, if his type is $ t_i = \frac{bet_i}{AW} $
is of the following form
\begin{equation}
\label{eq3}
	U\left(t_i, e_{tot}\right) = R\left(t_i, e_{tot}\right) - Cost\left(e_i\right) - t_i \times AW,
\end{equation}
the alternative notation $ U\left(t_i, e_i,\hat{e}_{-i}\right) $ where $ \hat{e}_{-i} $ denotes the vector consisting of
elements of $ \hat{e}$ other than the i-th element, emphasizes that the i-th player only has control over his own attack effort, $ e_i $.
A static strict incomplete information game is then defined by a tuple $ IAG = < N,\ E,\ T,\ U > $. In the $ IAG $, each player maximizes its own utility in a distributed fashion. Formally, the non-cooperative $ IAG $ is expressed as \ref{eq4} where $ U(.) $ is given in \ref{eq3}
\begin{equation}
\label{eq4}
\underset{e_i\in [0,1]}{\max}\ \ {U\left({t_i,e}_i,\ \hat{e}_{-i}\right)\ \ \ \forall\ i\in N}\
\end{equation}
It is necessary to characterize a set of attack efforts where the attackers are satisfied
with the utility they receive (which maximize their utility), given the attack efforts of
the other users. Such an operating point is called an equilibrium. Because each attacker
is self-interested, a strategy profile is not "stable" unless each attacker maximizes its
utility. The equilibrium concept offers a predictable, stable outcome of a game where
multiple players with conflicting interests compete through self-optimization and reach
a point where no player wishes to deviate. The condition for stability we strive for here
is that of strong dominant strategy equilibrium. Note that rules of the game, including
the utilities of all players, are public knowledge. However, players do not know the
private information of other players, which determine their preferences.

\subsection{Equilibrium Analysis}
\label{sec42}
First, we derive the best-response strategy of a player in $ IAG $. Then we prove that
the described game among attackers in this setting has a dominant strategy equilibrium.
Player i's (with type $ t_i $) best response strategy$S^\ast(t_i)$ to a given strategy profile $ \hat{e}_{-i} $ is given as the unconstrained maximizer of his utility, where $ e_i $ is his contribution to
$ e_{th} $, where $ AW $, $ bet_t $ and $ e_{th} $ are fixed.
\begin{equation}
\label{eq5}
S^\ast(t_i, \hat{e}_{-i})=\underset{e_i\in [0,1]}{\arg\max}\ {U\left({t_i,e}_i,\ \hat{e}_{-i}\right)}
\end{equation}
To find the maximizing $S^\ast(t_i)$, we take the first take derivative of the utility function with respect to $ e_i $ and set it equal to 0
\begin{equation}
\label{eq6}
-c \times\frac{\exp{\left(e_i\right)}}{e_{max}-e_i}-c\times\frac{\exp{\left(e_i\right)}-1}{\left(e_{max}-e_i\ \right)^2}+\frac{{AW\times t}_i\times\left(AW+bet_t\right)}{bet_t}=0.
\end{equation}
So, player i's best response strategy $S^\ast(t_i, \hat{e}_{-i})$ which is the attack effort that
optimizes his individual utility does not depend on the attack efforts of the other players $ \hat{e}_{-i} $. Therefore, we can represent the best response strategy function by $S^\ast\left(t_i\right)$.
Furthermore, the only parameters (other than $ t_i $) that determine $S^\ast\left(t_i\right)=e_i^\ast$ are the cost
of the required attack-traffic $Cost(e_{th})$ and the relative amount of total bets to award $\frac{bet_t}{AW}$.
\newdefinition{definition}{Definition}
\begin{definition}
given an incomplete information game $\Gamma=<N,\ E,\ T,\ U>$, a strategy
$S^\ast(t_i)$ is a \textit{strongly dominant strategy}, if for every $ t_i $ we have that the strategy $S^\ast(t_i)$ is
a strongly dominant strategy in the full information game defined by $ t_i $. Formally, for all $ t_i $, all $\hat{e}_{-i}$ and all $e_i^\prime$ we have
\begin{equation}
\label{eq7}
U\left(t_i,\ S^\ast\left(t_i\right),\ \hat{e}_{-i}\right)>\ U(t_i,\ e_i^\prime,\ e_{-i})
\end{equation}
\end{definition}
\begin{definition}
given an incomplete information game $\Gamma=<N,\ E,\ T,\ U>$, a \textit{strong dominant strategy equilibrium}, is an action profile $\hat{e}^\ast=\left(S^\ast\left(t_1\right),\ .\ .\ .\ ,\ S^\ast\left(t_n\right)\ \right)$ in which each $S^\ast(t_i)$ is a strongly dominant strategy. The notion of strongly dominant strategy requires that $S^\ast(t_i)$ is the unique best response to all possible $ \hat{e}_{-i} $, i.e., without knowing anything about $ \hat{t}_{-i} $.
\end{definition}
\newtheorem{theorem}{Theorem}
\begin{theorem}
	\label{thm1}
	$ IAG $ has a strong dominant strategy equilibrium.
\end{theorem}
\newproof{pot}{Proof}
\begin{pot}
		For each player $ i $ and for fixed $t_i$ and $e_{-i}$, the reward function $R:\ T\times E\rightarrow\mathbb{R}$ is linear, and cost function $C:\ E\rightarrow\mathbb{R}$ is convex with respect to $e_i$. So $U\left(t_i,\hat{e}\right)=R\left(t_i,\ \hat{e}\right)-C\left(e_i\right)$ is concave and has a unique maximum. $S^\ast\left(t_i\right)$  is the unique maximizer of $U\left(t_i,\ \hat{e}\right)$ and is a strongly dominant strategy that is the best response to any $\hat{e}_{-i}$ possible. So for any $i\in N$ and all $t_i$, all $\hat{e}_{-i}$ and all $e_i^\prime$ , we have $U\left(t_i,\ S^\ast\left(t_i\right),\ \hat{e}_{-i}\right)>\ U(t_i,\ e_i^\prime,\ \widehat{e_{-i}\ })$ and strategy profile $\hat{e}\ =\ (S^\ast\left(t_1\right),\ \ldots,S^\ast\left(t_n\right))$ is the strong dominant strategy equilibrium of the game.
\end{pot}
\section{Exploring Incentive Compatibility}
\label{sec5}
Different incentive mechanisms influence the behavior of rational attackers and the
result of their interactions. In other words, designing the rules through which
individuals interact can have a profound impact on the results of that interaction. For
example, how the reward is allocated among attackers (reward allocation function)
influences the decisions of attackers. One of the main problems in the mechanism
design theory is truthful elicitation. In particular, the problem is how to provide
appropriate incentives to attackers so that they willingly reveal their private
information.

Furthermore, the main focus of mechanism design is on the design of the
game's rules that leads to equilibriums, satisfying desired properties, assuming that strategic players may hold private information that is relevant to the decision at hand.
Using the mechanism design approach, we can analyze the behavior of individuals in different institutions by considering incentive and private information.

As discussed earlier, due to the anonymity characteristic of blockchain users, we can not determine the number of attackers and the amount of their bet. Each strategic attacker can submit multiple bets from multiple identities (i.e., multiple blockchain addresses) that sum to his true bet, or he can submit his true bet with a single identity.
We call the latter a truthful betting. In the "commitment phase," each attacker
announces his type by submitting a transaction with a new identity and transferring the
amount of his bet to the CSC's account. However, each attacker privately knows his true bet, and if we knew attackers' true bet, then we could predict the attack-result in the equilibrium of the game (i.e., $\sum_{i\in N} S^\ast(t_i) = e_{tot}^\ast$). Hence the missing piece in the puzzle is the private information of attackers.

In this section, we first present the proposed CSC as a mechanism design model.
Applying the mechanism design theory, then we study whether the attackers are willing
to bet truthfully. We prove that despite private information and pure selfish behavior,
we can predict the attack-result and conditions that affect it. In addition, we show that
under certain reasonable assumptions, our mechanism satisfies the necessary
constraints of mechanism design, namely incentive compatibility, individual
rationality, and budget balance, while maintaining fairness.
\subsection{Mechanism Formulation}
In section \ref{sec41}, the interaction of attackers in the "attack phase" is modeled as an incomplete information game $ IAG = < N,\ E,\ T,\ U > $ where attackers act as players, and $ N $ is a finite set of $ n $ attackers indexed by $ i $.
Attacker $ i $'s type is $ t_i = \frac{bet_i}{AW} $ and each attacker
$ i $ decides on the amount of his contribution to the attack, denoted by $ e_i \in (0,1] $.
$ T $ is the set of all type profiles
$ \hat t = (t_1, ...,t_n) $
and $ E $ denotes the set of all action profile
$ \hat e = (e_1, ..., e_n) $.
As proved in section \ref{sec42}, this game has a strong dominant strategy equilibrium. When dominant strategies exist, they provide compelling predictions for strategies that players should employ. An important result is that for each attacker $ i $, given the attacker's type $ t_i $, we can assume that his contribution in equilibrium is determined by $ S^\ast(t_i) = e_i^\ast $ where $ S^\ast(t_i)$ is stated in equation \ref{eq5} and is independent of other attackers' types and strategies.
Note that each attacker $ i $ privately knows his type $ t_i $ and his best response strategy $e_i^\ast $. Therefore, for any given type profile $\hat{t} \in T$ given fixed cost factor $ c $, required attack-traffic $ e_{th} $, total bets $ bet_t $ and attack's award $ AW $, we define the attack-result function $AR: T \rightarrow E$ as
\begin{equation}
\label{eq8}
AR\left(\hat{t}\right)=\sum_{i\in N}{S^\ast(t_i)}=\sum_{i\in N}e_i^\ast=e_{tot}^\ast\
\end{equation}
which is the sum of contributions of attackers in equilibrium. Similar to the game model presented in section \ref{sec41}, we consider attacker $ i $'s bet $ bet_i $ as his payment to CSC, his type as $ t_i = bet_i \times AW $, and the reward $R\left(t_i,AR\left(\hat{t}\right)\right)$ allocated to him is what the mechanism pays to him; in other words, attacker $ i $ with type $ t_i $ pays
\begin{equation}
\label{eq9}
p_i\left(\hat{t}\right)=R\left(t_i,AR\left(\hat{t}\right)\right)-t_i\times AW
\end{equation}
to the mechanism. Note that this representation of reward allocation function $R(.,.)$ is similar to equation \ref{eq1}. The only difference being that $\hat e$ is replaced by $AR(t\hat t)$, and that is because, as we explained above, due to the existence of strong dominant strategy equilibrium, for each type profile $\hat t$, the attack-result is equal to $ AR(\hat t) $

Let $G\left(\hat{t}\right)=\left(S\left(\hat{t}\right),P(\hat{t})\right)$ be the outcome function that maps each type profile $\hat{t}\in T$ to an outcome $o=\left(e_{tot}^\ast,\hat{p}\right)$ where the payment rule $ P(.) $ defines a profile of attackers' payments $\hat{p}=({p_0,p}_1,\ \ldots,\ p_n)$, and the set of possible outcomes is denoted by $ O $. For each attacker $ i $, the monetary part of the outcome is $p_i\in\mathbb{R}$ and represents his payment to the mechanism.

The attack-result $e_{tot}^\ast$ is the non-monetary part, and attackers' preference for attack-result is given by a valuation function $V:E\times T\rightarrow\mathbb{R}$ (in terms of some currency). In other words, attackers' valuation function $ V(.) $ express the cost that they would be willing to tolerate in contributing to the attack (i.e., based on their dominant strategy), plus a fixed-cost of Ethereum transaction fee $ k \times \delta $.
So, the valuation function $V(e_{tot}, t_i)$ specifies how much attacker $ i $ values the attack-result $ e_{tot}^\star $, given his type $ t_i $, and is of the following form
\begin{equation}
\label{eq10}
V\left(e_{tot}^\star, t_i\right) = - \left(Cost(S^\star(t_i)\right) + k \times \delta)\ \ \ \forall\ i\in N, \forall\ t_i \in (0,1]
\end{equation}
The total number of transactions that attacker $ i $ uses to bet\footnote[9]{We assume attackers don't trust each other, so each attacker at least needs one transaction to submit his bet or he can submit multiple bets that sum to his true bet} is denoted by $ k \in \mathcal{N} $ and the cost function $ Cost(.) $ and the dominant strategy function $ S^\star(.) $ are given in equation \ref{eq2} and \ref{eq5}, respectively.
Note that based on equation \ref{eq6}, attacker $ i $'s contribution only depends on his own
type $ t_i $. So, as we can see in equation \ref{eq10}, his valuation for attack-result is a function of
his type, i.e., $ V(e_{tot}^\star, t_i) = V(t_i) $. In many situations and mechanisms, as it is the case
in this research work, this valuation function represents the type of attacker, and
announcing a type is similar to reporting the attacker's valuation function.
In quasi-linear settings, money/incentive transfer takes place to/from the agents,
which makes this environment especially attractive for incentive design. Each agent
has a utility that is the motivating factor behind the selection of his strategy. That is,
the preference of agent $ i $ can be captured by a function of the form
\begin{equation}
\label{eq11}
U(o,t_i) = V(e_{tot}^\star , t_i ) +p_i
\end{equation}
\begin{definition}
	a \textit{direct mechanism} in a quasi-linear setting 	is defined by $D=\left(T,\ G(\hat{t})\right)$. The mechanism defines the set of allowable types T that each agent can choose and an outcome function $ G(.) $ which specifies an outcome $ o $ for each possible type profile $\hat{t}=(t_1,\ \ldots,\ t_n)\in T$.
\end{definition}
We formalize the incentive mechanism for strategic attackers in the proposed
collaborative attack as a direct mechanism. In the direct mechanism, each attacker $ i $
announces a type $ t_i^\prime $ to the mechanism, and this is not necessarily equal to his true type
$ t_i \in (0,1] $. In particular, the attacker will try to announce a type that will lead to an
outcome that maximizes its own utility. The objective in mechanism design is defined
as a social choice function $(SCF)\ F:T \rightarrow O$. A social choice function is a rule that maps each agents' type profile to an optimal outcome and in a direct mechanism is the same as the outcome function, i.e., $ F(.)=G(.) $.
\subsection{Incentive Compatible Property}
Direct mechanisms extract information from the different agents by motivating them to "tell the truth." If it is the best response for all the players to report their private information truthfully to the smart contract-driven mechanism, we say the contract is incentive compatible. Here we prove that the proposed mechanism is cheat-proof, which means that all attackers are motivated to submit their bet truthfully, i.e., their utility is maximized when $bet_i=t_i\times AW$, and any deviation will lead to a utility loss.
\begin{definition}
	The social choice function $ F(.) $ is a dominant strategy incentive compatible (DSIC) (a.k.a. strategy-proof or cheat-proof) if and only if
	\begin{equation}
	\label{eq12}
	U\left(o,t_i\right)\geq\ U\left(o^\prime,t_i^\prime\right)\ \  \forall\ i\in N,\forall\hat{t}\in T,\forall t_i^\prime\in (0,1]
	\end{equation}
	where $o=G(t_i,\ \widehat{t_{-i}})$ and $o^\prime=G(t_i^\prime,\hat{t}_{-i})$.
\end{definition}
Thus, if the SCF $ g(.) $ is DSIC, then, irrespective of other attackers bet, it is always the best response for agent i to bet truthfully, i.e., $bet_i=t_i\times AW$. By calling a direct
mechanism DSIC or strategy-proof, we mean that the mechanism implements an
incentive-compatible or strategy-proof social choice function.
\begin{theorem}
	\label{thm2}
	The proposed direct mechanism (or social choice function) is DSIC.
\end{theorem}
\begin{pot}
	We need to show that the utility of the attacker $ i $, is maximized when he bet truthfully, i.e., $u_i\left(e_{tot}\right)$ is maximized at $bet_i=t_i\times AW$. We use proof by contradiction. Without loss of generality, assume that the true type of attacker $ i $ is $t_i$, but he tries to misrepresent his type and submit his bet with two distinct blockchain addresses in two transactions (k=2), namely $bet_i^1$ and $bet_i^2$ such that $bet_i^1+\ bet_i^2=bet_i$  and $bet_i=t_i\times AW$. We denote the incorrect types by $t_i^1$ and $t_i^2$, so we have $t_i=t_i^1+t_i^2$. We assume that he benefits from this untruthful act which means $\exists t_i^1,\ t_i^2\in T$ such that $t_i=t_i^1+t_i^2$  and $\exists\hat{t}_{-i}\in T^{n-1}$ that
	\begin{equation}
	\label{eq13}
	U\left(o,t_i\right)<U\left(o^\prime,t_i^1\right)+U\left(o^\prime,t_i^2\right)
	\end{equation}
	where $G(t_i^1+t_i^2,\hat{t}_{-i})$ and $G(t_i,\hat{t}_{-i})$ is denoted by $o^\prime$ and $o$, respectively.

	Note that, from each attacker $ i $'s perspective, his dominant strategy $S^\ast\left(t_i\right)$ is a function of his true type $t_i$ and he knows his own type; so he still can calculate his dominant strategy, i.e. $S^\ast\left(t_i\right)=S^\ast\left(t_i^1+t_i^2\right)$. Thus
	\begin{equation}
	\label{eq14}
	AR\left(t_i^1+t_i^2,\ \hat{t}_{-i}\right)=\sum_{j \in N,i\ne j}^{}S^\ast (t_j) + S^\ast(t_i^1+t_i^2)
	=\sum_{j \in N,i\ne j}^{}S^\ast (t_j)+S^\ast(t_i)=AR(t_i,\hat{t}_{-i}).
	\end{equation}
	As specified in Equation \ref{eq1}, we have
	\begin{align}
	\label{eq15}
	R\left(t_i^1,S\left(\hat{t}\right)\right)+R\left(t_i^2,S\left(\hat{t}\right)\right) &=\left(t_i^2+t_i^2\right)\times\frac{\left(bet_t+AW\right)}{\frac{bet_t}{AW}}\times S\left(\hat{t}\right) \notag \\
	&= t_i\times\frac{\left(bet_t+AW\right)}{\frac{bet_t}{AW}}\times S\left(\hat{t}\right) \\ &= R\left(t_i,S\left(\hat{t}\right)\right) \notag
	\end{align}
	So the attacker's reward does not increase by lying, and as we assumed, the bets are the same too, i.e., $bet_i^1+\ bet_i^2=bet_i$. Therefore, from the mechanism point of view, the payments are the same as if the attacker would announce his true type, i.e.
	\begin{equation}
	\label{eq16}
	p_i\left(t_i,\hat{t}_{-i}\ \right)=p_i\left(t_i^1, \hat{t}_{-i}\right)+p_i\left(t_i^2,\hat{t}_{-i}\right).
	\end{equation}
	So if an attacker wants to get more utility by lying, his valuation should be less by betting truthfully.

	Subtracting the equalities in \ref{eq10} from the corresponding equalities in \ref{eq11}, and according to \ref{eq15} and \ref{eq16} we obtain
	\begin{equation}
	\label{eq17}
	V\left(S^\ast\left(t_i\right),t_i^1\right)+V\left(S^\ast\left(t_i\right),t_i^1\right)>V\left(S^\ast\left(t_i\right),t_i\right),
	\end{equation}
	which means that
	\begin{equation}
	\label{eq18}
	Cost\left(S^\ast\left(t_i\right)\right)+ 2 \times \delta<Cost\left(S^\ast\left(t_i\right)\right)+\delta,
	\end{equation}
	and this contradicts the assumption that the transaction fee is a positive value.
\end{pot}
It means that any rational strategic attacker would prefer to bet truthfully in the smart
contract since this gives him higher utility.
\subsection{Budget Constraint}
An incentive mechanism should be budget-constrained to be economically feasible.
In the proposed CSC, the total rewards allocated to the attackers should not exceed the
deposited money on the CSC's account ($M=\sum_{i\in N}bet_i+AW$).
\begin{definition}
	(Budget Constraint). A reward mechanism is budget-constrained if we have
	\begin{equation}
	\label{eq19}
	\sum_{i\in N}{p_i(\hat{t})}\le AW\ \ \ \ \ \ \forall\hat{t}\in T,
	\end{equation}
	where $ AW $ is a predefined constant.
\end{definition}
\begin{theorem}
	\label{thm3}
	The proposed direct mechanism satisfy the budget constraint.
\end{theorem}
\begin{pot}
	From the equations \ref{eq1} and \ref{eq9} we have
	\begin{align}
	\label{eq20}
	\sum_{i\in N}{p_i\left(\hat{t}\right)} &=\sum_{i\in N}\left(R\left(t_i,S\left(\hat{t}\right)\right)-t_i \times AW\right) \notag \\ &=\sum_{i\in N}\left(\left(bet_t+AW\right) \times \frac{t_i}{\frac{bet_t}{AW}} \times S\left(\hat{t}\right)-t_i \times AW\right) \\
	&= \left(bet_t+AW\right) \times AR\left(\hat{t}\right)-bet_t, \notag
	\end{align}
	where $AR:T\rightarrow E$ is given in equation \ref{eq8} and $ E=[0,1] $. So for any type profile $\hat{t}\in T$ we have
	\begin{equation}
	\label{eq21}
	-bet_t\le\left(bet_t+AW\right) \times S\left(\hat{t}\right)-bet_t\le AW.
	\end{equation}
	From the equalities \ref{eq21} and \ref{eq20}, we get to $\sum_{i\in N}{p_i\left(\hat{t}\right)\le AW}$ and the proof is complete.
\end{pot}
\subsection{Voluntary Participation Constraint}
Individual rationality or voluntary participation property of a social choice function means that each attacker gains a non-negative utility by participating in the mechanism that implements the social choice function. There are two stages at which individual rationality can be examined. First, when the amount of bet (types) of other attackers $\hat{t}_{-i}$ is unknown to attacker $ i $, and therefore predicting attack-result (i.e. outcome) is impossible. Second, when before the attack phase (ex-post stage), a choice to withdraw from the mechanism is given to all attackers. That is when all the attackers have announced their bet, and an attack-result can be calculated. Note that a truthful attacker that who submit his bet in one transaction incurs two transaction fees, $2 \times \delta$, to withdraw from the mechanism. This property of\textit{ ex-post individual rationality} is stated as follows.
\begin{definition}
	(Ex-post Individual Rationality). We assume the utility, that attacker $ i $ receives by withdrawing from the contract when his type is $t_i$, is equal to $2 \times \delta$. Then, to ensure agent i's participation when withdrawing is allowed at the ex-post stage, we must satisfy the following \textit{ex-post Individual Rationality (or participation)} constraints
	\begin{equation}
	\label{eq22}
	U\left(G(\hat{t}),t_i\right)\geq 2 \times \delta\ \ \forall\hat{t}\in T.
	\end{equation}
\end{definition}

A mechanism satisfies ex-post IR if it implements a social choice function that
satisfies ex-post IR. In the next section, through the numerical simulations, it is shown
that under some mild conditions in a typical scenario, the proposed mechanism satisfies
the ex-post Individual Rationality constraint.

Note that these conditions can be declared as rules in CSC by the sponsor. For
instance, he can condition the attack on a specified amount of total bets, or he can
restrict attackers' type by specifying upper bound and lower bound on acceptable bets.

\subsection{Fairness}
Different definitions for fairness have been proposed in the literature including
proportional fairness, max-min fairness, $ \alpha- $fairness \cite{trichakis2011fairness}. To measure the fairness of
the proposed incentive mechanism, we need a metric that captures how close the
payment obtained by this mechanism is to fair payment. By fair payment, we mean
reward allocation based on the contribution of attackers (instead of the amount of their
bet). In other words, if attackers could prove their contribution, then the reward
allocation function would simply be a function of their contribution and the attack-result.
We denote the fair payment by $ P_i\prime $ that is
\begin{equation}
\label{eq23}
p_i^\prime(\hat e) = AW \times e_i \times e_{tot}.
\end{equation}

Similar to \cite{da2009resource}, we consider a metric, which we call the fairness-score, based on the
root mean square (RMS) of the difference between the mechanism payment and the fair
payment. The fairness-score is defined as
\begin{equation}
\label{eq24}
D_{rms} = \sqrt {\frac{1}{n} \sum_{i\in N} \left ( p_i(\hat t) - P_i^\prime (\hat e)\right)^2},
\end{equation}
where $ p_i(\hat t) $ is stated in equation \ref{eq9}. A value of zero for $ D_{rms} $ indicates that the
mechanism payment equals to the fair payment, which discourages free-riders and
rewards contributors. As the value increases, the reward allocation becomes less fair,
and absolute fairness is achieved when $ D_{rms} = 0 $.

\section{Numerical Analysis and Discussion}
\label{sec6}
In this section, through the numerical simulations and in a typical scenario, we
analyze how the payments and the attack-result evolve for the various system
parameters. As we study in the game analysis (section \ref{sec42}), there are three key parameters
$ b_t, AW, Cost(e_{th} $ and the type profiles $ \hat t = (t_1,..., t_n) $ that are effective on the outcome
(i.e., the payments and the attack-result). Furthermore, as we discussed in section \ref{sec41}, the reward allocation function has a significant impact on the attack-result and
its features, such as the fairness of its payments and individual rationality of the
attackers.
\begin{figure}[ht]
	\centering
	\begin{subfigure}[b]{.32\textwidth}
		\centering
		\includegraphics[width=\textwidth]{fig4.png}
		\caption{\hspace{1cm}}
	\end{subfigure}
	\begin{subfigure}[b]{.32\textwidth}
		\centering
		\includegraphics[width=\textwidth]{fig5.png}
		\caption{\hspace{1cm}}
	\end{subfigure}
	\begin{subfigure}[b]{.32\textwidth}
		\centering
		\includegraphics[width=\textwidth]{fig6.png}
		\caption{\hspace{1cm}}
	\end{subfigure}
	\caption{The impact of increasing $ \theta $ for fixed $ \gamma $=0.35 on (a) the attack-result (b) the proportion of the allocated award to attackers, and (c) the fairness-score of payment.}
	\label{Fig456}
\end{figure}
In this section, we conduct numerical simulations to evaluate the performance
of the proposed attack under two different reward allocation functions: linear and
square. In the former, the reward is allocated in linear proportion to the amount of bet,
as stated in equation \ref{eq1}. Whereas, in the latter, it is allocated proportionally to the square
of the amount of bet. The square reward allocation function is shown in the following
equation
\begin{equation}
\label{eq25}
\dot{R}(\hat t, e_{tot})=(bet_t + AW) \times \frac{t_i^2}{\sum_{i\in N}t_i^2} \times e_{tot}.
\end{equation}

Note that the theoretical (game and mechanism) analysis conducted on the linear reward
function holds on square reward function, too. The parameter values used in this study are as follows: $ n=30, bet_i \sim Uni(bet_{min},bet{max}), \dfrac{bet_{max}}{bet_{min}}=\dfrac{1}{10}  $ (unless explicitly stated otherwise), and the results are averaged over 50 randomly chosen attackers' amount of bet.
\begin{figure}[ht]
	\centering
	\begin{subfigure}[b]{.49\textwidth}
		\centering
		\includegraphics[width=\textwidth]{fig8.png}
		\caption{\hspace{1cm}}
	\end{subfigure}
	\begin{subfigure}[b]{.49\textwidth}
		\centering
		\includegraphics[width=\textwidth]{fig9.png}
		\caption{\hspace{1cm}}
	\end{subfigure}
	\caption{The effect of $ \theta $ and $ \gamma $ on (a) the attack-result, and (b) ratio of average profit over average bet size, with fixed number of attackers $ n = 30 $.}
	\label{Fig89}
\end{figure}
It is reasonable to assume an upper bound on the result of the attack since, based on the terms of the contract, the reward is fully allocated to attackers once the total
contribution of attackers equals to desired attack-traffic. Thus, putting in more effort and contributing more will increase the attack-result but will not bring them more rewards. We assume that the attackers can become aware of the total effect of the
collaborative attack on the target, so they will not over-attack, and when a successful attack is carried out, the attackers have no incentive to continue participating in the attack. Let $ \theta $ denote the ratio of the total amount of bets, submitted by attackers to the value of the award, deposited by the sponsor, i.e., $ \theta = \frac{b_t}{AW} $, and let the cost factor $ \gamma $ be the ratio of cost of launching the sponsor's desired attack to the considered award, i.e., $ \gamma = \dfrac{Cost(e_{th})}{AW}$.

From the figure \ref{Fig456}(a), we can observe that the attack-result (i.e., the sum of contributions of attackers in the equilibrium) increases proportionally to the increase in the value of $ \theta $. According to this Figure, the square reward scheme attracts significantly more contribution compared to the linear reward scheme with the same value of $ \theta $.
Considering the square reward scheme for fixed cost factor $ \gamma = 0.35 $ and fixed $ \theta = 1 $ as an example, we can see that the expected attack-result $ e_{tot}^\star $ would be around $ 90 \% $ of the desired attack-result $ e_{th} $.
Based on the attack cost function, stated in equation \ref{eq2}, launching $ 90 \% $ of the desired attack-result incurs around $ 80 \% $ of the total cost of a successful attack. Figure \ref{Fig456}(b) shows that the square reward scheme pays $ 75 \% $
of the considered award and the remaining $ 25 \% $ of the award will be paid for reaching the desired attack-result $ e_{th} $.
Figure \ref{Fig456}(c) demonstrates that after hitting the desired
attack-result, in both rewarding schemes, the fairness-score drops.

We further analyzed the effect of increasing $ \theta $, which, in turn, causes an increase in attack-result and, consequently, a growth in the total cost incurred by attackers.
Figure \ref{Fig7} plots the ratio of the total cost to award when the cost factor (i.e., $ \gamma = \dfrac{Cost(e_{th}}{AW}$) is varied from $ 0.3 $ to $ 0.5 $, and $ \theta $ in each of the values of the cost factor is varied from $ 0.2 $ to $ 2 $. From this Figure, we observe that collaboration among attackers has a strong impact on reducing their cost.
\begin{figure}[ht]
	\centering
	\includegraphics[width=0.5\textwidth]{fig7.png}
	\caption{The effect of $ \theta $ and the number of attackers for fixed $ \gamma=0.35 $ against the attack-result}
	\label{Fig7}
\end{figure}
Figure \ref{Fig89}(a) shows that as expected, the required $ \theta $ for providing the incentive of launching a successful attack increases proportionally to the increase in the cost factor $ \gamma $.
In other words, the points where the curves' slopes in Figure \ref{Fig456}(c) drop to zero are where the attack-result reaches its desired value, and as we can see with the increase in cost factor $ \gamma $, there is an increase in required $ \theta $ to reach these points.
In Figure \ref{Fig89}(b), the red region denotes the situations that the incentive mechanism satisfies the desirable property of individual rationality. Note that decreasing the amount of award $ AW $, causes an increase in both $ \theta $ and $ \gamma $, which in turn can reduce the average profit of attackers and, therefore, may end up decreasing the attackers' participation incentive.

In Figure \ref{Fig7}, we observe that increasing the number of attackers with a fixed amount of total bet (i.e., accepting smaller bets) decreases the attack-result. As shown in this Figure, the required $ \theta $ for providing the incentive of launching a successful attack increases proportionally to the increase in the number of attackers.
\section{Conclusion and Future Work}
\label{sec7}
In this paper, we introduced the idea of using criminal smart contracts (CSCs) as an
incentive mechanism for carrying out real-world targeted attacks, which are launched
by several collaborating attackers without any knowledge or trust among them. To
study the feasibility of this idea, we proposed a CSC for the case of a collaborative
distributed denial of service (DDoS) attack. We modeled the attack by a game among
attackers to investigate the attack-result and identify its key factors. We showed that
the attack-sponsor could design a cheat-proof and budget-balanced mechanism to
encourage the participation of selfish rational attackers. Furthermore, he can predict
and adapt the attack-result, i.e., under exactly what conditions attackers will participate
in the attack. Simulation results show that, under some mild assumptions, the proposed
incentive mechanism provides individual rationality and fair allocation of the award for
collaborative attackers.
The anonymity of transactions and autonomous execution of smart contracts, which
eliminates the need to trust, have turned the public blockchain into a substitute for
criminals' underground market. We demonstrated how cybercriminals could benefit
from carefully designed incentive mechanism based on a smart contract that has
desirable game-theoretic properties and attack results. In addition, from an economic
point of view, the cost associated with the execution of a collaborative attack in
Ethereum blockchain is relatively small, compared to the invested capital in a typical
scenario of a DDoS attack. Furthermore, CSC opens up the possibility of aligning the
interests of multiple attack-sponsors in a trustless manner. The simplest crowdfunding
approach would be to allow other attack-sponsors to raise the award as soon as the CSC
has been deployed. The awards can even be conditioned by specifying a higher level of
attack-result. The target is also vulnerable to side attacks from others who would benefit
from this attack.
Although there is currently no effective or realistic measure against launching such
attacks, it is important to point out that the target can devise defense strategies since the
attack details are recorded on the public blockchain. In other words, the target could
predict the type of attack-traffic and would take an appropriate defense strategy at the
time of the attack. In this work, we did not consider the impact of defense on the cost
of generating effective attack-traffic. We also assumed attackers as homogeneous
agents in terms of the cost of contributing to the attack, and we assumed that all of the
generated traffic is effective attack-traffic. In future, we plan to refine the model and,
more specifically, we will consider different types of attackers and have a defender as
an extra player in the game. We hope that this study will act as a good starting point for
designing effective strategies to prevent this sort of attack.

\section*{Acknowledgement}
I am grateful to Dr.Hamed Kebriaei for providing precious feedbacks, and to Moen Kafi and Mohammad Shokri for our fruitful discussions.

redpajama_set_name: RedPajamaArXiv


A friend recently came to visit and naturally, we spent a lot of time chatting about faith. This isn't anything new as I talk about faith a lot—all the time, actually. After all, I am finishing up a degree in theology and it requires that I think and write about faith well over 40 hours a week.
It's actually pretty mentally and emotionally exhausting, now that I think of it—which is why I so crave carbs and a glass of red wine at the end of most days.
Most of my conversations with my visiting friend about faith revolved around the things I once thought fit neatly into perfectly separated folders in the desktop of my mind. The folder for "Christianity" had several subfolders: "Christology," "Ecclesiology," "Soteriology," etc. I even had a "Calvinism" folder with even still subfolders, one for each letter of TULIP.
Oh, how complicated it all was back then. Which is ironic, you'd think such a neatly compartmentalized "faith" would make life simpler, no?
Well yea, that would be true if we lived in a Black and White world. But let's face it, we don't. I'm sure we can all agree that most of life takes place in the mess—in the grey areas, doesn't it?
Let's take racism, for example. I'm sure, we can all agree that it's wrong. But many people want to pretend that it's "Black and White" (no pun intended). Many people I've spoken to (or read Facebook posts from) assume racism is simply "a heart issue." The problem with this is that it removes all responsibility from any of us to dismantle it, because, well, "it's simple: it's a personal problem." And trust me, I wish it were that simple. What perhaps is foundationally "a heart issue" has permeated into a societal, systemic issue. Racism exists in the grey area: in stereotypes, in microaggressions, in the fact that Black men get shot not only in their own homes, but even when they're doing the right thing by protecting active shooters. Racism isn't just about slavery. It's more than that. It's complicated. It's grey.
You can apply this same idea to not only all social issues, but life in general.
How do you convince a new mother who's just lost her infant daughter that God is good? Or a young girl who's just been sexually assaulted by a family member and finds herself pregnant? Or a father of three who is dealing with mental illness that's affecting his entire family?
There are no easy answers. Life is complicated. Faith is complicated.
But the more I study Scripture, the more I recognize a God who is well acquainted with the complicated—a God who we're told created people and then regretted it (Genesis 6). A God who wanted to wipe out folks, but then had a change of heart when asked to reconsider (Numbers 14).
A God who became human and wasn't disconnected from society, standing on the outside, telling people what to do. Instead, God stepped in the muck, broke "purity laws" by engaging with the outcast—those deemed too dirty or too broken. When people died, God wept (John 11). When they were about to be stoned (for reasons justifiable at that time), God intervened (John 8).
It's interesting, when I read the Torah, I don't just see a bunch of nonsensical laws that need be dismissed, but I can see a story of a God completely aware of the complicated—of the grey area. According to Deuteronomy 22, there are different punishments for men who sexually assault women in the middle of the town in front of everyone, verses men who sexually assault women out in the country where no one else is around (and yes, both instances involve the man being executed). Now, of course we understand that these laws were written thousands of years ago when culture, society and life was completely different, but the point is that they're oddly detailed and very circumstantial because, well, life was (and still is) intricate, complex…complicated.
Maybe Scripture feels like a hot mess most of the time because it's a story of a God choosing to get dirty and to exist in the grey, among complicated people. And I think this should not only give us hope, but should inform our Christian ethic. Perhaps it's not about making perfect sense of Christianity, having all the answers, knowing or deciding who's in and who's out. Perhaps it's about sitting with God and with others in the muck, not being afraid of the mess, and living out our faith intentionally and carefully in each unique situation.


We provide fast, accurate and relevant information on the latest developments shaping policy and legislation in the UK and EU via an intelligent online portal that consolidates multiple sources and channels.
We put our customers at the heart of the political agenda by providing mission-critical information and analysis, so they get the insight they need when they need it.
Connect: identify and engage with the key political figures shaping the policies that matter.
Make informed strategic decisions: identify and anticipate new opportunities and political risk.
Manage reputation: track and interpret what stakeholders are saying about their organisation.
Read about our service in more detail.
We have built up years of policy expertise across a range of sectors, including: digital and technology, education, energy and environment, financial services, health and pharmaceuticals, and transport and infrastructure.
We deliver political intelligence to public affairs and communication professionals within businesses, membership organisations, charities and in the public sector.
We believe in partnering with our customers to provide a completely tailored solution. We take time to understand your priorities.
We save our customers precious time, resources and money. We deliver essential information as it happens, distilled into easy-to-use bulletins.
We're proud of our UK and EU political expertise. Our teams live and breathe politics, so our clients receive a dedicated resource to help them navigate their political landscape.
We continually invest in our technology, to deliver more precise information, faster.
Here is a selection of comments about DeHavilland. Visit our testimonials page for more.
To register for a short demonstration of our political intelligence services or request a full-featured trial, call us now on +44 (0) 20 3033 3870.
To find out more about our EU political intelligence and monitoring services visit DeHavilland EU.
DeHavilland is part of Ascential plc.


text:
<?php

namespace PharmaIntelligence\GstandaardBundle\Model\map;

use \RelationMap;
use \TableMap;

/**
 * This class defines the structure of the 'gs_leveranciersassortimenten' table.
 *
 *
 *
 * This map class is used by Propel to do runtime db structure discovery.
 * For example, the createSelectSql() method checks the type of a given column used in an
 * ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
 * (i.e. if it's a text column type).
 *
 * @package    propel.generator.src.PharmaIntelligence.GstandaardBundle.Model.map
 */
class GsLeveranciersassortimentenTableMap extends TableMap
{

    /**
     * The (dot-path) name of this class
     */
    const CLASS_NAME = 'src.PharmaIntelligence.GstandaardBundle.Model.map.GsLeveranciersassortimentenTableMap';

    /**
     * Initialize the table attributes, columns and validators
     * Relations are not initialized by this method since they are lazy loaded
     *
     * @return void
     * @throws PropelException
     */
    public function initialize()
    {
        // attributes
        $this->setName('gs_leveranciersassortimenten');
        $this->setPhpName('GsLeveranciersassortimenten');
        $this->setClassname('PharmaIntelligence\\GstandaardBundle\\Model\\GsLeveranciersassortimenten');
        $this->setPackage('src.PharmaIntelligence.GstandaardBundle.Model');
        $this->setUseIdGenerator(false);
        // columns
        $this->addColumn('bestandnummer', 'Bestandnummer', 'INTEGER', false, null, null);
        $this->addColumn('mutatiekode', 'Mutatiekode', 'INTEGER', false, null, null);
        $this->addPrimaryKey('assortimentsnummer', 'Assortimentsnummer', 'INTEGER', true, null, null);
        $this->addForeignKey('zinummer', 'Zinummer', 'INTEGER', 'gs_artikelen', 'zinummer', false, null, null);
        $this->addColumn('intern_artikelnummer_assorthouder', 'InternArtikelnummerAssorthouder', 'VARCHAR', false, 255, null);
        $this->addColumn('faktor_van_het_artikelnummer', 'FaktorVanHetArtikelnummer', 'DECIMAL', false, 6, null);
        $this->addColumn('omschrijving', 'Omschrijving', 'VARCHAR', false, 255, null);
        $this->addColumn('assortimentshouder', 'Assortimentshouder', 'INTEGER', false, null, null);
        $this->addColumn('datum_van_ingang', 'DatumVanIngang', 'DATE', false, null, null);
        $this->addColumn('retourtermijn', 'Retourtermijn', 'INTEGER', false, null, null);
        $this->addColumn('retouraanduiding', 'Retouraanduiding', 'VARCHAR', false, 255, null);
        $this->addColumn('retourpercentage', 'Retourpercentage', 'INTEGER', false, null, null);
        $this->addColumn('assortimentsprijs', 'Assortimentsprijs', 'DECIMAL', false, 8, null);
        $this->addColumn('opgegeven_verkoopprijs', 'OpgegevenVerkoopprijs', 'DECIMAL', false, 8, null);
        $this->addColumn('btwkode_van_assortimentshouder', 'BtwkodeVanAssortimentshouder', 'INTEGER', false, null, null);
        $this->addColumn('hoeveelheid', 'Hoeveelheid', 'DECIMAL', false, 8, null);
        $this->addColumn('eenheid', 'Eenheid', 'VARCHAR', false, 255, null);
        $this->addColumn('ean_barcode', 'EanBarcode', 'BIGINT', false, 14, null);
        $this->addColumn('hibc_barcode', 'HibcBarcode', 'VARCHAR', false, 255, null);
        $this->addColumn('minikaart_kode', 'MinikaartKode', 'INTEGER', false, null, null);
        $this->addColumn('bestelmogelijkheid', 'Bestelmogelijkheid', 'VARCHAR', false, 255, null);
        // validators
    } // initialize()

    /**
     * Build the RelationMap objects for this table relationships
     */
    public function buildRelations()
    {
        $this->addRelation('GsArtikelen', 'PharmaIntelligence\\GstandaardBundle\\Model\\GsArtikelen', RelationMap::MANY_TO_ONE, array('zinummer' => 'zinummer', ), null, null);
    } // buildRelations()

} // GsLeveranciersassortimentenTableMap

redpajama_set_name: RedPajamaGithub


This documentary is an exploration of identity and culture through food.
Living in a busy metropolis causes distance between people. Everyone tries to avoid unnecessary hindrances in life. The main character gets influenced by the aloof environment and loses his identity throughout the incidents. However, this leads to an extraordinary adventure which in the end, finds himself with a special one's help.
For every child it is scary to be the 'new kid' at school, but if you come from another country and don't speak the language, it must be terrifying. Advisory: mentions the death of a parent.
This is the story of a friendship and burgeoning love between two Romanian Gypsy kids in a camp on the outskirts of Bari in southern Italy. Vitalis just arrived from Romania. Although Giuly takes Vitalis to school on his first day, his classmates bully him. Giuly and Vitalis never read the screenplay, and use their real names in the film.
Weary of traveling and working on farms around the country with her brother and father, a young girl rebels, with unintended consequences. A coming-of-age story, To the Bone is a window into the world of child migrant farmworkers in the US; it's an intimate film about one family that represents the struggles of so many.


text:
Q: random subset of fixed length such that each group is present at least N times I want to select 5 rows from each values in column1 of df such that the output has at least 1 value for each unique value in column2.
Also there should not be any duplicates in the output
Edit: There should not be duplicates in (column1, column3) pair:
i.e For each value in column1 all values in column3 should be unique
column1 = rep(c("a","b"), each = 12)
column2 = rep(c(1,2,3), each = 4)
column3 = c("x1","x2","x3","x4","x5","x3","x6","x7","x8","x1","x9","x5","x6","x2","x3","x4","x7","x5","x6","x1","x4","x1","x6","x9")

df = data.frame(column1, column2, column3)

Here is a valid solution
sample_output_1 = data.frame(column1 = rep(c("a","b"), each = 5),
                         column2 = c(1,1,2,2,3,1,1,2,2,3),
                         column3 = c("x1","x2","x5","x3","x8","x6","x2","x5","x1","x9"))

A: Check this
foo = function(a_df){
    inds = 1:NROW(a_df)
    #Sample 5 indices along the rows of a_df
    my_inds = sample(inds, 5)
    #If subset of a_df based on my_inds has duplicates
    #Or if 2nd column does not have all unique values
    while(any(duplicated(a_df[my_inds, c(1, 3)])) &
        !identical(sort(unique(a_df[my_inds, 2])), sort(unique(a_df[[2]])))){
            #Count the number of duplicates or missing all values
            n = sum(duplicated(a_df[my_inds, c(1, 3)]))
            n = n + sum(!sort(unique(a_df[my_inds, 2])) %in% sort(unique(a_df[[2]])))
            #Remove my_inds from inds
            inds = inds[!inds %in% my_inds]
            #Remove the n indices that create duplicates from my_nds
            my_inds = my_inds[!duplicated(a_df[my_inds, c(1, 3)])]
            #Sample n more from inds and add to my_inds
            my_inds = sample(c(my_inds, sample(inds, n)))
        }
        return(a_df[my_inds,])
}

set.seed(42)
do.call(rbind, lapply(split(df, df$column1), function(a) foo(a_df = a)))
     # column1 column2 column3
# a.11       a       3      x9
# a.12       a       3      x5
# a.3        a       1      x3
# a.8        a       2      x7
# a.6        a       2      x3
# b.19       b       2      x6
# b.21       b       3      x4
# b.14       b       1      x2
# b.18       b       2      x5
# b.23       b       3      x6

redpajama_set_name: RedPajamaStackExchange


Unlike any other case packer in the paper packaging industry, the ACCU-PACK 6000 automatic case packer cases wrapped reams of paper, and bulk sheets of paper, all in one machine! The Accu-Pack 6000 is also capable of producing a two-piece box style or a one-piece clam shell style box. To change from one style box to another is as simple a push of a button. Contact us for details.
12 axis of servo controlled motion (Allen-Bradley standard, other available upon request).


Finding interrupted is not any enjoyment. If it's at the job or having a friend or family member, becoming the interruptee will make you really feel disrespected and unheard. The good thing: one can find tips for dealing with interrupters.
Inside an grant service, Kanye West disrupts Taylor Swift's acknowledgement conversation to talk about Beyoncé created a greater movie than Tay Tay. Ouch.
A number of these interruptions are more serious than the others, and there's a cause. In reality, you will discover seriously ingrained sociological and linguistic aspects describing why a number of people are more inclined to get disrupted than the others.
Depending on scientific tests by linguists, sociologists, psychologists, and others (quite simply, you can find plenty of scientific studies), persons most likely to be interrupted are women, minorities, and people thought to be cheaper for the totem pole. Bright, heterosexual guys are essentially the most recurrent interrupters, and there's a biological explanation and a societal reason behind that.
Here's the biology: depending on linguistics research, guys usually tend to think about a interaction as a competitiveness: the greater amount of you say, the greater you used the video game. But adult females treat talks as collaboration: if everyone tells you, every person victories.
It's not universally true that white colored men go all around interrupting absolutely everyone different. But these linguistics studies were actually finding at a little something, that can bring us with the societal cause: folks that fit in with a social class that's designed to acquiring power might possibly respond with an unconscious bias. That's the place that the word mansplaining is produced by.http://www.scooterchinois.fr/userinfo.php?uid=8168349 You cannot assume all men of all ages achieve it, then again, not all the men that undertake it realize they're executing it.
Let's get anything instantly: an interrupter isn't necessarily showing disrespect or dismissal. In case a person considers, even subconsciously, that it's fine to disrupt some other person, that could underline an improvement in reputation which could produce the interruptee seem to be much less assertive, much less in control, and as a consequence not as likely to get a marketing or other warning signs of acceptance.
Which way you employ is determined by whomever you're conversing with as well as the context in the chat, so utilize your most effective judgment. No matter whether it's a one-time element or merits an even bigger confrontation, below are some ways to get started out.
There are many strategies to let the interrupter be aware that they cut off and get the surface returning. Only be vigilant the method that you say most of these, since they can come across as indirect extreme or really intense in the event you don't watch your sculpt.
Just continue to keep communicating.
Go for favorable: That's a great problem, Adam, and therefore i was only about to access it.
Courteous re-disruption: I'm sorry, I wasn't rather accomplished (better than Could you let me finish off?).
Stall: Alibi me, Jen, I'm virtually finalized.
Personal-deprecating contact-out: I assume I'm blabbering, so I'll cover it.
Hold out to be able to end, then make a nudge: Very good position, and therefore i was really about to get there.
When the interruptions keep coming, it will be time to take a seat using the interrupter and speak about it. You'll do this differently determined by who the person is.
Know their type. Some managers disrupt to help keep people on the toes; many others get it done subconsciously. Only bring it up if you believe your supervisor may want to know. Assuming you have a employer it is possible to speak with openly, it's also smart to tread lightly.
Make target the profession: I've realized that we get much more designed in group meetings exactly where most people attributes. I'd wish to brainstorm about how to find more collaborative events with less interruptions.
Create the talk concerning your personal components, or shape it a ask for assistance: I would like to make improvements to my speech design and style. Do you possess advice to be even more concise?
Don't issue hands and fingers: I notice consumers at times interrupt.
In scenarios wherever you're not essentially endangering your job for those who say items inappropriate, it's even now crucial to be well-mannered, and even more importantly, not could be seen as you're blaming or attacking the interrupter.
Admit the interrupters might not be conscious they're executing it. Should they don't come to feel attacked by you, they're more inclined to pay attention to what you want them to do diversely.
Store it everyday: I've remarked that quite often you disrupt me when I'm not performed generating a level. I needed to flag it to guarantee you're attentive.
Sometimes, say how you will really feel: When you interrupt me, it can make me believe that you're certainly not paying attention. Do you aim to pay more attention to whether or not I appear like I'm finished with what I'm saying?
If you have the discussion although the interrupter retains interrupting, don't despair. Behaviors perish challenging. If it's somebody in the office, hold out several weeks, then take it up for a second time. If it's a co-workman you're favorable with, possibly increase an eyebrow if they interrupt, or utilize I found myself just reaching that lines.
Assuming you have a friend or family member who's a perform repeatedly offender, check out so that it is playful. Have a tally of interruptions. Engagement ring a bell once they disrupt that'll receive their consideration. Possess a capital bottle: a quarter for almost every disturbance. Why not develop money from the frustrating practice?
When Kanye Western disturbed Taylor Swift's grant acceptance conversation, the crowd booed him for taking gone the limelight. May very well not enjoy a moveable customers of many to check out you about and boo when ever a person disrupts, but now you have some techniques to assist you for the time being.
Browse HTML articles listed here to find sound advice on internet croping and editing as well as other technical-linked subjects!


low price Brush Cutter TBC521D-DJ-521DM wood chopper Of Garden Tools,We mainly provide Blowers, Hedge Trimmers, Generator Series, Chain Saws, Grass Trimmers & Brush Cutters and other garden machinery equipment, long service life, high quality, welcome to come to consult or give us a message.
Demolish brush and saplings up to 3" thick with America's #1 selling brush mower. Walk-behind models up to 20 HP. . Cordless Yard Tools; Gardening; . Wood Cutting .
Shop 19 Chippers, Shredders + Stump Grinders . Highly Rated Wood Chippers. With effective cutting . Create mulch for ground cover and compost for your garden .
Price + Shipping: lowest first; . 5 in 1 52cc Multi Tool Garden Trimmer Brush Cutter Hedge Chainsaw . Brush Blender brush cutter blade for many brands / models of .
Save on garden hand tools at Harbor Freight Tools. Amazingly low discount prices on all kinds of high quality gardening hand tools and garden . Wood Splitting Wedge .
Expand-It 8 in. Brush-Cutter Trimmer . I thought I had wasted big bucks buying the Ryobi 40 volt tools, but this brush cutter purchase takes a . The Home Depot .
Rotary Cutter & Disc Mower Blades Rotary Cutter & Disc Mower Blades. . Price Low; Price High; A - Z; Z - A . Add to Cart More Rotary Cutter & Disc Mower Blades .
Shop our selection of Tree Pruners in the Outdoors Department at The Home Depot. . Price Low to High; . Garden Center Tool Type.
Buy low price, high quality chopper for garden with worldwide shipping on . LETAOSK Recoil Pull Starter Garden Lawn Brush Cutter Tools Fit for 33 36 . wood for .
Buy low price, high quality woods cutter parts with worldwide shipping on AliExpress.com . wood chopper tool cutting machines plate . Garden Tool Parts.
Price + Shipping: lowest first; . 2012 Vermeer BC600XL Towable Wood and Brush Chipper Low Hours 27HP Kohler . . 2009 VERMEER BC1000XL WOOD CHIPPER / BRUSH CUTTER .
Northern Industrial Tools Northern . atv pull behind mowers . Swisher Rough Cut Tow-Behind Trailcutter with Electric Start — 52in.W Cutting Deck .
. Sun Joe Electric Yard Garden Wood . Steel Splitter Point Hammer Type Wedge Log Splitting Tool for Firewood Chopper. . you can enjoy Every Day Low Prices .
SHIMAHA 26CC Gas Brush Cutter/Trimmer with Shoulder Strap, Red . I do not call this a grass trimmer it is indeed a brush chopper. . because of the low price.
Alibaba.com offers 5,137 grass cutter machine price products. . brush cutter/grass cutter machine price in the . 2-Stroke garden tools grass cutter machine price.
Top quality power tools and hand tools from leading manufacturers at Trade prices. . Garden Tools. Spares Maintenance . Power Tools for Sale from Power Tools Direct.
Price Low; Price High; A - Z; Z - A . Add to Cart More Handles More Lawn and Garden More Information. WOOD CHOPPER MAUL HANDLE . lawn tools and other gardening .
Fence line clearing is an additional benefit from easy brush cutting as the Brushshark works . The low profile design enables it become vertical at low height so .
Leaves, twigs and branches clutter a lawn, but a chipper shredder gives you an efficient way to reduce the debris and use it around the garden or landscape.