I am trying to link my DID on mintgarden. I only have the Chia CLI wallet. Since I can’t use walletconnect, I decided to use “Sign message with DID in Pawket” except without Pawket. I don’t know how to compute some of the fields that it’s asking for, specifically “Synthetic key”, “Hint”, and “Message hash”. Is there a rough specification somewhere of how these fields should be computed? It doesn’t need to be a tutorial, it just needs to be less work than digging through the Pawket codebase.
I’m not sure how they are calculating the missing fields. Our DID sign
command is missing them as well. However, I was able to obtain the required info easily from the Pawket app. So it appears that you have three options:
- Install the reference wallet GUI somewhere and use WalletConnect. This could be done on a laptop. It does not require running a full node.
- Install the Pawket app and use their signing mechanism.
- Connect with the Pawket team to learn how their signing works so you can fill in the missing fields.
So I’m still trying to do it over RPC. This is where I’ve gotten so far by comparing with the output of Pawket. Only issue is getting the correct original public key. Does not seem like did_get_pubkey
will give it.
import asyncio
import os
import pathlib
from chia.rpc.wallet_rpc_client import WalletRpcClient
from chia.types.blockchain_format.program import Program
from chia.util.config import load_config
from chia.util.default_root import DEFAULT_ROOT_PATH
MESSAGE = "Verifying my profile on MintGarden at XXXXXXXXX."
DID = ...
WALLET_ID = ...
puzzle = Program.to((b"Chia Signed Message", MESSAGE))
async def amain():
root_path = pathlib.Path(os.environ.get("CHIA_ROOT", DEFAULT_ROOT_PATH))
config = load_config(root_path, "config.yaml")
client = await WalletRpcClient.create(
"localhost", config["wallet"]["rpc_port"], root_path, config
)
coin_id = (await client.get_did_id(WALLET_ID))["coin_id"]
assert DID == (await client.get_did_id(WALLET_ID))["my_did"]
# this returns a fresh pubkey each time for some reason
pubkey = (await client.fetch("did_get_pubkey", {"wallet_id": WALLET_ID}))["pubkey"]
synth_pubkey, signature, _ = await client.sign_message_by_id(DID, MESSAGE)
print(
f"""
Public Key: 0x{pubkey}
Synthetic Key: 0x{synth_pubkey}
Signature: 0x{signature}
DID: {DID}
Hint: {coin_id}
Message Hash: 0x{puzzle.get_tree_hash()}
Message: {MESSAGE}
"""
)
I have tweeted about DID verification which should get you the synthetic keys for the DID. Basically, you need to find the parent coin spend and extract values from it.
Chia DID is a singleton coin with a DID inner puzzle. The DID inner puzzle also wraps another puzzle which is typically the standard transaction puzzle with a curried synthetic public key.
Hope it helps!
Thank you. It seems like I need to communicate with my full node to perform this though. Do you know if it’s possible to do with just the light wallet and without public RPC?
I haven’t tried it, but I think you can use did_get_did to get the current coin_id
and use did_get_info to get the latest singleton spend.