2

How to insert json data in Tendermint in order to fetch using Tx_search URL

curl "localhost:26657/tx_search?query=\"account.owner='Ivan'\"&prove=true"

Guys I see this example on every platform, but no-one talks about how account.owner is added

Help me with writing JSON object on tendermint from commandline.

InsaneCat
  • 2,115
  • 5
  • 21
  • 40
Priyal
  • 31
  • 3
  • re: how account.owner is added: It's right above the "Querying transactions" section https://tendermint.com/docs/app-dev/indexing-transactions.html#adding-tags – melekes Aug 26 '18 at 04:23
  • @insaneCat that's in go, but buddy I'm finding JSON to write from command line. – Priyal Aug 26 '18 at 05:12
  • I am also finding it hard to understand the documentation, how is it added? – Minh Tran Nov 06 '18 at 06:18

2 Answers2

0

https://tendermint.com/docs/app-dev/indexing-transactions.html#adding-tags

As documentation says, the tags are added in ResponseDeliverTx. The example there is in Golang. Should be similar for other languages.

E.g., in Javascript using https://github.com/tendermint/js-abci:

deliverTx (request) {
  let tx = padTx(request.tx)
  let number = tx.readUInt32BE(0)
  if (number !== state.count) {
    return { code: 1, log: 'tx does not match count' }
  }

  // update state
  state.count += 1

  return { code: 0, log: 'tx succeeded', tags: { "account.owner": "Priyal" } }
}

Full listing can be found here

melekes
  • 1,880
  • 2
  • 24
  • 30
0

You can find the answer on the official Tendermint documentation.

On page 17, there is an example POST using JSON - you must adhere to the jsonrpc format defined there, and make sure your tx field is base-64-encoded.

Paul Benn
  • 1,911
  • 11
  • 26
Qiu Yingzi
  • 26
  • 3
  • Welcome to Stack Overflow. While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. [Answers that are little more than a link may be deleted.](https://stackoverflow.com/help/deleted-answers) – Rumit Patel Dec 20 '18 at 08:48