Commit 0ce46a61 authored by 袁兴强's avatar 袁兴强 Committed by 33cn

add tutorial of query wasm contracts

parent fc769ff1
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
```bash ```bash
git clone https://github.com/juj/emsdk.git git clone https://github.com/juj/emsdk.git
cd emsdk cd emsdk
git checkout 6adb624e04b0c6a0f4c5c06d3685f4ca2be7691d # 用旧版本
./emsdk install latest ./emsdk install latest
./emsdk activate latest ./emsdk activate latest
...@@ -59,6 +60,12 @@ wabt/bin/wasm2wat dice.wasm ...@@ -59,6 +60,12 @@ wabt/bin/wasm2wat dice.wasm
./chain33-cli send wasm create -n 指定合约名 -p wasm合约路径 -k 用户私钥 ./chain33-cli send wasm create -n 指定合约名 -p wasm合约路径 -k 用户私钥
``` ```
### 检查合约发布结果
```bash
# 检查链上是否存在该合约
./chain33-cli wasm check -n 合约名
```
### 更新合约 ### 更新合约
```bash ```bash
# 更新合约要求合约已存在,且只有合约创建者有更新权限 # 更新合约要求合约已存在,且只有合约创建者有更新权限
...@@ -71,6 +78,15 @@ wabt/bin/wasm2wat dice.wasm ...@@ -71,6 +78,15 @@ wabt/bin/wasm2wat dice.wasm
./chain33-cli send wasm call -n 发布合约时指定的合约 -m 调用合约方法名 -p 参数 -v 字符串参数 -k 用户私钥 ./chain33-cli send wasm call -n 发布合约时指定的合约 -m 调用合约方法名 -p 参数 -v 字符串参数 -k 用户私钥
``` ```
### 查询合约数据
```bash
# 查询statedb
./chain33-cli wasm query state -n 合约名 -k 数据库key
# 查询localdb
./chain33-cli wasm query local -n 合约名 -k 数据库key
```
### 转账及提款 ### 转账及提款
```bash ```bash
#部分合约调用可能需要在合约中有余额,需要先转账到 wasm 合约 #部分合约调用可能需要在合约中有余额,需要先转账到 wasm 合约
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment