WIP - Indexer Usage

Submit balanced tx

Start IEx

In Shell

iex -S mix

Start client

In IEx

eclient = Anoma.Client.Examples.EClient.create_example_client

Start producing blocks

In IEx

Anoma.Node.Utility.Consensus.start_link(node_id: eclient.node.node_id, interval: 10000)

Start logger to see stuff

In IEx

Logger.configure(level: :debug)

Check Port and NodeId

In IEx
Copy node id before continuing

IO.puts("#{eclient.client.grpc_port} #{eclient.node.node_id}")

Create new intent

In IEx

Anoma.Node.Intents.IntentPool.new_intent("$NODEID", Examples.ETransparent.ETransaction.swap_from_actions)

^ Copy node id into “”

Check port

In IEx
Copy port before continuing

IO.puts("#{eclient.client.grpc_port} #{eclient.node.node_id}")

Use indexer to list all unrevealed commitments

echo "{}" | grpcurl -plaintext -d @ localhost:63423 Anoma.Protobuf.IndexerService.ListUnrevealedCommits

^ Use your own port

Check whether a tx was valid?

We can check this by verifying that a commitment from a transaction is in the set of commitments that we get from the indexer (currently we can only get ‘unrevealed commitments’ via ListUnrevealedCommits). The tx commitment can be computed in Juvix such that we only have to get the commitments from the indexer endpoint and compare whether the computed commitment is included, a la:

echo "{}" | grpcurl -plaintext -d @ localhost:58924 Anoma.Protobuf.IndexerService.ListUnrevealedCommits

Using filters

Using Postman to create the filter, sample filter:

{
    "filters": [
        {
            "owner": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
        }
    ],
    "node_info": {
        "node_id": "39891345"
    }
}

^ Few remarks:

  • the owner field corresponds to the zero’ed nullifier key
  • Fill in your own node id

Copy the above modulo necessary changes (node id), then put this into grpcurl (pbpaste works on mac)

pbpaste | grpcurl -plaintext -d @ localhost:63423 Anoma.Protobuf.BlockService.Filter

Next Up

  • Get indexer endpoint to fetch all commitments
2 Likes