Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vyshnavsdeepak/wasm-contract-runtime
https://github.com/vyshnavsdeepak/wasm-contract-runtime
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/vyshnavsdeepak/wasm-contract-runtime
- Owner: vyshnavsdeepak
- Created: 2023-08-22T12:51:39.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-08-22T17:03:34.000Z (about 1 year ago)
- Last Synced: 2024-04-08T09:08:04.256Z (7 months ago)
- Language: Go
- Size: 468 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Contract Execution Runtime with Server
## Directory Structure
```
mkdir -p data/contracts
mkdir -p data/state
``````
data
├── contracts
│ ├── contract1.wasm
│ └── contract2.wasm
├── state
│ ├── contract1.json
│ └── contract2.json
```Move contracts to `data/contracts` directory.
## Run server
```
go run server.go
```## Get state API call
```
curl --location --request GET 'http://localhost:8304/{contract_id}/state'
```
###Example
```
curl --location --request GET 'http://localhost:8304/123/state'
```## Post events API call
```
curl --location --request POST 'http://localhost:8304/{contract_id}/events' \
--header 'Content-Type: application/json' \
--data-raw '[
{
"blockID": 1,
"function": "{functionName}",
"args": [arg1, arg2, ...]
}
]'
```### Example
```
curl --location --request POST 'http://localhost:8304/123/events' \
--header 'Content-Type: application/json' \
--data-raw '[
{
"blockID": 1,
"function": "vote",
"args": ["blue"]
}
]'
```