Solana中令牌,帐户和相关帐户之间的概念差异

发布于 2025-02-10 20:37:38 字数 1099 浏览 2 评论 0原文

我来自以太坊环境,索拉纳概念有些混乱。我找到了各种指导代码步骤的教程,但并没有真正解释逻辑背后的概念。

我了解到,在Solana中,我们有没有数据的程序,只是逻辑 - 网络中的可执行实体。然后我们有帐户,实际上包含数据。

我已经通过solana文档和程序库阅读(例如令牌程序),但是我仍然有一些空白的理解点。

我必须设置一个自动化的NFT铸造管道,在代币,帐户和相关帐户的概念之间,我有点丢失。

现在,如果我遵循令牌程序教程(上面链接),它将指导我:

  1. 创建一个创建(或获取)关联帐户的薄荷
  2. 以便
  3. 帐户,

,我想知道

  • 一旦创建薄荷,在Solscan中搜索它,它打开了一个帐户实体。因此,薄荷实际上不是代币,而是一个拥有数据的帐户? (例如在这里)。另一方面,我实际上可以找到Solscan中的令牌实体。有什么区别?
  • 这个令牌(或帐户)没有任何元数据……实际上什么都没有。就像数据占位符一样。它实际上已经铸造了代币还是半烘烤的东西?如果是后者,那么我之后是否必须附加元数据?
  • 相关帐户是什么?
  • SPL库具有mintto函数,该功能在上述链接的教程中使用了Solana文档。是将令牌转移到另一个钱包的动作吗?该示例实际上将其转移到关联帐户中。这里的逻辑是什么?
  • 如果我使用公共Metaplex程序铸造令牌,并且我部署了自己的锚点程序 - 是否将元数据添加到铸造令牌中?这里的概念是什么,我不明白。
  • 当我准备好NFT(Minted + Metadata)时,我想将其转移到别人的钱包中 - 我实际上是否必须为该钱包创建一个关联的帐户,然后将令牌转移到该帐户?什么是基本概念?

I'm coming from an Ethereum environment and the Solana concepts are a bit confusing. I found various tutorials that guide thru the code steps, but don't really explain the concept behind the logic.

I understand that in Solana we've got Programs, that contain no data and are just logic - the executable entity in the network. And then we've got Accounts, which actually contain the data.

I've read thru the Solana docs and the Program library (eg. the Token Program), but I've still got some blank spots of understanding.

I gotta set up an automated NFT minting pipeline and I'm a bit lost between the concepts of tokens, accounts and associated accounts.

Now, if I follow the Token Program tutorial (linked above), it will guide me thru:

  1. creating a mint
  2. creating (or getting) an associated account
  3. minting a token to that account

So, I'm wondering

  • once I create the mint, and search for it in Solscan, it opens an Account entity. So, the mint is actually not a token, but just an Account that holds data? (eg. here). On the other hand I can actually find Token entities in Solscan. What's the difference?
  • this token (or account) doesn't have any metadata... literally nothing. It's like a data placeholder. Is it an actually minted token already or something half baked? If the latter, then do I have to attach the metadata afterwards?
  • what is the Associated Account for?
  • the SPL library has a mintTo function that is used in the above linked tutorial from the Solana docs. Is that the action of transferring a token to another wallet? The example actually transfers (mints) it to an Associated Account. What's the logic here?
  • if I use the public Metaplex Program to mint the tokens, and I deploy my own Anchor Program - is this program for adding the metadata to the minted tokens? What's the concept here, I don't get it.
  • When I've got an NFT ready (minted + metadata) and I want to transfer it to someone else's wallet - do I actually have to create an Associated Account for that wallet and then transfer the token to that Account? What's the underlying concept?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怀念你的温柔 2025-02-17 20:37:38

这里有很多问题要介绍,所以让我们一点一点地仔细阅读。

最重要的位是“帐户”一词的过载,这意味着许多不同的事情。 Solana中的帐户就像普通操作系统中的文件一样,它可以包含程序定义的任何数据。代币程序定义了:

  • 薄荷帐户,该帐户处理新的代币持有帐户的创建
  • (有时也称为令牌帐户),该帐户实际上持有数量的令牌,并且由某人所有,

至关重要的位置是这些都是帐户。因此,要解决您的问题:

创建薄荷并在Solscan中搜索它后,它将打开一个帐户实体。因此,薄荷实际上不是代币,而是一个拥有数据的帐户? (例如,这里)。另一方面,我实际上可以在Solscan找到令牌实体。有什么区别?

在此示例中,JAF858MSRDUQUHQCVQFA3KN8PNAVXZOKMVNAJIC3ZMPR是MINT地址(或代码类型),4flimhw2weagy.8ljtmcvkfqkfqklrb3zmf2vucjdqc2nqccccccjcjcjcjcjcj fore类型。 Solscan称其为“令牌帐户”。

这个令牌(或帐户)没有任何元数据...从字面上看。就像数据占位符一样。它实际上已经铸造了代币还是半烘烤的东西?如果是后者,那么我之后必须附加元数据吗?

正确,该帐户在4flimhw2weagy8ljtmcvkfqklrb3zmf2vucjdq2nqccjn没有元数据,MINT JAF8558MSRDUQUHQCVQCCCFA3KN8PNPNPNAVXZZZZZZZZZZZZZZZZZMMVNNAJICMPR也没有元数据。元数据附着在单独的帐户中,例如在元磁令值元数据标准中。在该模型中,如果您拥有铸造机构,则可以将其附加到薄荷。

关联帐户是什么?

