OK so this is a weird one. In the process of pruning my garden, I may have accidentally deleted a character from the filename of the plot.
So if the plot filename was, say:
plot-k32-2021-05-05-21-56-0e60e386a4fe23ae7d2ef944f4287b478d95e234f78ad1603e391b49dcb9cbd2.plot
I assume this is of the form
plot-size-date-time-plot_id.plot
I accidentally deleted that last character, the 2
:
plot-k32-2021-05-05-21-56-0e60e386a4fe23ae7d2ef944f4287b478d95e234f78ad1603e391b49dcb9cbd.plot
ooops! This means I mangled the plot id in the filename
This does show up in the handy detect duplicates command
.\chia plots check -n 0 -l
however,
I don’t know what the missing plot ID character I deleted actually was
The plot, once I add a random digit to the file name , comes back as valid when I run a plot check on it like so
.\chia plots check -n 30 -g plot-k32-2021-05-05-21-56-0e60e386a4fe23ae7d2ef944f4287b478d95e234f78ad1603e391b49dcb9cbd3.plot
Is there a command that returns the proper plot ID? I don’t see a plot ID coming back in the check. In the meantime I’ve added a random digit to the filename and it definitely passes, but this particular plot almost certainly has an incorrect plot ID in the filename …
Devs confirmed in keybase chat: plot filename is irrelevant . It could be named
goofy-stinky-nose.plot
and it’d still work. Still trying to find out if there is a way to get the plot ID back from the file though… @eFishCent do you happen to know if any commands produce the plot ID? check
definitely does not .
2 Likes
LuaKT
May 11, 2021, 2:53am
3
The plot id is in the header, you can see the format here: chiapos/prover_disk.hpp at ce6ccc28ea300bfbad7e054a3f30433eb6090cf5 · Chia-Network/chiapos · GitHub
On linux you could do
xxd -s +19 -l 32 -p -c 32 plot-foo.plot
5 Likes
I wonder why chia plots check -l
tells me
2021-05-10T20:01:52.747 chia.plotting.check_plots : INFO Plot filenames expected to end with -[64 char plot ID].plot
That seems … incorrect?
1 Like
LuaKT
May 11, 2021, 3:08am
5
The filename is used only for the duplicate plot check, if you have two identical plots with different names it won’t be detected as a duplicate.
You can see the implementation here chia-blockchain/check_plots.py at main · Chia-Network/chia-blockchain · GitHub
3 Likes
Interesting, but that seems like " plot filename is irrelevant " is not exactly true… why does the dupe plot check naively use the filename if the canonical store of id info is in the header? Sounds like NBD, but also… a bit strange?
1 Like
LuaKT
May 11, 2021, 3:16am
7
I agree, I don’t like that it uses the filename at all.
According the comments its due to performance
# Skipped parsing and verifying plot ID for faster performance
# Skipped checking K size for faster performance
# Only checks end of filenames: 64 char plot ID + .plot = 69 characters
3 Likes
It makes sense that it uses the filename for performance, but give me an easy way to get the actual plot ID back if the filename gets mangled!
@LuaKT thank you for the detailed info! Very helpful! Unfortunately I am on Windows though…
2 Likes
@codinghorror :
give me an easy way to get the actual plot ID back if the filename gets mangled!
It’s 32 bytes long starting at byte 19 of the file. You can extract it from the command line:
xxd -s 19 -l 32 -g 32 -c 32 filename.plot | awk '{ print $2 }'
Or for PowerShell,
(Format-Hex -Count 32 -Offset 19 filename.plot).HexBytes.ToLower() -replace " ", "" -join("")
6 Likes
Y’all are awesome! Thank you! 🙇‍♂️
1 Like
Hmm, I tried this and I think the syntax is incorrect:
PS G:\> (Format-Hex -Count 32 -Offset 19 .\plot-k32-2021-05-10-19-48-55e54b2efdf5da9be10e06e2c2c1202c3119eec6d0ccd503a7242c12f9f6e9c6.tmp).HexBytes.ToLower() -replace " ", "" -join("")
Format-Hex : A parameter cannot be found that matches parameter name 'Count'.
At line:1 char:13
+ (Format-Hex -Count 32 -Offset 19 .\plot-k32-2021-05-10-19-48-55e54b2e ...
+ ~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Format-Hex], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Format-Hex
I don’t have time to look deeper at the moment but it seems to be complaining about the Count param?
I think that’s because it’s only available in newer versions of Powershell (aka > 7.1) and Windows 10 defaults to 5.1 ($host.Version
to know the Powershell version).
Format-Hex
on 5.1
Format-Hex
[-Path] <string[]>
[<CommonParameters>]
vs
Format-Hex
on 7.1
Format-Hex
[-Path] <String[]>
[-Count <Int64>]
[-Offset <Int64>]
[<CommonParameters>]
2 Likes
Oh – how do I get newer versions of Powershell?
You can get it on GitHub. GitHub - PowerShell/PowerShell: PowerShell for every system! They have them in easy .msi files, too. Just scroll down a little bit. It will install along-side the default PowerShell.
2 Likes
Ah yes, I definitely have 5.1.
PS C:\Users\jatwo> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.19041.906
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.906
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
I see, it does install side-by-side… kinda weird… there’s an “open with powershell 7” menu item now!
PS C:\Users\jatwo> $PSVersionTable
Name Value
---- -----
PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Microsoft Windows 10.0.19042
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Aaaaand … it works! Thank you @andrew94m and @notpeter and @LuaKT
PS G:\> (Format-Hex -Count 32 -Offset 19 .\plot-k32-2021-05-10-19-48-55e54b2efdf5da9be10e06e2c2c1202c3119eec6d0ccd503a7242c12f9f6e9c6.tmp).HexBytes.ToLower() -replace " ", "" -join("")
produces
55e54b2efdf5da9be10e06e2c2c1202c3119eec6d0ccd503a7242c12f9f6e9c6
And for the problem file which I deleted the final plot ID character, turns out the character was… drumroll… … a c
. I have now properly renamed the plot file, and all is well in the world again.
3 Likes
winwiz
May 14, 2021, 11:51am
19
Looks like you have figured out a way.
You can get your plot name from the logs in: .chia\mainnet\plotter
No logs, these are plots created at the command line. That advice only applies for plots created through the GUI, I think?
doink
May 14, 2021, 7:46pm
21
don’t mind me, just renaming all my plots to goof-stinky-noseXXXX.plot
1 Like