Run the Examples

Arcology provides several concurrent examples to help you get started. These examples demonstrate the basics of building concurrent applications on the Arcology Network using Arcology’s concurrent library.

Prerequisites

You need the following tools installed on your machine:

  • Node.js 20.x or upper

  • Yarn

  • Git

  • Docker

  • VS Code

  • Hardhat

Minimum Hardware

  • 4 CPU cores

  • 16GB RAM

  • 100GB free disk space

Benchmark Hardware

  • 32 CPU cores or upper

  • 256GB RAM or more

  • 1000GB (NVMe SSD) free disk space or more

Set up the DevNet

Creates env var localip for your machine’s local IP (example shown: 192.168.1.109). Then start the Arcology DevNet Docker container, replacing the IP address with your machine's local IP.

Linux

macOS

Download and start the DevNet docker image:

You should see an output similar to this:

Check the Docker Container

Check if the Docker container is running properly:

Check the DevNet Status

Install the Arcology frontend tools globally:

Check if your DevNet is running properly by using the arcology.net-monitor tool:

If the DevNet is running properly, you should see an output similar to this:

Install the Examples

Pull the latest Arcology examples repository and install the Arcology frontend tools:

Structure

The examples are organized into folders.

  • Account: Testing accounts. Columns: private key, account address, initial balance (wei).

  • Scaffold: Starting point for building concurrent applications.

  • eth-examples: Parallelized examples derived from some of the Ethereum examples (see https://docs.soliditylang.org/en/v0.8.24/solidity-by-example.html).

  • ds-token: A parallelized version of ds-token (https://github.com/dapphub/ds-token).

  • uniswap: A parallelized version of uniswap v3 (https://github.com/Uniswap/uniswap-v3-core).

The scaffold folder is a good starting point for trying out the examples.

Run an Example

1

Update the Configuration

Each example folder contains a network.json file. It holds the info for connecting to your local node and some testing accounts. Replace the url field with your node's (DevNet docker) RPC URL.

Example network.json:

2

Run the Test Script

Optionally, you can avoid SSH authentication by configuring Git to use HTTPS instead of SSH:

Run the test script inside the example folder (e.g. scaffold):

Benchmarking

The real-time TPS and gas consumption metrics are very much related to the performance of your machine. Machines with more CPU cores and higher clock speeds will yield better results.

The benchmark folder in each example contains transaction generation scripts, each in its own subfolder. For example, the Like project has its transaction generation script at:

1

Generating Transactions

This process may take quite a while, depending on the number of transactions you want to generate and your machine's performance.

A transaction generation script is located under each /benchmark/<project>/. Run the following script to generate transactions for the Like under scaffold:

You should see an output similar to this:

The generated transaction files can be found in the txs folder. For like, they are at:

There could be multiple transaction files in the folder, each containing a batch of transactions.

2

Running the Benchmark

Send the generated transactions to your local node in batch mode. Assuming your DevNet node IP is 192.168.1.103, run (note: the node IP isn't necessarily the same as your machine IP):

You should see an output similar to this:

3

Benchmarking Metrics

Metric
Description

realtimeTps

Real-time TPS during the benchmarking.

maxTps

Maximum TPS achieved during the benchmarking.

Total

Total number of transactions sent in the block.

Success

Number of successful transactions in the block.

Fail

Number of failed transactions in the block.

realtimeGasBurned

Real-time gas consumed during the benchmarking.

maxGasBurned

Maximum gas consumed in a single block during benchmarking.

Last updated