Eos: I want to know more about convert transaction to packed_transaction.

Created on 20 Oct 2018  路  7Comments  路  Source: EOSIO/eos

Here is my example signed transaction (in EOS Jungle Net).

{
"expiration": "2018-10-18T09:04:12",
"ref_block_num": 126,
"ref_block_prefix": 4290076718,
"max_net_usage_words": 0,
"max_cpu_usage_ms": 0,
"delay_sec": 0,
"context_free_actions": [],
"actions": [
    {
        "account": "eosio.token",
        "name": "transfer",
        "authorization": [
            {
                "actor": "bonotest1111",
                "permission": "active"
            }
        ],
        "data": "10420819ab4c273d20841019ab4c273de80300000000000004454f5300000000107468697320697320666f7220796f7521"
    }
],
"transaction_extensions": [],
"signatures": [
    "SIG_K1_KfhkQdFWGyKmwVhnoSdutR4RtmGyNknGFE1VSSNkyHtmS8RKJyQgAdBsGGnPnLpdF73Vq1NMDybpLTu9jJqNGZUzX6r6Hb"
],
"context_free_data": []
}

and next one is Packed-Transaction (using cleos convert pack_transaction)

{
  "signatures": [
    "SIG_K1_KfhkQdFWGyKmwVhnoSdutR4RtmGyNknGFE1VSSNkyHtmS8RKJyQgAdBsGGnPnLpdF73Vq1NMDybpLTu9jJqNGZUzX6r6Hb"
  ],
  "compression": "none",
  "packed_context_free_data": "",
  "packed_trx": "    8c4cc85b7e002e60b5ff000000000100a6823403ea3055000000572d3ccdcd0110420819ab4c273d00000000a8ed32323110420819ab4c273d20841019ab4c273de80300000000000004454f5300000000107468697320697320666f7220796f752100"
}

this is my analysis.

8c4cc85b : expiration ("2018-10-18T09:04:12" -> 8c4cc85b????)

7e00 : ref_block_num (126 == 7e -> 7e00 What??)

2e60b5ff : ref_block_prefix (4290076718 == 0xFFB5602E -> 2e60b5ff ?????)

00000000 : max_net_usage_words (0 net -> 0 I agree !)

01 : max_cpu_usage_ms (0 ms -> 01???? What????)

00a68234 : delay_sec (0 seconds -> 00a68234???? What??!!)

03ea3055000000572d3ccdcd0110420819ab4c273d00000000a8ed323231 : What is that?

10420819ab4c273d20841019ab4c273de80300000000000004454f5300000000107468697320697320666f7220796f7521 : action - data

00 : What is that?


Please help me! I want to make own convert source code...
I don't know how it works, and also can't find reference about trx to packed_trx...

All 7 comments

eosjs 20鈥檚 source is an example of how to pack

@tbfleming sir.. Could you explain more in detail for me? I don't know what "eosjs 20鈥檚 source" you said.

@Jeonghan-Seok Have you solved this Issue?

@anlebcoder Aside from the linked source of the eosjs library, cleos now offers a convert command, which includes convert pack_transaction.

@anlebcoder

Yes. I solved.

abi.abi.json
eosjs-numeric.ts
eosjs-serialize.ts

Three source file in eosjs
I have written my own source code with reference to this source code.
I'm very sorry Sir.. This source code is made for my company and I can't shared it for you.

@Jeonghan-Seok @jgiszczak

easy. I haved solved the issue.

transactions struct istransaction`

use eosjs:

eos.modules.Fcbuffer.fromBuffer(eos.fc.structs.transaction, Buffer.from(hex_data, 'hex'));

like this: https://github.com/anlebcoder/blogs/blob/master/decodebin.md

Was this page helpful?
0 / 5 - 0 ratings