Skip to content

Instantly share code, notes, and snippets.

@bladedoyle
Last active July 15, 2019 18:07
Show Gist options
  • Save bladedoyle/bcbcd80706268d7223b6de7e8c9fe24d to your computer and use it in GitHub Desktop.
Save bladedoyle/bcbcd80706268d7223b6de7e8c9fe24d to your computer and use it in GitHub Desktop.
How to find a transaction on the grin blockchain
How to find a transaction on the grin blockchain:
-------------------------------------------------
If you have the slate file, you can get the shared transaction id with:
cat payment_slate.json | jq .id
The transaction id will look like this:
6d7e9c04-18b4-4b8f-b3a3-b52bd6e9b18a
You can then get the status from your wallet:
grin-wallet -p passwd txs | grep 6d7e9c04-18b4-4b8f-b3a3-b52bd6e9b18a | awk '{print $1}'
If you dont have the slate file, you can just run "grin-wallet -p passwd txs" and identify the transaction id based on the amount.
Then you can use that id number to get the transaction record:
grin-wallet -p passwd txs -i 93
The output of that command will have a "Transaction Log" which tells you if the transaction was "Confirmed?".
It will also have a "Wallet Outputs" section which includes the "Output Commitment" and tell you which "Block Height" the transaction was recorded in the blockchain.
Transaction Log - Account 'default' - Block Height: 259672
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Id Type Shared Transaction Id Creation Time Confirmed? Confirmation Time Num. Num. Amount Amount Fee Net Tx
Inputs Outputs Credited Debited Difference Data
===========================================================================================================================================================================
93 Received Tx 6d7e9c04-18b4-4b8f-b3a3-b52bd6e9b18a 2019-07-15 17:15:23 true 2019-07-15 17:24:11 0 1 3.84735083 0.0 None 3.84735083 None
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Wallet Outputs - Account 'default' - Block Height: 259672
------------------------------------------------------------------------------------------------------------------------------------------------------------
Output Commitment MMR Index Block Height Locked Until Status Coinbase? # Confirms Value Tx
============================================================================================================================================================
09b06173069a874924f4f4b372cbf71db08657080170f3e6cabeeb6016599de866 None 259664 0 Unspent false 9 3.847350830 93
------------------------------------------------------------------------------------------------------------------------------------------------------------
An alternate method without using the wallet:
If you have the slate, you can get the output with:
cat payment_slate.json | jq .tx.body.outputs[0].commit
The output will look like this:
09b06173069a874924f4f4b372cbf71db08657080170f3e6cabeeb6016599de866
Go to the block explorer, and enter the outpout in the search input field:
Output 09b0617306...
Output Type Transaction
Commit 09b06173069a874924f4f4b372cbf71db08657080170f3e6cabeeb6016599de866
Occurrences 1
Block Height 259664
Spent False
An alternative to using an online blockchain explorer is to query a grin core node directly:
curl 127.0.0.1:3413/v1/chain/outputs/byids?id=09b06173069a874924f4f4b372cbf71db08657080170f3e6cabeeb6016599de866
[
{
"commit": "09b06173069a874924f4f4b372cbf71db08657080170f3e6cabeeb6016599de866",
"height": 259664,
"mmr_index": 3004079
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment