From e88d2c931fee9cb9c5746f6ae46cf49494a60708 Mon Sep 17 00:00:00 2001
From: Robert Martin-Legene <robert@nic.ar>
Date: Tue, 11 Sep 2018 14:53:55 -0300
Subject: [PATCH] PoC for flooding the network with transactions

---
 bin/txflood.sh | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100755 bin/txflood.sh

diff --git a/bin/txflood.sh b/bin/txflood.sh
new file mode 100755
index 0000000..1d20bbd
--- /dev/null
+++ b/bin/txflood.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+if [ -z "${BFAHOME}" ]; then echo "\$BFAHOME not set. Did you source bfa/bin/env ?" >&2; exit 1; fi
+source ${BFAHOME}/bin/libbfa.sh || exit 1
+
+cd $BFAHOME
+
+while :
+do
+  while num=` $BFAHOME/bin/numpending.sh `; [ $num -lt 2500 ]
+  do
+    contract=$(	readlink ${BFANETWORKDIR}/contracts/TimestampDocument	)
+    abi=$(		cat ${BFANETWORKDIR}/contracts/${contract}/abi		)
+    (
+	echo "var mycontract  = eth.contract(JSON.parse($abi));"
+	echo "var thecontract = mycontract.at(\"$contract\");"
+	n=0
+	SECONDS=0
+	while [ $n -lt 10000 -a $SECONDS -lt 600 ]
+	do
+		n=$(( $n + 1 ))
+		echo "thecontract.storeDocument.sendTransaction( \"dagenidag.${n}\", {from: eth.accounts[0], gas: 1000000});"
+	done
+    ) |
+    geth_attach
+
+  done
+  echo `date`: $num pending.
+  sleep 2
+done
+
-- 
GitLab