nebulasio / wiki

This repository is out of date, please check the new wiki:
http://wiki.nebulas.io/en/latest/
GNU General Public License v3.0
421 stars 154 forks source link

console.log 的输出在哪里查看?(合约已部署到测试网) #215

Closed 1c7 closed 5 years ago

1c7 commented 5 years ago

1. 代码如下

一字未改,来自官方文档:https://github.com/nebulasio/wiki/blob/master/tutorials/%5B%E4%B8%AD%E6%96%87%5D%20Nebulas%20101%20-%2004%20%E6%99%BA%E8%83%BD%E5%90%88%E7%BA%A6%E5%AD%98%E5%82%A8%E5%8C%BA.md

'use strict';

var SampleContract = function () {
};

SampleContract.prototype = {
    init: function () {
    },
    set: function (name, value) {
        // 存储字符串
        LocalContractStorage.set("name",name);
        // 存储数字
        LocalContractStorage.set("value", value);
        // 存储对象
        LocalContractStorage.set("obj", {name:name,value:value});
    },
    get: function () {
        var name = LocalContractStorage.get("name");
        console.log("name:"+name)
        var value = LocalContractStorage.get("value");
        console.log("value:"+value)
        var obj = LocalContractStorage.get("obj");
        console.log("obj:"+JSON.stringify(obj))
    },
    del: function () {
        var result = LocalContractStorage.del("name");
        console.log("del result:"+result)
    }
};

module.exports = SampleContract;

2. 已部署到测试网

交易地址: 447bf18dd5fe0e228ba1abeae0058f32b0059d9923f855a4bb56019a24b8229d image 合约地址:n1y3jGZUfRKB6cYE6fC4Utg6qGKYHa4WeKK adb22080-0129-4d2c-8e84-d871707d3262

3. “执行” tab 下,用“测试”或“提交”均无法看到 console.log 的结果

image image

问题:在哪里看 console.log 的输出?

谢谢

1c7 commented 5 years ago

curl 的效果也一样

curl -i -H 'Content-Type: application/json' -X POST https://testnet.nebulas.io/v1/user/call -d '{"from":"n1XL3BsqPiGMFkL9tAxnKziRyQ1L57kDWRz","to":"n1y3jGZUfRKB6cYE6fC4Utg6qGKYHa4WeKK","value":"0","nonce":3,"gasPrice":"1000000","gasLimit":"2000000","contract":{"function":"get","args":""}}'

image

yupnano commented 5 years ago

你好,log信息只能在本地节点的log里看到。