问题描述
我正在运行 solana-keygen 工具,但对其输出感到困惑。我的印象是第一个命令的公钥输出应该与使用第二个命令重新创建的公钥相同。但它们是不同的。第一个代表什么?
useEffect(() => {
if (pushState && apiData) {
let productValues = apiData.data.data;
productValues.map((e) => {
let url = `url`;
return axios
.get(url)
.then((res) => {
if (res) {
// if the data is already in db,do not push
if (res.data.products.length === 0)
// if there is no data then push data
return setProductData({
variables: {
// values from state
title: e[titleHeader?.value],descriptionHtml: e[descriptionHtmlHeader?.value],handle: e[handleHeader?.value],img1: e[image1Header?.value] ?? "",alt1: e[altText1?.value],img2 : e[image2Header?.value] ?? '',alt2: e[altText2?.value],img3: e[image3Header?.value] ?? '',// and so on
},});
}
// this is the logger of whats being pushed into the database
})
.then((res) => {
if (res)
return axios.post("http://localhost:4000/api/v1/ExTradb",{
data: {
title: res?.data?.productCreate?.product?.title,handle: res?.data?.productCreate?.product?.handle,item_id: res?.data?.productCreate?.product?.id,},});
});
});
}
},[]);
解决方法
create 上打印的公钥是原始的 ed25519 密钥对公钥,而 solana-keygen pubkey prompt://
打印的是 m/44'/501' 处的公钥。
如果你运行 solana-keygen pubkey ASK
它应该打印原始公钥
目前有一个开放的 PR 来更新 CLI,但现在您可以按照上述进行操作。
https://github.com/solana-labs/solana/issues/17325#issuecomment-844317674