上链失败梳理
<p>通过<code>查询上链结果</code>接口查询,交易成功的code都是<code>EC000000</code></p>
<hr />
<h3>交易已上链,执行结果失败</h3>
<p>><code>code</code>为<code>EC000002</code>,属于交易上链,但执行失败的</p>
<p>&ensp;&ensp;&ensp;&ensp;比如铸造交易的发起账户不是合约拥有者 ,<code>data</code>中<code>error -&gt; message</code> 字段中显示失败的原因,这种情况需要重新更换参数后调用接口上链</p>
<pre><code class="language-json">{
&quot;code&quot;: &quot;EC000002&quot;,
&quot;message&quot;: &quot;失败&quot;,
&quot;data&quot;: {
&quot;result&quot;: {
....
},
&quot;rawResponse&quot;: null,
&quot;id&quot;: 763404,
&quot;jsonrpc&quot;: &quot;2.0&quot;,
&quot;error&quot;: {
&quot;code&quot;: 16,
&quot;data&quot;: null,
&quot;message&quot;: &quot;Ownable: caller is not the owner&quot;
}
}
}</code></pre>
<hr />
<h3>交易未上链</h3>
<p>><code>code</code>为<code>EC000026</code> ,其中 <code>data -&gt; result</code>字段不存在或为<code>null</code>,属于交易未上链;</p>
<p>&ensp;&ensp;&ensp;&ensp;如果 <code>data -&gt; error -&gt; message</code>的值是 <code>GetTransactionReceiptByHash</code> 则可能会存在交易正在上链中,建议多查询几次或者采用回调通知服务,在<strong>60秒</strong>后查询依旧没有结果,需要重新调用接口上链。</p>
<pre><code class="language-json">{
&quot;code&quot;: &quot;EC000026&quot;,
&quot;message&quot;: &quot;获取交易回执信息失败,请稍后重试&quot;,
&quot;data&quot;: {
&quot;result&quot;: null,
&quot;rawResponse&quot;: null,
&quot;id&quot;: 0,
&quot;jsonrpc&quot;: null,
&quot;error&quot;: {
&quot;code&quot;: 3008,
&quot;data&quot;: null,
&quot;message&quot;: &quot;GetTransactionReceiptByHash&quot;
}
}
}</code></pre>