{"id":1179,"date":"2019-04-28T16:06:44","date_gmt":"2019-04-28T08:06:44","guid":{"rendered":"http:\/\/www.haku.studio\/?p=1179"},"modified":"2019-04-28T16:06:44","modified_gmt":"2019-04-28T08:06:44","slug":"web3jjava-%e9%80%9a%e8%bf%87%e6%9e%84%e9%80%a0rawtransaction%e9%83%a8%e7%bd%b2%e5%90%88%e7%ba%a6","status":"publish","type":"post","link":"https:\/\/bloo.heing.fun\/?p=1179","title":{"rendered":"web3j(java) \u901a\u8fc7\u6784\u9020RawTransaction\u90e8\u7f72\u5408\u7ea6"},"content":{"rendered":"<pre>contractCode = contractCodeEt.getText().toString();\r\n\/\/ \u8fd9\u91cccontractCode\u5c31\u662fremix\u7f16\u8bd1\u51fa\u6765\u7684bytecode\u91cc\u7684object,\r\n\/\/ \u662f\u4e00\u4e32\u6570\u5b57\uff0c\u81ea\u5df1\u4e0d\u9700\u8981\u518d\u8fd9\u4e32\u6570\u5b57\u524d\u52a00x\u4e4b\u7c7b\u7684\u4e1c\u897f\uff0c\u76f4\u63a5\u590d\u5236\r\n\/\/ \u7c98\u8d34\u8fc7\u6765\u5c31\u884c\u4e86\r\n\r\n\r\n\/\/ \u4e0e\u4e00\u822c\u7684\u4ea4\u6613\u4f7f\u7528RawTransaction.createTransaction\u4e0d\u540c\uff0c\r\n\/\/ \u8fd9\u91cc\u4f7f\u7528\u7684\u662fRawTransaction.createContractTransaction\u3002<\/pre>\n<pre>\r\nRawTransaction rawTransaction = RawTransaction.createContractTransaction(new BigInteger(VnsApi.nonce + \"\"), DefaultGasProvider.GAS_PRICE, DefaultGasProvider.GAS_LIMIT, amount.toBigInteger(), contractCode);\r\n\/\/ \u666e\u901a\u7684\u4ea4\u6613gas limit\u4f7f\u752860,000\u5c31\u591f\u4e86\uff0c\u4f46\u90e8\u7f72\u5408\u7ea6\u7684\u4ea4\u6613\u8981\u591a\u4e9b\r\n\/\/  Gas_limit\u4e3a 8,000,000\r\n\/\/  Gas_price\u4e3a 0.000000022 Vns\u00a0\r\n\/\/\r\n\/\/ \u90e8\u7f72\u5408\u7ea6\u65f6\u53ef\u4ee5\u901a\u8fc7\u4f20value\u7ed9\u5408\u7ea6\u6253\u94b1\r\n\r\nLog.v(\"perci_DeployContractFragment.java\", \"nonce=\" + VnsApi.nonce);\r\nbyte[] signedRawTransactionBytes = TransactionEncoder.signMessage(rawTransaction, credentials);\r\nString signedRawTransaction = Numeric.toHexString(signedRawTransactionBytes);\r\n\r\n\/\/ \u6700\u540e\u5c06\u8fd9\u4e2a\u7b7e\u540d\u597d\u540e\u7684\u5408\u7ea6\u901a\u8fc7rpc\u63a5\u53e3\u53d1\u9001\u51fa\u53bb\u5c31\u53ef\u4ee5\u4e86<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>contractCode = contractCodeEt.getText().toString(); \/\/  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-1179","post","type-post","status-publish","format-standard","hentry","category-36"],"_links":{"self":[{"href":"https:\/\/bloo.heing.fun\/index.php?rest_route=\/wp\/v2\/posts\/1179","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bloo.heing.fun\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bloo.heing.fun\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bloo.heing.fun\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bloo.heing.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1179"}],"version-history":[{"count":1,"href":"https:\/\/bloo.heing.fun\/index.php?rest_route=\/wp\/v2\/posts\/1179\/revisions"}],"predecessor-version":[{"id":1180,"href":"https:\/\/bloo.heing.fun\/index.php?rest_route=\/wp\/v2\/posts\/1179\/revisions\/1180"}],"wp:attachment":[{"href":"https:\/\/bloo.heing.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1179"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bloo.heing.fun\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1179"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bloo.heing.fun\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1179"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}