Created
March 14, 2017 11:11
-
-
Save xeroc/ff28c967e065189c2d99fc370a56122d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
import time | |
import json | |
import random | |
from grapheneapi.grapheneapi import GrapheneAPI | |
def run(n=0): | |
client = GrapheneAPI("localhost", 8092, "", "") | |
while True: | |
for i in range(0, random.randint(1, 100)): | |
print(n, end="", flush=True) | |
client.transfer("faucet", "init0", "0.00007", "TEST", "", True) | |
time.sleep(random.randint(0, 3)) | |
for i in range(0, 50): | |
threading.Thread(target=run, args=(i,)).start() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pprint import pprint | |
import time | |
import json | |
import random | |
from grapheneapi.grapheneapi import GrapheneAPI | |
import threading | |
def run(n=0): | |
client = GrapheneAPI("localhost", 8092, "", "") | |
transfer = client.get_prototype_operation("transfer_operation") | |
from_account = client.get_account("faucet") | |
to_account = client.get_account("xeroc") | |
transfer[1]["to"] = to_account["id"] | |
transfer[1]["from"] = from_account["id"] | |
transfer[1]["amount"]["amount"] = 3 | |
while True: | |
builder = client.begin_builder_transaction() | |
for i in range(0, 5000): | |
print(n, end="", flush=True) | |
client.add_operation_to_builder_transaction(builder, transfer) | |
client.set_fees_on_builder_transaction(builder, "1.3.0") | |
print("\nTransfer!") | |
client.sign_builder_transaction(builder, True) | |
time.sleep(random.randint(0, 3)) | |
return | |
for i in range(0, 1): | |
threading.Thread(target=run, args=(i,)).start() | |
time.sleep(random.randint(0, 10)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import psutil | |
import threading | |
import time | |
import json | |
import random | |
from grapheneapi.grapheneapi import GrapheneAPI | |
import subprocess | |
def wallet(port): | |
print("Starting new wallet on port %d" % port) | |
proc = subprocess.Popen([ | |
"/home/xeroc/BitShares/testnet/testnet/programs/cli_wallet/cli_wallet", | |
"--server-rpc-endpoint=wss://node.testnet.bitshares.eu", | |
"--rpc-http-endpoint=127.0.0.1:%d" % port, | |
"--wallet-file=/home/xeroc/BitShares/testnet/testnet/wallet.json", | |
"--daemon" | |
]) | |
return proc | |
def kill(proc): | |
proc.terminate() | |
def run(port, n=0): | |
client = GrapheneAPI("localhost", port) | |
client.unlock("password") | |
transfer = client.get_prototype_operation("transfer_operation") | |
from_account = client.get_account("faucet") | |
to_account = client.get_account("xeroc") | |
transfer[1]["to"] = to_account["id"] | |
transfer[1]["from"] = from_account["id"] | |
transfer[1]["amount"]["amount"] = 1 + n | |
while True: | |
builder = client.begin_builder_transaction() | |
for i in range(0, 200 + random.randint(0, 100)): | |
print(n, end="", flush=True) | |
client.add_operation_to_builder_transaction(builder, transfer) | |
client.set_fees_on_builder_transaction(builder, "1.3.0") | |
print("\nTransfer!") | |
client.sign_builder_transaction(builder, True) | |
time.sleep(random.randint(0, 3)) | |
def flooder(n=0): | |
port = 9900 + n | |
p = wallet(port) | |
time.sleep(15 + random.randint(0, 5)) | |
run(port, n) | |
print("sleep 10") | |
time.sleep(10) | |
kill(p) | |
for i in range(0, 5): | |
threading.Thread(target=flooder, args=(i,)).start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment