Skip to content

Simple, scalable smart contracts on the Arweave protocol.

Notifications You must be signed in to change notification settings

OutpostProtocol/SmartWeave

 
 

Repository files navigation

Outpost SmartWeave Contracts

Our smart contracts are built on Arweave. Arweave smart contracts, a.k.a. SmartWeave contracts, are super cheap and a lot more flexible than those on any other smart contract platform we've seen. Notably they allow use to use an alternate identity system. Rather than using Arweave public keys as identities, we use 3box 3IDs. 3IDs, an implementation of w3c's DID spec are blockchain agnostic identifiers; they'll allow us to use a single identity system as we plan to add features from multiple blockchains in the future.

The Repo

  • /contracts
    • our smartweave contracts
  • /src
    • Arweave's logic for interpreting SmartWeave contracts. Our contracts require an instance of ipfs to run so we created a file readOutpostContract.ts that changes contract-read.ts to pass an instance of ipfs to the contract.
  • /test
    • tests for the contracts.
  • /bin
    • a script to deploy the contracts.

Install dependencies

yarn install

Build the contracts

yarn build:contracts

Test the contracts

yarn test:contracts

To deploy the contracts and run some of our scripts for posting transactions, you'll need to create and .env file and set DEV_WALLET to the path to your arweave wallet. The file ./.env.example is provided as an example.

Deploy a contract

yarn deploy:prod

The rest of the readme is from Arweave's SmartWeave repo which we forked. Refer to it for more information on SmartWeave contracts.

SmartWeave

Simple, scalable smart contracts on the Arweave protocol

Uses lazy-evaluation to move the burden of contract execution from network nodes to smart contract users. Currently, SmartWeave supports JavaScript, using the client's unmodified execution engine.

Version: 0.3

For information on how the contracts execute, how to write one, and the API, read the Contract Guide and check some of the examples

For information on how to create a new PST token, you can read the PST Creation Guide.

For a description of the SDK methods available, you can check here

CLI Usage

npm install -g smartweave

You can deploy a contract as follows:

smartweave create [SRC LOCATION] [INITIAL STATE FILE] --key-file [YOUR KEYFILE]

Or, using an existing contract source that is already deployed but with a new initial state and contract id:

smartweave create [SRC TX] [INITIAL STATE FILE] --key-file [YOUR KEYFILE]

Check its state:

smartweave read [CONTRACT TXID]

Interact with it:

smartweave write [CONTRACT TXID] --key-file [YOUR KEYFILE] \
  --input "[CONTRACT INPUT STRING HERE]"

When interacting with the contract, the value passed to --input must be valid json. Typically an object is used:

--input '{ "function": "transfer", "qty": 1984 }'

To test a contract interaction without writing it to the network, append --dry-run to your write call.

License

This project is licensed under the terms of the MIT license.

About

Simple, scalable smart contracts on the Arweave protocol.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 61.9%
  • TypeScript 38.0%
  • Shell 0.1%