# Usage example for: TransactionServiceGrpc.TransactionServiceStub.getTransactionTrees

**URL:** <https://forum.canton.network/t/usage-example-for-transactionservicegrpc-transactionservicestub-gettransactiontrees/1751>\
**Category:** App Development\
**Created:** [December 7, 2020, 2:34pm UTC](https://forum.canton.network/t/usage-example-for-transactionservicegrpc-transactionservicestub-gettransactiontrees/1751 "2020-12-07T14:34:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![entzik](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/entzik/32/865_2.png) [@entzik](https://forum.canton.network/u/entzik)\
**Post date:** [December 7, 2020, 2:34pm UTC](https://forum.canton.network/t/usage-example-for-transactionservicegrpc-transactionservicestub-gettransactiontrees/1751/1 "2020-12-07T14:34:22Z")

</div>

Hi,

I am not able to receive any transaction trees when subscribing with `TransactionServiceGrpc.TransactionServiceStub.getTransactionTrees`.

If I pass in a `GetTransactionsRequest` with a `TransactionFilter` as I would for `GetTransactions` (which works fine btw) I get an error saying `getTransactionTrees` cannot filter by templates.

If I pass an empty filter - TransactionFilter filter = new FiltersByParty(Map.of()) - I don’t get the error anymore but I don’t receive any transaction tree.

The only way I can get TransactionTree is when using `commandService..submitAndWaitForTransactionTree(...)`

Also, I was not able to find any example of using `TransactionServiceStub.getTransactionTrees`.

Can anyone please advise ?

thanks,  
Emil

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [December 7, 2020, 2:41pm UTC](https://forum.canton.network/t/usage-example-for-transactionservicegrpc-transactionservicestub-gettransactiontrees/1751/2 "2020-12-07T14:41:55Z")

</div>

You have to specify the party but no templates in your filter. So something like the following:

```haskell
TransactionFilter filter = new FiltersByParty(Collections.singletonMap(party, new InclusiveFilter())

```

---

<div class="post-metadata">

**Author:** ![entzik](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/entzik/32/865_2.png) [@entzik](https://forum.canton.network/u/entzik)\
**Post date:** [December 7, 2020, 2:52pm UTC](https://forum.canton.network/t/usage-example-for-transactionservicegrpc-transactionservicestub-gettransactiontrees/1751/3 "2020-12-07T14:52:56Z")

</div>

Thanks. There is no default constructor in InclusiveFilter, only one that takes a set of templates. If I pass in an empty set I still get:

```
io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Invalid argument: inviter-c13e4fb0-7226-4756-8c22-17a4d0b496e4 attempted subscription for templates []. Template filtration is not supported on GetTransactionTrees RPC. To get filtered data, use the GetTransactions RPC.
at io.grpc.Status.asRuntimeException(Status.java:533)
at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:453)
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:426)
at io.grpc.internal.ClientCallImpl.access$500(ClientCallImpl.java:66)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:689)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$900(ClientCallImpl.java:577)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:751)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:740)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
```

---

<div class="post-metadata">

**Author:** ![entzik](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/entzik/32/865_2.png) [@entzik](https://forum.canton.network/u/entzik)\
**Post date:** [December 7, 2020, 2:57pm UTC](https://forum.canton.network/t/usage-example-for-transactionservicegrpc-transactionservicestub-gettransactiontrees/1751/4 "2020-12-07T14:57:36Z")

</div>

but you set me on the right track, this works:

`TransactionFilter filter = new FiltersByParty(Map.of(party, NoFilter.instance))`
