0

I'm wondering if there any way to find transaction by input/output address.

In REST API Reference GET /state/{address} is mentioned, but I don't understand what I get in response:

{
  "data": "oXiAODM1OGFjYzgyY2FmYmY1ZjUzZmNjNDcwMzE0YTMzYjk1N2ViMzE0ZmI1OWU3MmVkNDVkNjNhMTZjZDAxMjc5NTg1OTliY2Q3ZDQ0ZmI4NWUxZDBmZGY5ZmJmYTU3N2FhZjgyYWNlNzBkMDVmZDJmYWIzMzNhMTYzMDM5Y2U3NDZ2MjAxOC0wOS0xOSBhdCAxMzoxMTo0OQ==",
  "head": "22972511836daa61bef7b9b987760579bcc249809a6f2ff59b3050e989bc2ace116d5c4c1cea10fba0aad25f200bb117e6958765be1047a67493590c07b2603c",
  "link": "http://xxx.xxx.xxx.xxx:8080/state/4536b54af36b6dbad85af2bf228500aaa7f89d11cf0bac0f3290a5977bae443d74d692?head=22972511836daa61bef7b9b987760579bcc249809a6f2ff59b3050e989bc2ace116d5c4c1cea10fba0aad25f200bb117e6958765be1047a67493590c07b2603c"
}

I've tried to decode data from response, figured out that it is Base64 encoded and that it contains only payload of transaction.

Is there any way to get the ID of transaction?

Roman Pavlov
  • 119
  • 1
  • 11
  • See https://stackoverflow.com/questions/52893764/how-to-get-the-transaction-id-from-hyperledger-sawtooth – Frank C. Oct 20 '18 at 09:19

1 Answers1

1

You can fetch a Sawtooth transaction with the REST API using GET /transactions/{transaction_id}

You need to know the transaction ID. The client submits and creates the transaction ID and would know it. The transaction ID is also listed in the transaction header for each transaction in a blockchain. You can also list all transactions with GET /transactions

Yes, the data is base64-encoded. After decoding, you need to deserialize. The deserializing method is up to the Transaction Processor that processes the transaction. Common serialization methods are Protobuf and CBOR.

Dan Anderson
  • 2,265
  • 1
  • 9
  • 20
  • For sure, client knows the transaction ID when submits. But what if only address is known? Is there a way to fetch all transactions with that address for example? – Roman Pavlov Oct 23 '18 at 10:08
  • 2
    No, I don't know of a way to do that with the REST API. You can fetch all transactions and examine each one in the inputs and outputs list for the transaction. An alternative is to keep a local database of all state changes indexed by the state address. – Dan Anderson Oct 23 '18 at 16:03