———— Enabling Style Industry with Block Chain Technology————
Recently, SEER core developers updated SEER cli and database_api, adding an interface: get_transaction_by_txid, which can be used to query the height of the transaction in the chain and the location of the transaction in the block through the transaction ID.
Trading ID, or txid, is a hash value calculated by signing the transaction content, which can be generated before block production or confirmation. For example, a third-party gateway such as an exchange, usually after initiating a withdrawal or recharge, will feedback the transaction ID of this operation to the user, who can use this txid to query the confirmed status of the transaction in the block browser. Consequently, TXID's consistent algorithm is very important, and in the Graphene toolkit, this function is traditionally achieved by running additional elastic search plug-ins. SEER integrates this function into database_api, which can greatly reduce the workload of front-end developers and improve development efficiency.
Format: get_transaction_by_txid transaction_id
Parameter: transaction_id, hash value of the transaction. The get_transaction_id, transfer 2 and get_block interfaces of cli can be used to generate the front-end calculation. The get_block of the newly upgraded database_api will also contain the transaction_ids field.
Function: Query the height of the transaction in the chain and the location of the transaction in the block by transaction_id, and the front-end developer can return the transaction structure corresponding to the transaction_id to the user through the get_block interface (i.e. transaction details).
Examples: {"jsonrpc": "2.0", "method", "get_transaction_by_txid", "params": [3ecbd 34522eb320b105b653247012ea996fa7065], "id": 1}
Return an example of information:
{ "id": 1, "jsonrpc": "2.0", "result": { "id": "2.22.102327",//object_ID of the transaction "txid": "3ecbd34522eb320b105b653247012ea996fa7065",//transaction_id "timestamp": "2019-08-26T08:32:51",//Timestamp, Greenwich Time "block_num": 13274359,//Exchanges are at block height "trx_in_block": 0//The location of transactions in a block } }
Through the parameters of "block_num" and "trx_in_block" returned by the interface, we can know the height of the exchange and the position of the transaction in the block, and then use the get_block interface to query its transaction details.
Examples: {"jsonrpc": "2.0", "method", "get_block", "params": [13274359], "id": 1}
Return an example of information:
{ "id": 1, "jsonrpc": "2.0", "result": { "previous": "00ca9c96829ff5fbcef6c087c762e2cde24b5915",//Block number of the previous block "timestamp": "2019-08-26T08:32:51",//Timestamp, Greenwich Time "witness": "1.5.55",//Witness object_ID for this block "transaction_merkle_root": "c41ddd9469e13daf8b7f75cbdf1ed2b4c8a98b79",//Trading Merkel Root Value "extensions": [], "witness_signature": "2048394f5d99f22f58cdc2de15568fb27397eb5bb9da3a235a04f6da68f622aa8b5face2f9e7d01a4c58e3fcd605855c683ac9ca58b250a53775d5a8afd199134d",//Witness signature "transactions": [//Transaction List {//The first trading structure "ref_block_num": 40186,//Referenced block number "ref_block_prefix": 4227178370,//Referenced blocks "expiration": "2019-08-28T08:33:18",//Possible expiration time of transaction "operations": [//List of operations [0, {//Operational code, where 0 represents transfer "fee": {//Service Charge "amount": 200000,//Amount, with 5 decimal precision, where 200 000 represents 2 "asset_id": "1.3.0"//Asset type }, "from": "1.2.28828",//Initiate user ID "to": "1.2.8848",//Receiving User ID "amount": { "amount": 100000,//Amount, with 5 decimal precision, where 100000 represents 1 "asset_id": "1.3.0" }, "extensions": [] }] ], "extensions": [], "signatures": ["1f5cd08d2edbb100429915dee6b0449c8a6319c4dc556147db13cc9af1ef26c51756b437926dc29d24dc65cf1110c71f246fb82fa698f1970ae3523729d0bbc3fe"],//Transaction signature "operation_results": [//Operational results [0, {}] ] }, {//Second transaction structure "ref_block_num": 40186,//Referenced block number "ref_block_prefix": 4227178370,//Referenced blocks "expiration": "2019-08-28T08:33:19",//Possible expiration time of transaction "operations": [//List of operations [0, {//Operational code, where 0 represents transfer "fee": {//Service Charge "amount": 200000,//Amount, with 5 decimal precision, where 200 000 represents 2 "asset_id": "1.3.0"//Asset type }, "from": "1.2.28828",//Initiate user ID "to": "1.2.8848",//Receiving User ID "amount": { "amount": 100000,//Amount, with 5 decimal precision, where 100000 represents 1 "asset_id": "1.3.0"//Asset type }, "extensions": [] }] ], "extensions": [], "signatures": ["20295aa7c286a406c86540524a97e6395815effd6e617ef940b869d37da303aabb175123fd6f83a6661d4955cf90198babe7a3002c0e2a7d73a771b92cd097648c"],//Transaction signature "operation_results": [//Operational results [0, {}] ] }], "block_id": "00ca9c97062a5716c580219349f3d7fb04713f89",//Current block number "signing_key": "SEER7txfWeMueDBWKs6sC9zTUmwhjG6xeVwPZhXwcvH5ctCYdnCPnu",//Witness Signature Public Key "transaction_ids": ["3ecbd34522eb320b105b653247012ea996fa7065", "501e507c8c62221f9f4484d1f0334585e3cf362a"],//Transaction ID Set "txs_count": 2//The number of transactions contained in this block } }
In this example, there are two transactions in the same block, and the parameter of "trx_in_block" is 0. The transaction is the first transaction in the block, so the content of the transaction structure can be obtained:
{ //The first trading structure "ref_block_num": 40186, //Referenced block number "ref_block_prefix": 4227178370, //Referenced blocks "expiration": "2019-08-28T08:33:18", //Possible expiration time of transaction "operations": [ //List of operations [0, { //Operational code, where 0 represents transfer "fee": { //Service Charge "amount": 200000, //Amount, with 5 decimal precision, where 200 000 represents 2 "asset_id": "1.3.0"//The asset type here represents SEER }, "from": "1.2.28828", //Initiate user object_ID and query its user name through get_account, here bm520 "to": "1.2.8848", //Receive user ID, here xyz123 "amount": { "amount": 100000, //Amount, with 5 decimal precision, where 100000 represents 1 "asset_id": "1.3.0"//The asset type here represents SEER }, "extensions": [] }] ], "extensions": [], "signatures": ["1f5cd08d2edbb100429915dee6b0449c8a6319c4dc556147db13cc9af1ef26c51756b437926dc29d24dc65cf1110c71f246fb82fa698f1970ae3523729d0bbc3fe"], //Transaction signature "operation_results": [ //Operational results [0, {}] ] }
The content of the transaction is: bm520 transfers 1 SEER to xyz123.
At present, the API with this function has been deployed to the Singapore node provided by SEER community: ws://sg1.seerchain.org, and will be integrated into the release version node program in the next hard bifurcation upgrade, extending to all API nodes. Currently, SEER community developers are developing new versions of Web wallets and block browsers based on this latest functional API.
You can use wscat, http://www.websocket-test.com....
Examples:
> root@ubuntu:~# wscat -c ws://sg1.seerchain.org connected (press CTRL+C to quit) > {"jsonrpc": "2.0", "method": "get_transaction_by_txid", "params": [15b922cbbd7f3648d92bed9f001a2cc99651228c], "id": 1} < {"id":1,"jsonrpc":"2.0","result":{"id":"2.22.101376","txid":"15b922cbbd7f3648d92bed9f001a2cc99651228c","timestamp":"2019-08-24T00:50:36","block_num":13158209,"trx_in_block":0}} > {"jsonrpc": "2.0", "method": "get_block", "params": [13158209], "id": 1} < {"id":1,"jsonrpc":"2.0","result":{"previous":"00c8c740c7025d851d50eade54a0a4a5255215eb","timestamp":"2019-08-24T00:50:36","witness":"1.5.89","transaction_merkle_root":"ef0d18cdd451e748b30bfeaca3ed87e366b47550","extensions":[],"witness_signature":"201ebf2bd6f81f0bf35309dead3c7c40d28040a724b754f7af1204f66277ba0327696b8db0ba6172703a249e92c99ea214dc8c42962bca4bbfd74d9b6417400c90","transactions":[{"ref_block_num":51008,"ref_block_prefix":2237465287,"expiration":"2019-08-24T00:52:35","operations":[[0,{"fee":{"amount":336718,"asset_id":"1.3.0"},"from":"1.2.50","to":"1.2.9981","amount":{"amount":"10000000000","asset_id":"1.3.0"},"memo":{"from":"SEER6uDmZCs76JMpFTHjcTFLmjPhkjLTnA8FP3wwmSo5X7fCDATLRe","to":"SEER646RGdL4gncz7y834wfGfcHECnKdbdVWd6gh9aEYdn3HWyhBjB","nonce":"401051605206583","message":"1143d782c85ec6a8f42b401af0289b3082ed72a79a9e64200caf8a4d099b90936e552093ab285fda2972a5cd7d6a541fedf144557440b742e201642a527a350a"},"extensions":[]}]],"extensions":[],"signatures":["206665af3497858608911b602d7b69fadd8e6324ecf7c24ded5b2885449b05535210189789b5c5aac2ebfa58084c1ecb430488bfba0112c28ea62eb81544397753"],"operation_results":[[0,{}]]}],"block_id":"00c8c74161854887391db23c38dd960268760f17","signing_key":"SEER81CmBUXQUTCLCsym74KM7S7PTRpU5WyWSRJ92ZWfVck5S3Fyai","transaction_ids":["15b922cbbd7f3648d92bed9f001a2cc99651228c"],"txs_count":1}} >
Recent Review
(ii) What does the Technologist I SEER Block Chain Pressure Test Tell Us about "Black Technology"
(vii) SEER Project Investor Nayun Sports and Hainan Province Wendu Joint Venture Registration Company
(SEER Super Welfare Attack! 5,000,000 SEER ready for you!
(vii) The Pilot Block Chain Research Center was officially established, and Nayun Sports became the chairman unit.
Wechat Group: Please add a small assistant, Wechat seeryuanyuan
Telegram:https://t.me/seerchain
Twitter: https://twitter.com/info_seer
Microblog: SEER Fan Community
Money World: https://i.bishijie.com/home/S...