github.com/TrueBlocks/trueblocks-core/src/apps/chifra@v0.0.0-20241022031540-b362680128f7/internal/when/README.md (about) 1 ## chifra when 2 3 The `chifra when` tool answers one of two questions: (1) "At what date and time did a given block 4 occur?" or (2) "What block occurred at or before a given date and time?" 5 6 In the first case, supply a block number or hash and the date and time of that block are displayed. 7 In the later case, supply a date (and optionally a time) and the block number that occurred at or 8 just prior to that date is displayed. 9 10 The values for `date` and `time` are specified in JSON format. `hour`/`minute`/`second` are 11 optional, and if omitted, default to zero in each case. Block numbers may be specified as either 12 integers or hexadecimal number or block hashes. You may specify any number of dates and/or blocks 13 per invocation. 14 15 ```[plaintext] 16 Purpose: 17 Find block(s) based on date, blockNum, timestamp, or 'special'. 18 19 Usage: 20 chifra when [flags] < block | date > [ block... | date... ] 21 22 Arguments: 23 blocks - one or more dates, block numbers, hashes, or special named blocks (see notes) 24 25 Flags: 26 -l, --list export a list of the 'special' blocks 27 -t, --timestamps display or process timestamps 28 -U, --count with --timestamps only, returns the number of timestamps in the cache 29 -r, --repair with --timestamps only, repairs block(s) in the block range by re-querying from the chain 30 -c, --check with --timestamps only, checks the validity of the timestamp data 31 -u, --update with --timestamps only, bring the timestamp database forward to the latest block 32 -d, --deep with --timestamps --check only, verifies timestamps from on chain (slow) 33 -o, --cache force the results of the query into the cache 34 -D, --decache removes related items from the cache 35 -x, --fmt string export format, one of [none|json*|txt|csv] 36 -v, --verbose enable verbose output 37 -h, --help display this help screen 38 39 Notes: 40 - The block list may contain any combination of number, hash, date, special named blocks. 41 - Block numbers, timestamps, or dates in the future are estimated with 13 second blocks. 42 - Dates must be formatted in JSON format: YYYY-MM-DD[THH[:MM[:SS]]]. 43 ``` 44 45 Data models produced by this tool: 46 47 - [count](/data-model/other/#count) 48 - [message](/data-model/other/#message) 49 - [namedblock](/data-model/chaindata/#namedblock) 50 - [timestamp](/data-model/chaindata/#timestamp) 51 52 ### Other Options 53 54 All tools accept the following additional flags, although in some cases, they have no meaning. 55 56 ```[plaintext] 57 -v, --version display the current version of the tool 58 --output string write the results to file 'fn' and return the filename 59 --append for --output command only append to instead of replace contents of file 60 --file string specify multiple sets of command line options in a file 61 ``` 62 63 **Note:** For the `--file string` option, you may place a series of valid command lines in a file using any 64 valid flags. In some cases, this may significantly improve performance. A semi-colon at the start 65 of any line makes it a comment. 66 67 **Note:** If you use `--output --append` option and at the same time the `--file` option, you may not switch 68 export formats in the command file. For example, a command file with two different commands, one with `--fmt csv` 69 and the other with `--fmt json` will produce both invalid CSV and invalid JSON. 70 71 *Copyright (c) 2024, TrueBlocks, LLC. All rights reserved. Generated with goMaker.*