0.3.4 • Published 4 years ago

smartweave-test v0.3.4

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

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

Clone this repository and run npm install.

You can deploy a contract as follows:

node smartweave-cli --key-file [YOUR KEYFILE] \
  --create --contract-src [SRC LOCATION] \
  --init-state [INITIAL STATE FILE]

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

node smartweave-cli --key-file [YOUR KEYFILE] \
  --create --contract-src-tx [SRC TX] \
  --init-state [INITIAL STATE FILE]

Check its state:

node smartweave-cli --key-file [YOUR KEYFILE] \
  --contract [CONTRACT TXID] \
  --get-state

Interact with it:

node smartweave-cli --key-file [YOUR KEYFILE] \
  --contract [CONTRACT TXID] \
  --interact \
  --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 --interact call.

License

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

0.3.4

4 years ago

0.3.3

4 years ago