#transaction #state #smart-contracts #execution #distributed #component #ledger

transact

Transact is a transaction execution platform designed to be used as a library or component when implementing distributed ledgers, including blockchains

33 releases

0.4.7 Jan 8, 2024
0.4.6 Jul 25, 2022
0.4.5 Jun 14, 2022
0.4.3 Jan 11, 2022
0.1.4 Jul 31, 2019

#306 in Magic Beans

Download history 23/week @ 2023-12-19 25/week @ 2023-12-26 55/week @ 2024-01-02 16/week @ 2024-01-09 2/week @ 2024-01-16 25/week @ 2024-01-23 75/week @ 2024-01-30 84/week @ 2024-02-06 117/week @ 2024-02-13 145/week @ 2024-02-20 174/week @ 2024-02-27 119/week @ 2024-03-05 114/week @ 2024-03-12 81/week @ 2024-03-19 48/week @ 2024-03-26 105/week @ 2024-04-02

362 downloads per month
Used in 6 crates (2 directly)

Apache-2.0

1MB
24K SLoC

Transact

Transact is a platform-agnostic library for executing transactions with smart contracts.

How to Participate

We welcome contributors, both organizations and individuals, to help shape project direction, contribute ideas, provide use cases, and work on specific tools and examples. Join us on the #transact Discord channel.

More Information

License

Transact software is licensed under the Apache License Version 2.0 software license.


lib.rs:

Transact

Transact makes writing distributed ledger software easier by providing a shared software library that handles the execution of smart contracts, including all aspects of scheduling, transaction dispatch, and state management.

Framework-level projects and custom distributed ledgers can use Transact's advanced transaction execution and state management to simplify the transaction execution code in their projects and to take advantage of Transact’s additional features.

More specifically, Transact provides an extensible approach to implementing new smart contract languages called “smart contract engines.” Each smart contract engine implements a virtual machine or interpreter that processes smart contracts.

Diving Deeper

Transact is fundamentally a transaction processing system for state transitions. State data is generally stored in a Merkle-Radix tree a key-value database, or an SQL database. Given an initial state and a transaction, Transact executes the transaction to produce a new state. These state transitions are considered “pure” because only the initial state and the transaction are used as input. (In contrast, other systems such as Ethereum combine state and block information to produce the new state.) As a result, Transact is agnostic about framework features other than transaction execution and state. Awesome, right?

Transact deliberately omits other features such as consensus, blocks, chaining, and peering. These features are the responsibility of the frameworks and other distributed ledger implementations. The focus on smart contract execution means that Transact can be used for smart contract execution without conflicting with other platform-level architectural design elements.

Transact includes the following components:

  • State. The Transact state implementation provides get, set, and delete operations against a database. For the Merkle-Radix tree state implementation, the tree structure is implemented on top of LMDB or an in-memory database.
  • Context manager. In Transact, state reads and writes are scoped (sandboxed) to a specific "context" that contains a reference to a state ID (such as a Merkle-Radix state root hash) and one or more previous contexts. The context manager implements the context lifecycle and services the calls that read, write, and delete data from state.
  • Scheduler. This component controls the order of transactions to be executed. Concrete implementations include a serial scheduler and a parallel scheduler. Parallel transaction execution is an important innovation for increasing network throughput.
  • Executor. The Transact executor obtains transactions from the scheduler and executes them against a specific context. Execution is handled by sending the transaction to specific execution adapters (such as ZMQ or a static in-process adapter) which, in turn, send the transaction to a specific smart contract.
  • Smart Contract Engines. These components provide the virtual machine implementations and interpreters that run the smart contracts. Examples of engines include WebAssembly, Ethereum Virtual Machine, Sawtooth Transactions Processors, and Fabric Chain Code.

Sawtooth Compatibility Layer

Transact provides optional support for smart contract engines implemented for Sawtooth through the sawtooth-compat feature.

Dependencies

~3–24MB
~359K SLoC