Find private_key to use with standard selected coin

Hi, I am a little bit lost with so much new info.
I am playing with some contribution_coin similar idea to piggybank, using python. I can select a coin, I can get the puzzle reveal, modified solution. but when it comes to signing, I need some synthetic private key that fits that chosen_coin_puzzle_hash, right?
so my guess is that I have to use “chia/wallet/puzzles/p2_delegated_puzzle_or_hidden_puzzle.py”, or “chia/wallet/derive_keys.py”.

and do some:
synthetic_offset == sha256(hidden_puzzle_hash + original_public_key)
synthentic_public_key == original_public_key + synthetic_offset_pubkey

I might be far from the right path.

Hidden_puzzle_hash is just the puzzle_hash from coin to spend?
How do I get from “synthetic_offset” to “synthetic_offset_pubkey”?
Some link to extra info, or simple examples?

appreciate in advance, thanks.

I am going to go ahead and answer myself.
There is a function at “chia/wallet/wallet_state_manager.py” called get_keys(puzzle_hash), that is the one to implement.

Looks ok.

If you mean spending the standard puzzle coin, yes, you should get the synthetic_private_key using calculate_synthetic_secret_key. There are also calculate_synthetic_public_key and calculate_synthetic_offset in that file.

I have a quick sample here if it helps.