Newer
Older
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
```
{
field: "code"
op: "!="
value: ""
}
```
We want an account filter that only includes accounts with a balance less then 1000:
```
{
field: "balance"
op: "<"
value: "1000"
}
```
We want an account filter that only includes accounts with a balance higher then 0, but less then 1000.
```
{
field: "balance"
op: ">"
value: "0"
}
```
```
{
field: "balance"
op: "<"
value: "1000"
}
```
The field `code` is supported by accounts. It allows for the `==` and `!=` operators. The value `""` means the empty hex string.
If we wanted only non-contract accounts then we would have used the same object but changed it to `op: "=="`.
###HTTP Queries
The structure of a normal query is: `q=field:[op]value+field2:[op2]value2+ ... `.
- `op` is the relational operator, `>, <, >=, <=, ==, !=`.
- `value` is the value to compare against, e.g. `balance:>=5` or `language:==golang`.
There is also support for [range queries](https://help.github.com/articles/search-syntax/): `A..B`, where `A` and `B` are number-strings. You may use the wildcard `*` instead of a number. The wildcard is context-sensitive; if it is put on the left-hand side it is the minimum value, and on the right-hand side it means the maximum value. Let `height` be an unsigned byte with no additional restrictions. `height:*..55` would then be the same as `height:0..55`, and `height:*..*` would be the same as `height:0..255`.
NOTE: URL encoding applies as usual. Omitting it here for clarity.
`op` will default to (`==`) if left out, meaning `balance:5` is the same as `balance:==5`
`value` may be left out if the field accepts the empty string as input. This means if `code` is a supported string type, `code:==` would check if the code field is empty. We could also use the inferred `==` meaning this would be equivalent: `code:`. The system may be extended so that the empty string is automatically converted to the null-type of the underlying field, no matter what that type is. If balance is a number then `balance:` would be the same as `balance:==0` (and `balance:0`).
#####Example
We want to use the same filter as in the JSON version; one that finds all contract accounts.
One that finds non-contract accounts with 0 <= balance <= 1000: