|
| 1 | +# Transaction information |
| 2 | + |
| 3 | +The `npx zksync-cli transaction info` command is designed to fetch and display detailed information about a specific transaction. It can be used to check the status, amounts transferred, fees, method signatures, and arguments of transactions on the chain of choice. |
| 4 | + |
| 5 | +### Table of contents |
| 6 | +- [Options](#options) |
| 7 | +- [Examples](#example-usage) |
| 8 | + - [Basic usage](#basic-usage) |
| 9 | + - [Parsing transaction data](#parsing-transaction-data) |
| 10 | + - [Viewing detailed information](#viewing-detailed-information) |
| 11 | + - [Displaying raw JSON response](#displaying-raw-json-response) |
| 12 | + |
| 13 | +<br /> |
| 14 | + |
| 15 | +--- |
| 16 | + |
| 17 | +<br /> |
| 18 | + |
| 19 | +### Options |
| 20 | +You do not need to specify options bellow, you will be prompted to enter them if they are not specified. |
| 21 | + |
| 22 | +- `--tx <transaction hash>`: Specify the transaction hash to query. |
| 23 | +- `--chain <chain-name>`: Select the chain to use (e.g., `zksync-mainnet`, `zksync-sepolia`). |
| 24 | +- `--rpc <url>`: Provide RPC URL instead of selecting a chain |
| 25 | +- `--full`: Show all available transaction data for comprehensive insights. |
| 26 | +- `--raw`: Display the raw JSON response from the node. |
| 27 | +- `--abi <path>`: Path to a local ABI file to decode the transaction's input data. |
| 28 | + |
| 29 | +If no options are provided directly, the CLI will prompt the user to enter the necessary information, such as the chain and transaction hash. |
| 30 | + |
| 31 | +<br /> |
| 32 | + |
| 33 | +--- |
| 34 | + |
| 35 | +<br /> |
| 36 | + |
| 37 | +## Example usage |
| 38 | + |
| 39 | +### Basic usage |
| 40 | +```bash |
| 41 | +npx zksync-cli transaction info |
| 42 | +``` |
| 43 | + |
| 44 | +You will be prompted to select a chain and transaction hash. |
| 45 | +```bash |
| 46 | +? Chain to use: zkSync Sepolia Testnet |
| 47 | +? Transaction hash: 0x2547ce8219eb7ed5d73e68673b0e4ded83afc732a6c651d43d9dc49bb2f13d40 |
| 48 | +``` |
| 49 | + |
| 50 | +The command will then display detailed information about the transaction, including its status, from/to addresses, value transferred, method signature with arguments, and more: |
| 51 | +``` |
| 52 | +──────────────────── Main info ──────────────────── |
| 53 | +Transaction hash: 0x2547ce8219eb7ed5d73e68673b0e4ded83afc732a6c651d43d9dc49bb2f13d40 |
| 54 | +Status: completed |
| 55 | +From: 0x56DDd604011c5F8629bd7C2472E3504Bd32c269b |
| 56 | +To: 0xBB5c309A3a9347c0135B93CbD53D394Aa84345E5 |
| 57 | +Value: 0 ETH |
| 58 | +Fee: 0.0001503581 ETH | Initial: 0.0004 ETH Refunded: 0.0038496419 ETH |
| 59 | +Method: transmit(bytes,bytes32[],bytes32[],bytes32) 0xc9807539 |
| 60 | +
|
| 61 | +───────────────── Method arguments ───────────────── |
| 62 | +[1] bytes: 0x0000000000000000000000fd69e45d6f51e482ac4f8f2e14f2155200008b5f010001020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000007df298c81a0000000000000000000000000000000000000000000000000000007df298c81a0000000000000000000000000000000000000000000000000000007df298c81a |
| 63 | +[2] bytes32[]: 0xd737d65b6b610c3f330bcfddbfc08e46d2a628c88bf22ec0d8f25627a3330798,0x9d33be2ba33b731555c13a4e7bf02d3d576fa3115f7523cbf07732321c85cdba |
| 64 | +[3] bytes32[]: 0x73d639deda36b781ae049c8eceafba4196ee8ecc1efb74c538a28ea762ff6658,0x37ac79ff2ca902140613b0e51357d8fb218a67b4736bdee0c268c5fd9812e146 |
| 65 | +[4] bytes32: 0x0101000000000000000000000000000000000000000000000000000000000000 |
| 66 | +
|
| 67 | +───────────────────── Details ───────────────────── |
| 68 | +Date: 2/8/2024, 2:19:54 PM (15 minutes ago) |
| 69 | +Block: #364999 |
| 70 | +Nonce: 50131 |
| 71 | +``` |
| 72 | + |
| 73 | +### Parsing transaction data |
| 74 | +By default `zksync-cli` tries to fetch contract verification data from the server. |
| 75 | +In case this is not possible it queries the [open signature](https://www.4byte.directory/) database to get signature of the transaction method. |
| 76 | +If the method signature is not found, the transaction's data is displayed as a hex string. |
| 77 | + |
| 78 | + |
| 79 | +Alternatively, you can provide the path to a local ABI file to decode the transaction's input data: |
| 80 | +```bash |
| 81 | +npx zksync-cli transaction info \ |
| 82 | + --abi "./Greeter.json" |
| 83 | +``` |
| 84 | + |
| 85 | +### Viewing detailed information |
| 86 | +For an even more detailed overview you can use the `--full` option: |
| 87 | + |
| 88 | +```bash |
| 89 | +npx zksync-cli transaction info --full |
| 90 | +``` |
| 91 | + |
| 92 | +### Displaying raw JSON response |
| 93 | +If you prefer to see the raw JSON response from the zkSync node, use the `--raw` option: |
| 94 | + |
| 95 | +```bash |
| 96 | +npx zksync-cli transaction info --raw |
| 97 | +``` |
0 commit comments