1

For the parity node, the response for getting the transaction trace contain "callType" and "type" which are all "call". But for geth node we only get 'type':'Call'. So I am confused, whats the difference between "callType" and "type"?

https://etherscan.io/vmtrace?txhash=0x626590b434e06b79fdd2187b28a55569f6c0636c6806808beb6ce2c743e88188&type=parity#raw

 ...
 "action": {
  "callType": "call",
  "from": "0x8871759b2530fee82cd1b31c534252a1db707b0b",
  "gas": "0x25ce48",
  "input": "0x3dea52fc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003e8000000000000000000000000000000000000000000000000077e772392b600000000000000000000000000000000000000000000000000000000000000000001",
  "to": "0x94c0d029a7b64bf443e89c5006089364c0d60d61",
  "value": "0x0"
},
"blockHash": "0xbe847be2bceb74e660daf96b3f0669d58f59dc9101715689a00ef864a5408f43",
"blockNumber": 6000000,
"result": {
  "gasUsed": "0x2532ed",
  "output": "0x"
},
"subtraces": 1,
"traceAddress": [],
"transactionHash": "0x626590b434e06b79fdd2187b28a55569f6c0636c6806808beb6ce2c743e88188",
"transactionPosition": 45,
"type": "call"}, 

...

but for geth node, I got:

  ...
  'result': {'type': 'CALL',
  'from': '0x8871759b2530fee82cd1b31c534252a1db707b0b',
  'to': '0x94c0d029a7b64bf443e89c5006089364c0d60d61',
  'value': '0x0',
  'gas': '0x25ce48',
  'gasUsed': '0x2532ed',
  'input': 
 '0x3dea52fc00000000000000000000000000000000000000000000000000000000000000 
 0000000000000000000000000000000000000000000000000000000000000003e800000000 
 0000000000000000000000000000000000000000077e772392b600000000000000000000000000000000000000000000000000000000000000000001',
  'output': '0x',
  'time': '10.824367485s',
  ...

1 Answer 1

1

To get an answer to this question we can look at the source code for Parity-Ethereum and the documentation for the trace module.

There are two distinct definitions in the source:

Action

/// Action
#[derive(Debug)]
pub enum Action {
    /// Call
    Call(Call),
    /// Create
    Create(Create),
    /// Suicide
    Suicide(Suicide),
    /// Reward
    Reward(Reward),
}

CallType

/// Call type.
#[derive(Debug, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum CallType {
    /// None
    None,
    /// Call
    Call,
    /// Call code
    CallCode,
    /// Delegate call
    DelegateCall,
    /// Static call
    StaticCall,
}

So here we can see that every trace has an Action (represented by type in the JSON), and if the Action is a Call, then it can have a CallType (represented by calltype).

These are all generally represented by the Ethereum OpCodes:

Calls

0xf1    CALL    Message-call into an account    -   Complicated
0xf2    CALLCODE    Message-call into this account with alternative account's code  -   Complicated
0xf4    DELEGATECALL    Message-call into this account with an alternative account's code, but persisting into this account with an alternative account's code  -   Complicated
0xfa    STATICCALL  Similar to CALL, but does not modify state  -   40

Other

0xf0    CREATE  Create a new account with associated code   -   32000
0xff    SELFDESTRUCT    Halt execution and register account for later deletion  -   5000*

Not very sure about Reward, but here suggests it is for uncle and mining rewards.

4
  • Thanks for your detailed answer! I know this is out of scope, but I wonder what's the difference between Action and Calls and how can I generate the same result in geth node?
    – hao xu
    Commented Dec 7, 2018 at 2:16
  • 1
    What do you mean? A transaction will be the same whether processed by Parity or Geth. The resulting trace json is just a specific implementation of that client. Maybe I misunderstand your goal, are you trying to achieve something specific? Commented Dec 7, 2018 at 2:27
  • My goal is to get the same trace json schema using geth node, as I only have geth node. Then validate the result against parity trace(on etherscan). I have managed to get all the informations except for the trace Action type. In geth node there is only 5 trace call types: CREATE CALL CALLCODE DELEGATECALL SELFDESTRUCT (source code for geth call_tracer). It doesn't seem to match Action type or Calls type in parity trace json.
    – hao xu
    Commented Dec 7, 2018 at 3:04
  • I see references to STATICCALL here, so the only thing missing is Reward, which if you look at the post I linked to at the end, mentions it isn't even publicly used yet. So it does look like you have a one to one mapping here. Commented Dec 7, 2018 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.