npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@arcologynetwork/concurrentlib

v2.0.8

Published

This API is designed to facilitate concurrent smart contracts on the Arcology Network.

Downloads

19

Readme

Solidity, the programming language used to develop smart contracts on the Ethereum platform, was not initially designed for concurrent use, so it does not include the features and capabilities necessary for efficient concurrent programming.

Arcology Network offers a suite of Solidity APIs customized for concurrent programming tasks. This package includes the Solidity APIs for smart contract developers to fully utilize the power of Arcology's parallel execution capabilities.

Please be aware that all the libraries in the package are specifically designed for Arcology Network only. They are not going to bring any benefits to Ethereum or other blockchain platforms.

$ npm install @arcologynetwork/concurrentlib

Once installed, you can use the contracts in the library by importing them.

Example

The following example demonstrates how to use the concurrentlib to parallelize a simple smart contract. Arcology has a set of concurrent data structures and variables that allow concurrent manipulations. Below is an example of that.

Simple Contract

The following example of a simple smart contract that allows users to like a post. A simplest version of the contract is shown below. When a calls the like() function, the likes of the receiver is incremented by 1.

This implementation doesn't support concurrent execution. If multiple users call the like() function concurrently, the likes of the receiver will be incremented concurrently. This is not allowed in Solidity.

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.0 <0.9.0;

contract Like {
    uint public likes;

    function like() public {
        likes += 1;
    }    
}

Parallelized Version

In the parallelized version, the likes is replaced with a U256Cumulative variable from the arcologynetwork/contracts/concurrentlib/commutative/U256Cum.sol library. The variable allows concurrent increment and decrement operations. Now, the like() function can be called concurrently by multiple transactions.

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.0 <0.9.0;
import "@arcologynetwork/concurrentlib/lib/commutative/U256Cum.sol";

contract Like {
    U256Cumulative likes = new U256Cumulative(0, type(uint256).max);

    function like() public {
        likes.add(1);
    }    
}

You can find more examples in the developer's guide.

Arcology's concurrent lib is released under the MIT License.

Arcology's concurrent lib is made available under the MIT License, which disclaims all warranties in relation to the project and which limits the liability of those that contribute and maintain the project. You acknowledge that you are solely responsible for any use of the Contracts and you assume all risks associated with any such use.