Introducing SmartWeave: Building smart contracts with Arweave
How does SmartWeave work?
In a traditional smart contract system (for example, EOS and Ethereum v1), every node will execute every transaction, rejecting those that contain invalid operations. SmartWeave takes a different approach: instead of requiring network nodes to execute smart contract code, a system of “lazy evaluation” is employed, pushing the computation of transaction validation to users of the smart contract. When a user interacts with a SmartWeave contract, they evaluate each prior transaction on the dApp until they reach the end of the chain of valid state transitions. Once the end (the ‘tip’) of the contract is reached, the user evaluates their call to the contract, then writes the resulting state transition into the Arweave network. This process repeats continually, with new users continually validating each other’s transactions and adding their own state transitions.
In this model, the Arweave network is utilized as a generic data consensus and sharing layer, while users take care of verifying the transactions on the contracts they want to interact with.
One of the effects of this decision is that it frees validators from smart contract work, consequently eliminating the need for “gas” to pay for smart contract interactions. Instead, developers are given the freedom to allow arbitrary quantities of computation, with the awareness that users will need to repeat this computation to participate in the contract execution.
As well as providing a strong base for scalable smart contract execution, this style of “lazy evaluation” also allows for entirely new types of smart contracts to be built; those that require extremely heavy computation — from complex financial modelling, to GPU rendering, or even convolutional neural network execution.
Interactions with the SmartWeave protocol are simply layer one Arweave data transactions. Subsequently, the token that powers the SmartWeave is AR — the exact same token that is used for data storage in the Arweave protocol. Research is underway to explore the possibility of SmartWeave compatibility using the layer two data bundling technique that we recently launched. If possible, this would make SmartWeave one of, if not the, most scalable smart contract systems available — able to process transactions at throughputs limited by each smart contract’s users’ bandwidth, rather than typical blockchain consensus constraints. We will update you here as that research progresses.
Currently SmartWeave is in the prototype phase and a number of important features are still in development (foreign contract calls, for example). Nonetheless, the v0.1 is live on the Arweave network and you can start experimenting with it today. To be clear, however, the current testing version will likely contain bugs. If you do choose to use SmartWeave for financial applications prior to the completion of audits and further testing, you should agree fallback plans with the stakeholders in your contract, in the event that issues arise. Proceed at your own risk!
If you would like to keep up to date with all the latest developments for the Arweave protocol and the community, consider subscribing to our mailing list here for monthly newsletters, or over on Twitter.