Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

创建合约账户, Error TX_VERIFICATION_ERROR while PostTx #20

Open
LKCoinOne opened this issue Apr 23, 2021 · 6 comments
Open

创建合约账户, Error TX_VERIFICATION_ERROR while PostTx #20

LKCoinOne opened this issue Apr 23, 2021 · 6 comments

Comments

@LKCoinOne
Copy link

LKCoinOne commented Apr 23, 2021

代码:

    public static void main(String[] args) {
        
        // 1、创建钱包账户
        Account account = Account.create(1,1);
        // 连接节点
        XuperClient xuperClient = new XuperClient("127.0.0.1:37101");
        // 2、创建合约账户
        xuperClient.createContractAccount(account,"1111111111111112");
    }

异常:

Exception in thread "main" java.lang.RuntimeException: Error TX_VERIFICATION_ERROR while PostTx
	at com.baidu.xuper.api.Common.checkResponseHeader(Common.java:22)
	at com.baidu.xuper.api.Transaction.send(Transaction.java:489)
	at com.baidu.xuper.api.XuperClient.invokeContract(XuperClient.java:100)
	at com.baidu.xuper.api.XuperClient.createContractAccount(XuperClient.java:158)
	at ApplicationTests.main(ApplicationTests.java:55)

想知道出现这个问题的原因是什么

@godeamon
Copy link
Collaborator

@LKCoinOne 你好,创建合约账户时使用的 account 需要有余额,按照提供的代码来看,account 应该是没有足够的 utxo 来发送交易的。可以先给这个账户转账再试一下。如果还有问题麻烦提供下错误信息以及示例代码,谢谢。

@LKCoinOne
Copy link
Author

@godeamon 你好

我在创建平行链 ' chaintest ' 的时候,开起了无通证模式

#开起无 token 交易
noFee: true

但是在运行的时候,还是提示同样的异常错误,是我需要修改Config这个类吗

public static void main(String[] args) {
        // 1、创建钱包账户
        Account account = Account.create(1,1);
        // 2、连接节点
        XuperClient xuperClient = new XuperClient("127.0.0.1:37101");
        xuperClient.setChainName("chaintest");
        // 3、创建合约账户
        xuperClient.createContractAccount(account,"1111111111111112");
}

异常提示

Exception in thread "main" java.lang.RuntimeException: Error TX_VERIFICATION_ERROR while PostTx
	at com.baidu.xuper.api.Common.checkResponseHeader(Common.java:22)
	at com.baidu.xuper.api.Transaction.send(Transaction.java:488)
	at com.baidu.xuper.api.XuperClient.invokeContract(XuperClient.java:114)
	at com.baidu.xuper.api.XuperClient.createContractAccount(XuperClient.java:172)
	at ApplicationTests.main(ApplicationTests.java:47)

@godeamon
Copy link
Collaborator

@LKCoinOne 你好,你这边是本地节点创建了几条平行链呀?是一个默认的 xuper 和另外这个 chaintest 吗?您这边可以提供下这个错误信息出现时,logs 目录下的 xchain.log.wf 的日志信息吗?

@LKCoinOne
Copy link
Author

@godeamon 你好

这是本地节点,里面创建了多条平行链

默认xuper这条链的配置文件如下 xuper.json

#/output/data/blockchain/xuper/xuper.json
{
    "version": "1",
    "predistribution": [
        {
            "address": "fW3WWVhPKcSHrxvkxs9nRc2TKSuesnmbm",
            "quota": "100000000000000000000"
        }
    ],
    "maxblocksize": "128",
    "award": "1000000",
    "decimals": "8",
    "award_decay": {
        "height_gap": 31536000,
        "ratio": 1
    },
    "nofee": true,
    "gas_price": {
        "cpu_rate": 1000,
        "mem_rate": 1000000,
        "disk_rate": 1,
        "xfee_rate": 1
    },
    "new_account_resource_amount": 1000,
"group_chain_contract": {
    "module_name": "wasm",
    "contract_name": "group_chain",
    "method_name": "list",
    "args":{}
},
    "genesis_consensus": {
        "name": "tdpos",
        "config": {
            "timestamp": "1559021720000000000",
            "proposer_num": "1",
            "period": "3000",
            "alternate_interval": "3000",
            "term_interval": "6000",
            "block_num": "20",
            "vote_unit_price": "1",
            "init_proposer": {
                "1": [
                    "fW3WWVhPKcSHrxvkxs9nRc2TKSuesnmbm"
                ]
            }
        }
    }
}

