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 153 forks source link

contract check failed #133

Closed puncleV closed 6 years ago

puncleV commented 6 years ago

Have done next requests:

curl -i -H 'Accept: application/json' -X POST http://localhost:8685/v1/admin/transactionWithPassphrase -H 'Content-Type: application/json' -d '{"transaction": {"from":"n1H4MYms9F55ehcvygwWE71J8tJC4CRr2so","to":"n1H4MYms9F55ehcvygwWE71J8tJC4CRr2so", "value":"0","nonce":5,"gasPrice":"1000000","gasLimit":"2000000","contract":{"source":"class aaaa {constructor(){};init(){};getValue(){return 228;}};module.exports=aaaa;","sourceType":"js", "args":""}}, "passphrase": "passphrase"}'
HTTP/1.1 200 OK
Content-Type: application/json
Vary: Origin
Date: Sat, 12 May 2018 08:50:35 GMT
Content-Length: 145

{"result":{"txhash":"7a907aa117c61849f9e0eedb2196b4fdba54972a7cc64b810a6098c47357dad0","contract_address":"n1p55WjxPFGUHuuJ7MpPpTHRcWHUk6twSSu"}}
curl -i -H 'Content-Type: application/json' -X POST http://localhost:8685/v1/user/getTransactionReceipt -d '{"hash":"7a907aa117c61849f9e0eedb2196b4fdba54972a7cc64b810a6098c47357dad0"}'
HTTP/1.1 200 OK
Content-Type: application/json
Vary: Origin
Date: Sat, 12 May 2018 08:51:39 GMT
Content-Length: 592

{"result":{"hash":"7a907aa117c61849f9e0eedb2196b4fdba54972a7cc64b810a6098c47357dad0","chainId":100,"from":"n1H4MYms9F55ehcvygwWE71J8tJC4CRr2so","to":"n1H4MYms9F55ehcvygwWE71J8tJC4CRr2so","value":"0","nonce":"5","timestamp":"1526115035","type":"deploy","data":"eyJTb3VyY2VUeXBlIjoianMiLCJTb3VyY2UiOiJjbGFzcyBhYWFhIHtjb25zdHJ1Y3Rvcigpe307aW5pdCgpe307Z2V0VmFsdWUoKXtyZXR1cm4gMjI4O319O21vZHVsZS5leHBvcnRzPWFhYWE7IiwiQXJncyI6IiJ9","gas_price":"1000000","gas_limit":"2000000","contract_address":"n1p55WjxPFGUHuuJ7MpPpTHRcWHUk6twSSu","status":2,"gas_used":"","execute_error":"","execute_result":""}}
curl -i -H 'Accept: application/json' -X POST http://localhost:8685/v1/user/call -H 'Content-Type: application/json' -d '{"from":"n1LkDi2gGMqPrjYcczUiweyP4RxTB6Go1qS","to":"n1p55WjxPFGUHuuJ7MpPpTHRcWHUk6twSSu","value":"0","nonce":1,"gasPrice":"1000000","gasLimit":"2000000","contract":{"function":"getValue","args":""}}'
HTTP/1.1 200 OK
Content-Type: application/json
Vary: Origin
Date: Sat, 12 May 2018 08:53:16 GMT
Content-Length: 85

{"result":{"result":"","execute_err":"contract check failed","estimate_gas":"20093"}}

and result is 'contract check failed'. What am i doing wrong?

act262 commented 6 years ago

@punkkk After deploy contract , you should wait a minute .

puncleV commented 6 years ago

@act262 ty for answer!

Oh... I see. So i waited more and transaction still on pending. :(

And in console with ./neb default config i see: INFO[2018-05-12T13:58:30+03:00] Succeed to update new tail.

Status field is always = 2

I use sample configs.

puncleV commented 6 years ago

All fine, just need little more than 1 minute.