关联的令牌帐户是定义给定钱包特定类型的“规范”帐户的标准,因此更容易找到向用户发送某种类型的令牌的位置。这样,只需使用e5gvxyglz1abcfqtcp14feeo8hy6yav8wr74xnpo1qbh < / code>的钱包地址,我就知道通过得出相关的令牌帐户来发送任何类型 /薄荷的代币。 4flimhw2weagy8ljtmcvkfqklrb3zmf2vucjdq2nqcjn是token mint jaf858msrduquhqcvqcfaxcccfa3kn8pnavxzzokmvnajic3ziic3zmpr

SPL库具有MINTTO函数,该函数在上述链接的教程中使用了Solana Docs。是将令牌转移到另一个钱包的动作吗?该示例实际上将其转移到关联帐户中。这里的逻辑是什么?

mintto创建全新的代币,并将它们放在持有帐户中,根本没有转移。

如果我使用公共Metaplex程序铸造令牌,并且我部署了自己的锚点程序 - 是否将元数据添加到铸造令牌中?这里的概念是什么,我不明白。

您不需要元数据的新程序 - 元磁令牌元数据程序为您做到这一点。与其他任何人一样,这是一个无状态程序,它定义了如何将数据写入帐户的逻辑。在这种情况下,该数据是令牌薄荷的元数据。

当我准备好NFT(Minted + Metadata)时,我想将其转移到别人的钱包中 - 我实际上是否必须为该钱包创建一个关联的帐户,然后将令牌传输到该帐户?什么是基本概念?

那是最好的做法。您可以将一个关联的令牌帐户转移到另一个帐户,如果目的地用户的关联令牌帐户尚不存在,则可以使用关联的令牌帐户程序创建它。 It will create a new token account at the address, eg 4FLiMhW2Weagy8LjtMCVkFQkLrB3zmF2VUcJDq2NQcJN, and assign it to the correct owner, eg E5GvXygLz1AbCFqtcp14feEo8hy6YAv8wr74Xnpo1qBH.

You can find all of the token program logic for minting at

There's a lot of questions to cover here, so let's go through bit by bit.

The most important bit is the overloading of the term "account", which means many different things. An account in Solana is like a file in a normal operating system, and it can contain any data as defined by a program. The token program defines:

  • mint accounts, which handle the creation of new tokens
  • holding accounts (also sometimes called token accounts), which actually hold quantities of tokens, and are owned by someone

The crucial bit is that these are all accounts. So to get to your questions:

once I create the mint, and search for it in Solscan, it opens an Account entity. So, the mint is actually not a token, but just an Account that holds data? (eg. here). On the other hand I can actually find Token entities in Solscan. What's the difference?

In this example, JAf858mSrDuQuHQCVqfA3KN8PNaVxZokMVNAJiC3zMpr is the mint address (or the token type), and 4FLiMhW2Weagy8LjtMCVkFQkLrB3zmF2VUcJDq2NQcJN is the address of a user's token holdings for that token type. Solscan calls this a "token account".

this token (or account) doesn't have any metadata... literally nothing. It's like a data placeholder. Is it an actually minted token already or something half baked? If the latter, then do I have to attach the metadata afterwards?

Correct, the account at 4FLiMhW2Weagy8LjtMCVkFQkLrB3zmF2VUcJDq2NQcJN has no metadata, and neither does the mint JAf858mSrDuQuHQCVqfA3KN8PNaVxZokMVNAJiC3zMpr. The metadata is attached in a separate account, like in the Metaplex token metadata standard. In that model, you can attach it to a mint if you have the minting authority.

what is the Associated Account for?

The Associated Token Account is a standard defining a "canonical" account for holding tokens of a particular type for a given wallet, so that it's easier to find where to send tokens of a certain type for a user. That way, just with your wallet address of E5GvXygLz1AbCFqtcp14feEo8hy6YAv8wr74Xnpo1qBH, I know where to send tokens of any type / mint by deriving the associated token account. 4FLiMhW2Weagy8LjtMCVkFQkLrB3zmF2VUcJDq2NQcJN is that derived address for token mint JAf858mSrDuQuHQCVqfA3KN8PNaVxZokMVNAJiC3zMpr.

the SPL library has a mintTo function that is used in the above linked tutorial from the Solana docs. Is that the action of transferring a token to another wallet? The example actually transfers (mints) it to an Associated Account. What's the logic here?

mintTo creates totally new tokens, and puts them in a holding account, no transferring done at all.

if I use the public Metaplex Program to mint the tokens, and I deploy my own Anchor Program - is this program for adding the metadata to the minted tokens? What's the concept here, I don't get it.

You don't need a new program for the metadata -- the Metaplex Token Metadata program does that for you. It's a stateless program, like any other, that defines logic for how to write data to an account. In this case, that data is metadata for a token mint.

When I've got an NFT ready (minted + metadata) and I want to transfer it to someone else's wallet - do I actually have to create an Associated Account for that wallet and then transfer the token to that Account? What's the underlying concept?

That's the best practice. You transfer from one associated token account to another, and if the destination user's associated token account doesn't exist yet, you can create it using the associated token account program. It will create a new token account at the address, e.g. 4FLiMhW2Weagy8LjtMCVkFQkLrB3zmF2VUcJDq2NQcJN, and assign it to the correct owner, e.g. E5GvXygLz1AbCFqtcp14feEo8hy6YAv8wr74Xnpo1qBH.

You can find all of the token program logic for minting at https://github.com/solana-labs/solana-program-library/blob/7caf27cca6a9f58055f93517774318eb2b2f97bf/token/program/src/processor.rs#L516 and for transferring at https://github.com/solana-labs/solana-program-library/blob/7caf27cca6a9f58055f93517774318eb2b2f97bf/token/program/src/processor.rs#L222 and for the associated token account program at https://github.com/solana-labs/solana-program-library/blob/7caf27cca6a9f58055f93517774318eb2b2f97bf/associated-token-account/program/src/processor.rs#L66

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文