filecoin-saturn / contracts

contracts
6 stars 0 forks source link

Docs: Clarify which private key in what format must be provided to CLI claim --method local #70

Open vorburger opened 1 year ago

vorburger commented 1 year ago

I am attempting to follow https://docs.saturn.tech/claim-your-rewards#be5761a498514ee4b78bc15ef3acd7f0 to Claim Earnings.

Need to use --method local as I do not have a Ledger nor running Lotus, so I'm doing:

$ RUSTFLAGS="-Clink-arg=-Wl,--allow-multiple-definition" cargo install --git https://github.com/filecoin-saturn/contracts cli
$ saturn-contracts --addr-to-claim $NODE_FIL_ADDRESS --factory-addr $CONTRACT_FIL_ADDRESS --method local
[*]
 |              _|_|_|              _|
 |              _|          _|_|_|  _|_|_|_|  _|    _|  _|  _|_|  _|_|_|
 |                _|_|    _|    _|    _|      _|    _|  _|_|      _|    _|
 |                    _|  _|    _|    _|      _|    _|  _|        _|    _|
 |              _|_|_|      _|_|_|      _|_|    _|_|_|  _|        _|    _|
 |
 |          -----------------------------------------------------------
 |          Saturn smart contracts 🪐.
 |          -----------------------------------------------------------
 |
[*] current gas price: 488057767
[*] using 10 retries
[*] Insert your private key to sign (it will not be displayed for security reasons):

It's unfortunately not entirely clear to me yet which private key in what format must be typed in here... I'm guessing this is what https://docs.saturn.tech/claim-your-rewards refers to as the Earnings Claiming Address - that one with ~0.5 FIL on it, which has both a 0x ETH account address and a f4 FILE address? I do own such an account, but pasting its 12 words (mnemonic?) to the prompt above fails with:

thread 'main' panicked at 'Error parsing private key: DecodeError(InvalidByte(5, 32))', /home/vorburger/.cargo/git/checkouts/contracts-f6dccc69c922f7ab/229706d/cli/src/utils.rs:320:29

I vaguely understand that the 12 words (mnemonic?) and private key are not the same, so I have tried to import the 12 words (mnemonic?) into Fox Wallet, which had a UI to Export Private Key giving me a 112 characters long String, but pasting that to the prompt above fails similiarly:

thread 'main' panicked at 'Error parsing private key: DecodeError(InvalidLastSymbol(110, 110))', /home/vorburger/.cargo/git/checkouts/contracts-f6dccc69c922f7ab/229706d/cli/src/utils.rs:320:29

BTW what's that --secret <SECRET> argument for a Path to the wallet mnemonic which saturn-contracts --help shows - can that be used for claim, or is that something else? If it can be used, what would that file have to contain? I tried putting the same 12 words (mnemonic?) into a file passed to --secret and add that argument, but it still asked for a "private key", FYI:

$ saturn-contracts -S ~/TEST claim --addr-to-claim $NODE_FIL_ADDRESS --factory-addr $CONTRACT_FIL_ADDRESS --method local
....
[*] Insert your private key to sign (it will not be displayed for security reasons):

I'll try to poke around the source code a bit to see if I can figure it out, but would love some guidance...

@AmeanAsad @aarshkshah1992 @alexander-camuto

vorburger commented 1 year ago

Using https://wallet.filfox.info/en/settings/private-key I have managed to "convert" my 12 words (mnemonic?) to a : Lotus type private key but that's not the right format either, that one fails saying:

thread 'main' panicked at 'Error parsing private key: GenericString("Invalid Key Length")', /home/vorburger/.cargo/git/checkouts/contracts-f6dccc69c922f7ab/229706d/cli/src/utils.rs:320:29
vorburger commented 1 year ago

I'm no longer blocked by this, as it using https://payouts.saturn.tech finally worked for me now (the "trick" that I was missing was simply to stop using MetaMask Flask with https://github.com/ChainSafe/filsnap and just use regular MetaMask).

Keeping this issue open instead of closing it myself because it still seems to me that some documentation (in README and/or output of the CLI) about exactly what kind/format of private key would be required by --method local may be useful to others.

AmeanAsad commented 10 months ago

@vorburger Addressed this in this PR: https://github.com/filecoin-saturn/contracts/issues/70 :)

vorburger commented 10 months ago

@AmeanAsad #70 is this bug ;),PR might be #78?

I'll test that when I have a minute, and update here.

AmeanAsad commented 10 months ago

@vorburger You are correct! Let me know if there are still issues and feel free to close if its fixed :)