下面是创建 chaintest 这条平行链的配置文件 xuper.json

#/output/data/blockchain/chaintest/xuper.json
{
    "version":"1",
    "nofee":true,
    "consensus":{
        "miner":"fW3WWVhPKcSHrxvkxs9nRc2TKSuesnmbm",
        "type":"single"
    },
    "predistribution":[
        {
            "address":"fW3WWVhPKcSHrxvkxs9nRc2TKSuesnmbm",
            "quota":"1000000000000000"
        }
    ],
    "maxblocksize":"128",
    "period":"3000",
    "award":"1000000"
}

然后我使用了 xuper-java-sdk ,执行了以下的方法

public static void main(String[] args) {
        // 1、创建钱包账户
        Account account = Account.create(1,1);
        // 2、连接节点
        XuperClient xuperClient = new XuperClient("127.0.0.1:37101");
        xuperClient.setChainName("chaintest");
        // 3、创建合约账户
        xuperClient.createContractAccount(account,"1111111111111112");
}

xchain.log.wf 的错误信息出现

t=2021-04-26T11:44:20+0800 lvl=warn msg="ImmediateVerifyTx: txid not match" module=xchain tx.Txid="[65 92 36 111 126 146 4 108 183 198 118 167 23 76 194 80 18 18 31 226 163 98 92 16 45 211 38 66 42 105 36 181]" txid="[82 166 243 114 143 16 196 124 144 154 40 147 253 30 182 223 89 0 168 133 183 97 15 214 222 205 77 237 33 207 66 253]"
    
t=2021-04-26T11:44:20+0800 lvl=warn msg="ImmediateVerifyTx failed" module=xchain error="Txid verify failed" AuthRequire =[m5pjxx9WTmDX7ogVeTePU7teG7LVy6gWh] AuthRequireSigns ="[PublicKey:\"{\\\"Curvname\\\":\\\"P-256\\\",\\\"X\\\":54139739654911774510643571288432792789860838120065532468656771536616249935945,\\\"Y\\\":60980148640771675152300764885114530477783698373130929195446831561695732214164}\" Sign:\"0E\\002 dlV\\300\\246\\345E7\\374\\255\\3174Nv\\365\\323\\347C\\324u#Zh\\236\\350\\200h\\353\\365\\013\\260\\324\\002!\\000\\223\\351\\321<\\260\\024\\365K4\\274\\026<!\\032\\243FkF\\252\\252\\262\\3645\\270^\\021\\204{\\346c1\\312\" ]" Initiator=m5pjxx9WTmDX7ogVeTePU7teG7LVy6gWh InitiatorSigns="[PublicKey:\"{\\\"Curvname\\\":\\\"P-256\\\",\\\"X\\\":54139739654911774510643571288432792789860838120065532468656771536616249935945,\\\"Y\\\":60980148640771675152300764885114530477783698373130929195446831561695732214164}\" Sign:\"0E\\002 dlV\\300\\246\\345E7\\374\\255\\3174Nv\\365\\323\\347C\\324u#Zh\\236\\350\\200h\\353\\365\\013\\260\\324\\002!\\000\\223\\351\\321<\\260\\024\\365K4\\274\\026<!\\032\\243FkF\\252\\252\\262\\3645\\270^\\021\\204{\\346c1\\312\" ]" XuperSign=<nil>
    
t=2021-04-26T11:44:20+0800 lvl=warn msg="post tx verify tx error" module=xchain txid=415c246f7e92046cb7c676a7174cc25012121fe2a3625c102dd326422a6924b5 valid_err="Txid verify failed" logid=1619408660355668495

我的理解是 nofee 设置为 true ,交易应该不消耗余额,所以创建合约账户是不需要有余额,但是实际原理,我也不是很了解

@godeamon
Copy link
Collaborator

@LKCoinOne 你好,非常感谢提供信息,这个问题我需要查一下,暂时 SDK 对 no fee 支持的不够好,近期我们把这个功能完善下。

@LKCoinOne
Copy link
Author

@godeamon 感谢,非常期待

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants