Open PrestackI opened 10 months ago
Why do we need this? gettransaction provides the body of any contracts in the transaction already in JSON format.
Unknown use cases.
Most likely fringe with limited applications.
I thought if it was built, it could be used for something.
I can close it if you don't think it is worth the effort.
Random Fringe Idea that comes to mind:
A script that would print the output of a Success from a process to the blockchain and then Wait until the getmessage is returned as included.
My current idea would take a total of ~40KB of space in the blockchain from ~19 days of work.
The total fees paid for the transactions would be ~1.397 GRC (~0.07352631 fees added per day).
We could probably add a flag for extra cost to store if needed.
It is not that it isn't worth the effort, it is that the functionality you asked for is already covered by an existing command.
My sense is that you want to use the messaging system as a stamp similar to the stamping service we have already?
If you use gettransaction and then send through jq, this will work out of the box... for example...
gridcoinresearchd gettransaction <hash> | jq -r '.contracts[]'
More specifically...
gridcoinresearchd gettransaction <hash>|jq -r '.contracts[]|if .type == "message" then .body else "" end'
returns the body of the contract if it is a message else returns nothing (empty string).
Not so much like the stamper, more of a "I found it! (here it is)" sort of recording.
That worked as expected but it does require an additional program to operate. The benefits of having it in within the console as a command line would be that it works out of the box. Perhaps maybe it would be more useful if you could call any part of the contract?
I don’t see a need to do this. The JSON is provided by the existing gettransaction call. jq is a ubiquitous utility provided for exactly this purpose - to parse JSON for downstream processing.
Acknowledged.
Closing with keywords:
Native Blockchain apps Built in console commands
Reopening this issue since the JSON is only parasable through the daemon and not in the native console.
"error: You must set rpcpassword=
I am not following your comment above?
@jamescowens I think they meant that gridcoinresearchd output can be non-JSON parsable if the return type is a string (as the quotes are not present) or if the command errored?
@PrestackI Use the RPC interface instead if you are writing a script to interact with the wallet for cases like that.
@jamescowens @div72 I think there is a gap in my understanding.
Is it possible to run a GUI wallet with the daemon being callable via RPC command line options?
Yes! Just put server=1 and set the rpc username and password in the config file.
Then the GUI instance will also respond to rpc requests just like a headless daemon.
@jamescowens I will have to retry this method and get back to you.
Feature Request
Describe the Feature Request I would like to see a console command that will return the body of a contract built into the console command list.
Command name would be "getmessage" and accept TX ID.
Describe Preferred Solution N/A
Describe Alternatives N/A
Related Code
Additional Context Bounty = 1,450 GRC (Payable by author upon integration into main chain)