Skip to main content

getapplicationlog method

Returns the contract event information based on the specified txid. The contract event information is stored under the ApplicationLogs directory.

note

You must install the plugins ApplicationLogs and LevelDBStore before you can invoke the method.

Parameter Description#

  • txid: Transaction ID

  • trigger type: Optional. It has the following options:

    • OnPersist
    • PostPersist
    • Application
    • Verification
    • System: OnPersist | PostPersist
    • All: OnPersist | PostPersist | Verification | Application

    It defaults to All. You can specify a trigger type.

Example#

Request body:

{  "jsonrpc": "2.0",  "id": 1,  "method": "getapplicationlog",  "params": [    "0x7da6ae7ff9d0b7af3d32f3a2feb2aa96c2a27ef8b651f9a132cfaad6ef20724c"  ]}

This transaction transfers 100 GAS from NgaiKFjurmNmiRzDRQGs44yzByXuSkdGPF to NikhQp1aAD1YFCiwknhM5LQQebj4464bCJ.

Response body 1:

{    "jsonrpc": "2.0",    "id": 1,    "result": {        "txid": "0x7da6ae7ff9d0b7af3d32f3a2feb2aa96c2a27ef8b651f9a132cfaad6ef20724c",        "executions": [            {                "trigger": "Application",                "vmstate": "HALT",                "exception": null,                "gasconsumed": "9999540",                "stack": [],                "notifications": [                    {                        "contract": "0x70e2301955bf1e74cbb31d18c2f96972abadb328",                        "eventname": "Transfer",                        "state": {                            "type": "Array",                            "value": [                                {                                    "type": "ByteString",                                    "value": "4rZTInKT6ZxPKQbVNVOrtKZy34Y="                                },                                {                                    "type": "ByteString",                                    "value": "+on7LBTfD1nd3wT25WUX8rNKrus="                                },                                {                                    "type": "Integer",                                    "value": "10000000000"                                }                            ]                        }                    }                ]            }        ]    }}

Response description:

  • txid: Transaction ID.

  • trigger: Triggers.

  • vmstate: VM execution state. HALT represents success, and FAULT represents failure.

  • gasconsumed: The transaction fee, which means the GAS consumed in the transaction execution.

  • notifications: The notification sent by the smart contract. If no notifications is returned it indicates the transfer is not successful. See the Note below.

  • contract: The contract sending the notification. Here is GasToken.

  • eventname: Event name of the notification.

  • state: Notification content, where ByteString is Base64-encoded wallet address and can be converted at https://neo.org/converter/index.

note

This example shows the log of a successful token transfer, however, in case of a failed transfer or NeoVM exception, the outcomes can be:

  • Failed transfer: no Transfer notification event is returned, execution ends in a HALT state with a stack value of False.

  • NeoVM exception: a Transfer notification event may or may not be returned, but execution ends in a FAULT state.