---
# System prepended metadata

title: Untitled

---

SPIKE: Explore Operation Query API options

Use cases:
1. DApp developer, I am interested in a specific operation to be queried.
2. All operations in specific block, i.e. get operations not scoped to account - it may necessitate entry point for a Block instead or maybe queries through this entry point.

NOTE: We are not looking for product code here, it is a prototype to understand what the user experience would be, does it align with GraphQL concepts,  

**Acceptance criteria:**
- Create a new root field called Operation
- See sample operations in the examples below from mainnet for all kinds TezGraph currently supports(transaction, endorsement, delegation, origination, reveal)
- For "source" property, return a object with the Account Entity fields excluding field resolver entities.
- Note, that some fields only applicable to certain kinds of operations. We are not sure if it is more aligned with GraphQL to return different subsets of fields for each kind, or have different entry points for each kind of operations. The goal is to make it easy for users to query and consume as well.
-- Explore which options are available (maybe more than listed above)
-- Document pro/cons in the comments. Consider usability tradeoffs(more work/complexity for users, more work/complexity for implementation), performance, effort etc. 

```
{
  operation(operation_hash: "onsZtZR1xWQ3Un8zpJUadaTRbxJfMjaL343TdZQg3zbPYvJXU8Q") {
    source {
        address,
        first_seen,
        public_key,
    }
    destination, //only for Transaction
    fee,
    consumed_milligas, //for all operations except Endorsement
    contract_address, //only for Origination
    
  }
}
```


See all mainnet operation hash's examples below

## Transaction

https://tzstats.com/oogJQZM1bHNSzJ6egr6dAFweERUTmJLTjR7Nf9XbNrjMkQbddSs/39721104

A transaction tranferring 1 XTZ token from one implicit account to another

## Batch with a delegation operation and a reveal

https://tzstats.com/oor5wo9VNWR7YCcZbeLYBmpYz49hLKaPhcXs8CxFUYTLcGRxsYo

## Endorsement

https://tzstats.com/ooZjp8U7frcHzENsXr5aKz85PWCxBm3aYvQ4RZZAzjaAkzhjxEr
This is an endorsment operation

## Batch with contract call and transfer

https://tzstats.com/onsZtZR1xWQ3Un8zpJUadaTRbxJfMjaL343TdZQg3zbPYvJXU8Q/39938569

This operation has two items. A contract call, and a transfer of 0.005 XTZ tokens from an orginatied acccount (KT1) to an implicit account (TZ1)

## Batch with reveal and contract origination

- oo4mxPGHCwCjETB3QCSQdfYwAsgb6mP9nbrvVUnPYcfC3Ht7xYx
 This has operation has two items in its batch. A Public Key Reval and a "New delegator" contract (an origination)

Batch operations 



















USER STORY: Retrieve Operations Query API
As a web developer I want to query for the details of a Tezos operation using the operation hash so that I can get all details of the operation, such as sender/reciever, gas and number of confirmations.


**Acceptance criteria:**
- When all/one operation requested through the Account Query API return the following most generic fields:
-- operations.id
-- operations.hash
-- operations.batch_position
-- operations.kind
-- operations.timestamp
-- operations.level
-- operations.block
-- operations.source
-- operations.fee
-- operations.counter
-- operations.amount
-- ?operations.parameters
-- ?operations.entrypoint
-- ?operations.contract_address
-- ?operations.destination
-- ?operations.delegate
-- ?operations.public_key
-- ?Add operations.target in place of operations.contract_address(Origination), operations.destination (Transaction), operations.delegate (Delegation), operations.delegate (Endorsement)



