How to get transaction fee from raw transaction? I know that we have to calc inputs total minus outputs to get transaction fee, but using getrawtrasnaction RPC call, inputs values are not attached. how is it possible to get transaction fee?

Array
(
    [txid] =&gt; 318abc03cfa52c996b01d6ff10faf86447341d78acdf849026dd4c22ebd56cab
    [hash] =&gt; 318abc03cfa52c996b01d6ff10faf86447341d78acdf849026dd4c22ebd56cab
    [version] =&gt; 2
    [size] =&gt; 226
    [vsize] =&gt; 226
    [locktime] =&gt; 0
    [vin] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [txid] =&gt; 71c6f340ef5f4688136e8b308393ff74a89b4bf780bf0e3c3611fa34dc858c07
                    [vout] =&gt; 0
                    [scriptSig] =&gt; Array
                        (
                            [asm] =&gt; 30450221009c305ffb2f04517ba1f422f22f0eded5afb855f0ee8cdd2634259774dfb0846b022019e05a9d25f21e808a0be320e3956a1e6fcb57cc4d725404db0bbab0ced78a88[ALL] 0221b96462902141e297804981ebc5465e475ebf0f4f4d7a4e558edc4856b33e75
                            [hex] =&gt; 4830450221009c305ffb2f04517ba1f422f22f0eded5afb855f0ee8cdd2634259774dfb0846b022019e05a9d25f21e808a0be320e3956a1e6fcb57cc4d725404db0bbab0ced78a8801210221b96462902141e297804981ebc5465e475ebf0f4f4d7a4e558edc4856b33e75
                        )

                    [sequence] =&gt; 4294967295
                )

        )

    [vout] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [value] =&gt; 0.01
                    [n] =&gt; 0
                    [scriptPubKey] =&gt; Array
                        (
                            [asm] =&gt; OP_DUP OP_HASH160 e673381ba3ce7fa72520a09ee4e3ad68cd5d6528 OP_EQUALVERIFY OP_CHECKSIG
                            [hex] =&gt; 76a914e673381ba3ce7fa72520a09ee4e3ad68cd5d652888ac
                            [reqSigs] =&gt; 1
                            [type] =&gt; pubkeyhash
                            [addresses] =&gt; Array
                                (
                                    [0] =&gt; n2XTjk57QJgjevmYb75tJHy7AJGGeoJv2e
                                )

                        )

                )

            [1] =&gt; Array
                (
                    [value] =&gt; 0.089981
                    [n] =&gt; 1
                    [scriptPubKey] =&gt; Array
                        (
                            [asm] =&gt; OP_DUP OP_HASH160 108e2c445972c2561d8cff8ee487cfe6e054ab59 OP_EQUALVERIFY OP_CHECKSIG
                            [hex] =&gt; 76a914108e2c445972c2561d8cff8ee487cfe6e054ab5988ac
                            [reqSigs] =&gt; 1
                            [type] =&gt; pubkeyhash
                            [addresses] =&gt; Array
                                (
                                    [0] =&gt; mh2VRUG7BA8Rutz9tqTuhinqZxRo3QinGi
                                )

                        )

                )

        )

    [hex] =&gt; 0200000001078c85dc34fa11363c0ebf80f74b9ba874ff9383308b6e1388465fef40f3c671000000006b4830450221009c305ffb2f04517ba1f422f22f0eded5afb855f0ee8cdd2634259774dfb0846b022019e05a9d25f21e808a0be320e3956a1e6fcb57cc4d725404db0bbab0ced78a8801210221b96462902141e297804981ebc5465e475ebf0f4f4d7a4e558edc4856b33e75ffffffff0240420f00000000001976a914e673381ba3ce7fa72520a09ee4e3ad68cd5d652888acd44c8900000000001976a914108e2c445972c2561d8cff8ee487cfe6e054ab5988ac00000000
    [blockhash] =&gt; eb31cb0c8de0e8b3219537e9304ee7d09d5dc7092ef17caed470b9a1aed2485e
    [confirmations] =&gt; 2269
    [time] =&gt; 1522693379
    [blocktime] =&gt; 1522693379
)
To get the input values, you need to look up the values of the outputs that they spend from. So call getrawtransaction one each input's txid and then find the output at index vout. The value of that output is the input value. Do that for all of the inputs and sum them. That is the total input value. Sum the values of the outputs to get the total output value. Subtract the total output value from the total input value and you will get the transaction fee paid.