monza/README.md
Alex Vanin db7464d2d3 Initial commit
Signed-off-by: Alex Vanin <a.vanin@yadro.com>
2023-09-27 14:05:46 +03:00

5.3 KiB

Monza

Find notifications in Neo3 compatible chains and more.

Features

  • Stores chain blocks in the filesystem, so it will not fetch it again at restart
  • Works with multiple chains by storing chain blocks based on magic number
  • Detailed notification output for NEP and FrostFS notifications
  • Use relative numbers for search interval
  • Use nice names for native contracts
  • Search multiple notifications at once

Examples

$ monza run -r http://localhost:30333 --from 22 --to 24 -n NewEpoch:* -n Transfer:gas
syncing 100% [##################################################] (2/2, 3686 blocks/s)
block:22 at:2023-09-27T13:50:03+03:00 name:Transfer from:56c989e76f9a2ca05bb5caa6c96f524d905accd8 to:nil amount:69915670
block:22 at:2023-09-27T13:50:03+03:00 name:Transfer from:nil to:b248508f4ef7088e10c48f14d04be3272ca29eee amount:1219580
block:22 at:2023-09-27T13:50:03+03:00 name:Transfer from:nil to:b248508f4ef7088e10c48f14d04be3272ca29eee amount:50000000
block:22 at:2023-09-27T13:50:03+03:00 name:NewEpoch epoch:1
block:23 at:2023-09-27T13:50:04+03:00 name:Transfer from:05195d17c8f013e258eb8dde1236c19d9a61b608 to:nil amount:33917200
block:23 at:2023-09-27T13:50:04+03:00 name:Transfer from:6a131b2be19b7618dc22dbc8147015d947af67ce to:nil amount:12321080
block:23 at:2023-09-27T13:50:04+03:00 name:Transfer from:b248508f4ef7088e10c48f14d04be3272ca29eee to:nil amount:12325080
block:23 at:2023-09-27T13:50:04+03:00 name:Transfer from:nil to:b248508f4ef7088e10c48f14d04be3272ca29eee amount:8917170
block:23 at:2023-09-27T13:50:04+03:00 name:Transfer from:nil to:b248508f4ef7088e10c48f14d04be3272ca29eee amount:20000000
block:23 at:2023-09-27T13:50:04+03:00 name:Transfer from:nil to:b248508f4ef7088e10c48f14d04be3272ca29eee amount:50000000
block:23 at:2023-09-27T13:50:04+03:00 name:Transfer from:6a131b2be19b7618dc22dbc8147015d947af67ce to:c1e14f19c3e60d0b9244d06dd7ba9b113135ec3b amount:243839460
block:23 at:2023-09-27T13:50:04+03:00 name:Transfer from:b248508f4ef7088e10c48f14d04be3272ca29eee to:c1e14f19c3e60d0b9244d06dd7ba9b113135ec3b amount:250146763165

Detailed output

  • NEP-17 Transfer
block:23 at:2023-09-27T13:50:04+03:00 name:Transfer from:6a131b2be19b7618dc22dbc8147015d947af67ce to:c1e14f19c3e60d0b9244d06dd7ba9b113135ec3b amount:243839460
  • FrostFS NewEpoch
block:22 at:2023-09-27T13:50:03+03:00 name:NewEpoch epoch:1
  • FrostFS AddPeerSuccess
block:21 at:2023-09-27T13:50:02+03:00 name:AddPeerSuccess pubkey:[..6a8131]

Notifications

Search notifications based on notification name and contract address.

monza run -r [endpoint] --from 110000 --to 110100 -n NewEpoch:ab8a83432af3cd32ce6ba3797f62b1ba330d7c3d

Use wildcard to search notifications from any contract.

monza run -r [endpoint] --from 110000 --to 110100 -n NewEpoch:*

Use native contract names such as gas and neo.

monza run -r [endpoint] --from 110000 --to 110100 -n Transfer:gas

Search for multiple notifications.

monza run -r [endpoint] --from 110000 --to 110100 -n Transfer:gas -n NewEpoch:*

Intervals

Define start and stop blocks.

monza run -r [endpoint] --from 110000 --to 110100 -n NewEpoch:*

Omit --to flag to search up to the latest block.

monza run -r [endpoint] --from 110000 -n NewEpoch:*

To look for 100 blocks before the latest block use prefix m (minus)

monza run -r [endpoint] --from m100 -n NewEpoch:*

To look for 100 blocks after specified from block, use prefix p (plus)

monza run -r [endpoint] --from 101230 --to p100 -n NewEpoch:*

Other

Blocks are stored in bolt databases. Specify database dir with -c flag (default path is $HOME/.config/monza)

monza run -r [endpoint] -c ./cache --from 110000 --to 110100 -n NewEpoch:*

To speed up block fetching from the RPC node, use more parallel workers with -w flag.

monza run -r [endpoint] -w 100 --from 110000 --to 110100 -n NewEpoch:*

To disable progress bar use --disable-progress-bar flag.

Stutter

Stutter command searches for blocks that produced with threshold a delay or slower.

$ monza stutter -r [endpoint] --from 1159200 --to p30 --threshold 20s
syncing 100% [##################################################] (30/30, 10 blocks/s)       
block:1159201 at:2022-03-29T18:20:42+03:00
block:1159202 at:2022-03-29T18:22:12+03:00 [<- stutter for 1m30s]
-- skipped 5 blocks --
block:1159208 at:2022-03-29T18:23:43+03:00
block:1159209 at:2022-03-29T18:25:13+03:00 [<- stutter for 1m30s]
-- skipped 5 blocks --
block:1159215 at:2022-03-29T18:26:43+03:00
block:1159216 at:2022-03-29T18:28:13+03:00 [<- stutter for 1m30s]
-- skipped 5 blocks --
block:1159222 at:2022-03-29T18:29:43+03:00
block:1159223 at:2022-03-29T18:31:13+03:00 [<- stutter for 1m30s]

Explorer

Run monza in interactive mode to navigate through blocks, transactions and notifications with explore command.

$ monza explore -r [endpoint]

Build

Use make build command. Binary will be stored in ./bin/monza.

To Do

  • monza cache command to manage bbolt instances: provide size and option to delete
  • Add verbose flag with for detailed view of notification body
  • Add more native contract hashes aliases
  • More NEP support (NEP-11?)

License

Source code is available under the MIT License.