Giter Site home page Giter Site logo

evm-tps's Introduction

Simple EVM TPS tool

git clone https://github.com/arturgontijo/evm-tps.git
cd evm-tps

yarn

Change network's parameters ("local") in hardhat.config.json:

Change test's parameters in config.json:

  1. This will deploy the ERC20 contract and will send 30,000 transferLoop() transactions, asserting final Other's token balance:
{
    "variant": "substrate",
    "senders": ["0x99B3C12287537E38C90A9219D4CB074A89A16E9CDB20BF85728EBD97C343E000"],
    "receivers": ["0x99B3C12287537E38C90A9219D4CB074A89A16E9CDB20BF85728EBD97C343E005"],
    "sendRawTransaction": true,
    "tokenAddress": "",
    "tokenMethod": "transferLoop",
    "tokenAmountToMint": 1000000000,
    "tokenTransferMultiplier": 1,
    "tokenAssert": true,
    "transactions": 30000,
    "gasPrice": "",
    "gasLimit": "200000",
    "txpoolMaxLength": -1,
    "txpoolMultiplier": 2,
    "txpoolCheckInterval": 1000,
    "txpoolCheckDelay": 250,
    "delay": 0,
    "estimate": false
}
  1. This one already has the token deployed at tokenAddress, so it will only send 30,000 transferLoop() (5 * transfer()) transactions + tokenAssert:
{
    "variant": "substrate",
    "senders": ["0x99B3C12287537E38C90A9219D4CB074A89A16E9CDB20BF85728EBD97C343E000"],
    "receivers": ["0x99B3C12287537E38C90A9219D4CB074A89A16E9CDB20BF85728EBD97C343E005"],
    "sendRawTransaction": true,
    "tokenAddress": "0x030c5D377E202F52CF30b7f855e09aC0589D53ab",
    "tokenMethod": "transferLoop",
    "tokenAmountToMint": 1000000000,
    "tokenTransferMultiplier": 5,
    "tokenAssert": true,
    "transactions": 30000,
    "gasPrice": "",
    "gasLimit": "200000",
    "txpoolMaxLength": -1,
    "txpoolMultiplier": 2,
    "txpoolCheckInterval": 1000,
    "txpoolCheckDelay": 250,
    "delay": 0,
    "estimate": false
}
  1. This one has a transfer() hardcoded in the payloads field:
{
    "variant": "substrate",
    "senders": ["0x99B3C12287537E38C90A9219D4CB074A89A16E9CDB20BF85728EBD97C343E000"],
    "receivers": ["0x99B3C12287537E38C90A9219D4CB074A89A16E9CDB20BF85728EBD97C343E005"],
    "sendRawTransaction": true,
    "tokenAddress": "0x030c5D377E202F52CF30b7f855e09aC0589D53ab",
    "tokenMethod": "transferLoop",
    "tokenAmountToMint": 1000000000,
    "tokenTransferMultiplier": 1,
    "tokenAssert": true,
    "transactions": 30000,
    "gasPrice": "",
    "gasLimit": "200000",
    "txpoolMaxLength": -1,
    "txpoolMultiplier": 2,
    "txpoolCheckInterval": 1000,
    "txpoolCheckDelay": 250,
    "delay": 0,
    "estimate": false,
    "payloads": [
        {
            "data": "0xa9059cbb000000000000000000000000ea8d69db60401a766e1083beba3a34cafa13151c0000000000000000000000000000000000000000000000000000000000000001",
            "from": "0x48A78AeA1c4F8C24EDfE7FE0973F05D3f3d1763C",
            "to": "0x030c5D377E202F52CF30b7f855e09aC0589D53ab"
        }
    ]
}
  1. This one sends ETH (send()) via payloads field and assert the destination "to" ETH balance at the end:
{
    "variant": "substrate",
    "senders": ["0x99B3C12287537E38C90A9219D4CB074A89A16E9CDB20BF85728EBD97C343E342"],
    "receivers": ["0x99B3C12287537E38C90A9219D4CB074A89A16E9CDB20BF85728EBD97C343E005"],
    "sendRawTransaction": true,
    "tokenAddress": "",
    "tokenMethod": "transferLoop",
    "tokenAmountToMint": 1000000000,
    "tokenTransferMultiplier": 1,
    "tokenAssert": false,
    "transactions": 30000,
    "gasPrice": "",
    "gasLimit": "200000",
    "txpoolMaxLength": -1,
    "txpoolMultiplier": 2,
    "txpoolCheckInterval": 1000,
    "txpoolCheckDelay": 250,
    "delay": 0,
    "estimate": false,
    "payloads": [
        {
            "from": "0x6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b",
            "to": "0xEA8D69Db60401A766e1083bebA3A34cAfa13151C",
            "value": "0x1414"
        }
    ]
}

To run the script:

npx hardhat run scripts/tps.ts --network local

To run it with a different config.json file (eg config2.json):

EVM_TPS_CONFIG="path/to/config2.json" npx hardhat run scripts/tps.ts --network local

evm-tps's People

Contributors

arturgontijo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.