-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Add --memo
support to solana command-line
#10831
Comments
Hi, I'll take a look at this, if anyone else is working on it or wants to work on it, please let me know! |
Updated SPL Memo program is here: https://explorer.solana.com/address/MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr |
In your opinion, does the memo program deserve the same level of support as nonce? I ask because I am still familiarizing myself with how solana works and I notice that the way nonces are used is very similar to how memos would be used (similar not in application - nonces are very different in purpose than memos - but similar in how they fit into the mechanism of adding an extra instruction to transactions). I am still trying to figure out lots of the details of how transactions are composed and submitted, but I think that very likely memo support would work very similarly to nonce support. However, nonces appear to be a deeply embedded concept - for example, the sdk knows about them. Do you envision memo support being that deep? Should the sdk know about them (i.e. adding a "new_with_memo" function very similar to the "new_with_nonce" function of the sdk)? Or should these be inserted into the transaction purely using functions created within the cli source code? |
Memo doesn't need to be quite as deep as Durable Nonce. Durable Nonce has a few quirks that justify its specialization. For one, it is implemented as part of the system program and requires special handling in the runtime. Additionally, for a transaction to be flagged Durable Nonce, it must issue a How I envision this working is a new |
Ditto what @t-nelson said. We don't want an sdk dependency on the memo program.
Yes exactly, this ^ |
One exception might be a |
Thank you for your prompt and very helpful answers. And no worries about "plumbing hell", my only lament is that not understanding the overarching design goals (yet!) I don't feel very comfortable making structural changes that would improve this. But in terms of just using the existing patterns, I can totally do that. |
Sorry if this question is a bit dense but ... what would be the point of including a memo with a command line transaction? Is it just to get the memo instructions into the transaction so that they can be looked up later when examining the transaction and thus can be used as a sort of 'tag' on the transaction? For example would I do: "solana transfer --with-memo="Payment for order 1234567" ..." and then expect later to be able to look at that transfer transaction and be able to then extract the memo data from the instruction stream and associate "Payment for order 1234567" with the transaction? If so ... does there need to be code in the cli to do that automatically, for example in the 'transaction-history' command? And if that is so ... when about for example 'solana vote-account'? If the vote-account were created with a transaction that included a memo, would we expect to see that memo emitted in the output of 'solana vote-account'? |
I wonder also, should 'solana block' decode memo data into utf-8 strings as it prints out the decoded instruction data? |
yeah! Here's a block with a memo in it: It sadly just prints this:
|
Yes, exactly
We can't really expose this in account-state queries like
Yes, I think that would be nice. |
|
oops, correction. that utf shows up in the log but not in the instruction data itself |
OK then sorry to be further dense but ...why does the memo program have any inputs other than data then? If it's just meant to be something that gets injected into the instruction stream as tagging data, why does the program also need to have signers? Is that just so that the memo program is useful as a stand-alone program that at a minimum at least can record a text "message" that can be proven to have been vetted by the signers by virtue of being signed? But for the purposes of embedding a message in another transaction, the extra signers is not necessary ... right? I'm just thinking out loud and want to make sure I understand this. |
Yes, you've got that all essentially right. The signing feature in the memo was also targeting a specific use case where a client is tracking transaction logs, and wants to be able to verify the memo and its provenance. For the this cli application, I don't think that we need to pass any signer addresses to the memo instruction. |
Thank you. I am so new to all of this, a little guidance really helps keep me from going down a lot of thought process dead ends! |
📈 yep! |
… that submit transactions. Also, improve the block command to show UTF-8 string instead of integer values for memo program data.
#16291) * issue #10831: added --with-memo option to all cli commands that submit transactions. Also, improve the block command to show UTF-8 string instead of integer values for memo program data. * Fixed tests and changed some syntax according to feedback. * Use spl_memo id (all versions where applicable) instead of hardcoding id. * Update Cargo.toml in programs/bpf. * Update formatting via cargo fmt. * Update to use spl_memo version 3.0.1, which simplifies package imports
#16291) * issue #10831: added --with-memo option to all cli commands that submit transactions. Also, improve the block command to show UTF-8 string instead of integer values for memo program data. * Fixed tests and changed some syntax according to feedback. * Use spl_memo id (all versions where applicable) instead of hardcoding id. * Update Cargo.toml in programs/bpf. * Update formatting via cargo fmt. * Update to use spl_memo version 3.0.1, which simplifies package imports (cherry picked from commit 364af3a) # Conflicts: # cli-output/Cargo.toml # cli-output/src/display.rs # cli/Cargo.toml # cli/tests/transfer.rs
#16291) * issue #10831: added --with-memo option to all cli commands that submit transactions. Also, improve the block command to show UTF-8 string instead of integer values for memo program data. * Fixed tests and changed some syntax according to feedback. * Use spl_memo id (all versions where applicable) instead of hardcoding id. * Update Cargo.toml in programs/bpf. * Update formatting via cargo fmt. * Update to use spl_memo version 3.0.1, which simplifies package imports (cherry picked from commit 364af3a) # Conflicts: # cli-output/Cargo.toml # cli/Cargo.toml
…t (bp #16291) (#16387) * issue #10831: added --with-memo option to all cli commands that submit (#16291) * issue #10831: added --with-memo option to all cli commands that submit transactions. Also, improve the block command to show UTF-8 string instead of integer values for memo program data. * Fixed tests and changed some syntax according to feedback. * Use spl_memo id (all versions where applicable) instead of hardcoding id. * Update Cargo.toml in programs/bpf. * Update formatting via cargo fmt. * Update to use spl_memo version 3.0.1, which simplifies package imports (cherry picked from commit 364af3a) # Conflicts: # cli-output/Cargo.toml # cli/Cargo.toml * Fix conflicts Co-authored-by: bji <bryan@ischo.com> Co-authored-by: Tyera Eulberg <tyera@solana.com>
Can I send the memo using web3.js transaction? |
@fabiooshiro , yes. There will be a npm package when this PR is complete: solana-labs/solana-program-library#2583 |
With the SPL Memo program on mainnet-beta (http://explorer.solana.com/account/Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo), we can now add a generic
--memo
argument to all cli commands that issue transactions to include a memo.The text was updated successfully, but these errors were encountered: