Skip to content

Instantly share code, notes, and snippets.

@paulperegud
Created March 6, 2017 11:59
Show Gist options
  • Save paulperegud/5b75aa2499ab3813331952cd7f28b7f2 to your computer and use it in GitHub Desktop.
Save paulperegud/5b75aa2499ab3813331952cd7f28b7f2 to your computer and use it in GitHub Desktop.
geth: --light switch changing behavior of filters
Geth was started using `geth --testnet --rpc`
In eth_newFilter call "latest" is specified and logs contain non-null blockHash, as per documentation.
pawel@ppsh:~$ mv .ethereum/testnet/geth.ipc .ethereum/testnet/geth.ipc.original
pawel@ppsh:~$ socat -t1000 -x -v UNIX-LISTEN:/home/pawel/.ethereum/testnet/geth.ipc,mode=777,reuseaddr,fork UNIX-CONNECT:/home/pawel/.ethereum/testnet/geth.ipc.original
> 2017/03/06 12:37:42.323238 length=283 from=0 to=282
7b 22 6a 73 6f 6e 72 70 63 22 3a 20 22 32 2e 30 {"jsonrpc": "2.0
22 2c 20 22 70 61 72 61 6d 73 22 3a 20 5b 7b 22 ", "params": [{"
74 6f 70 69 63 73 22 3a 20 5b 22 30 78 64 64 66 topics": ["0xddf
32 35 32 61 64 31 62 65 32 63 38 39 62 36 39 63 252ad1be2c89b69c
32 62 30 36 38 66 63 33 37 38 64 61 61 39 35 32 2b068fc378daa952
62 61 37 66 31 36 33 63 34 61 31 31 36 32 38 66 ba7f163c4a11628f
35 35 61 34 64 66 35 32 33 62 33 65 66 22 2c 20 55a4df523b3ef",
6e 75 6c 6c 2c 20 22 30 78 30 30 30 30 30 30 30 null, "0x0000000
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0000000000000000
30 38 36 61 30 36 65 61 62 30 36 35 30 32 39 35 086a06eab0650295
64 63 65 64 38 36 38 30 31 63 64 36 32 39 37 32 dced86801cd62972
37 64 65 65 31 33 34 31 35 22 5d 2c 20 22 61 64 7dee13415"], "ad
64 72 65 73 73 22 3a 20 22 30 78 36 38 39 65 64 dress": "0x689ed
34 32 45 63 30 43 33 62 33 42 37 39 39 44 63 35 42Ec0C3b3B799Dc5
36 35 39 37 32 35 42 66 35 33 36 36 33 35 46 34 659725Bf536635F4
35 64 31 22 7d 5d 2c 20 22 6d 65 74 68 6f 64 22 5d1"}], "method"
3a 20 22 65 74 68 5f 6e 65 77 46 69 6c 74 65 72 : "eth_newFilter
22 2c 20 22 69 64 22 3a 20 30 7d ", "id": 0}
--
< 2017/03/06 12:37:42.326015 length=71 from=0 to=70
7b 22 6a 73 6f 6e 72 70 63 22 3a 22 32 2e 30 22 {"jsonrpc":"2.0"
2c 22 69 64 22 3a 30 2c 22 72 65 73 75 6c 74 22 ,"id":0,"result"
3a 22 30 78 64 33 63 36 33 34 30 34 39 35 31 62 :"0xd3c63404951b
62 35 37 30 32 61 33 38 34 32 35 64 31 65 64 62 b5702a38425d1edb
30 37 35 65 22 7d 0a 075e"}.
--
2017/03/06 12:39:42 socat[28536] E write(6, 0x1270a40, 58): Broken pipe
> 2017/03/06 12:40:12.321566 length=112 from=0 to=111
7b 22 6a 73 6f 6e 72 70 63 22 3a 20 22 32 2e 30 {"jsonrpc": "2.0
22 2c 20 22 70 61 72 61 6d 73 22 3a 20 5b 22 30 ", "params": ["0
78 64 33 63 36 33 34 30 34 39 35 31 62 62 35 37 xd3c63404951bb57
30 32 61 33 38 34 32 35 64 31 65 64 62 30 37 35 02a38425d1edb075
65 22 5d 2c 20 22 6d 65 74 68 6f 64 22 3a 20 22 e"], "method": "
65 74 68 5f 67 65 74 46 69 6c 74 65 72 43 68 61 eth_getFilterCha
6e 67 65 73 22 2c 20 22 69 64 22 3a 20 31 32 7d nges", "id": 12}
--
< 2017/03/06 12:40:12.327333 length=638 from=0 to=637
7b 22 6a 73 6f 6e 72 70 63 22 3a 22 32 2e 30 22 {"jsonrpc":"2.0"
2c 22 69 64 22 3a 31 32 2c 22 72 65 73 75 6c 74 ,"id":12,"result
22 3a 5b 7b 22 61 64 64 72 65 73 73 22 3a 22 30 ":[{"address":"0
78 36 38 39 65 64 34 32 65 63 30 63 33 62 33 62 x689ed42ec0c3b3b
37 39 39 64 63 35 36 35 39 37 32 35 62 66 35 33 799dc5659725bf53
36 36 33 35 66 34 35 64 31 22 2c 22 74 6f 70 69 6635f45d1","topi
63 73 22 3a 5b 22 30 78 64 64 66 32 35 32 61 64 cs":["0xddf252ad
31 62 65 32 63 38 39 62 36 39 63 32 62 30 36 38 1be2c89b69c2b068
66 63 33 37 38 64 61 61 39 35 32 62 61 37 66 31 fc378daa952ba7f1
36 33 63 34 61 31 31 36 32 38 66 35 35 61 34 64 63c4a11628f55a4d
66 35 32 33 62 33 65 66 22 2c 22 30 78 30 30 30 f523b3ef","0x000
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0000000000000000
30 30 30 30 30 64 38 66 31 63 64 63 38 63 31 38 00000d8f1cdc8c18
64 66 63 33 63 63 30 64 66 31 30 62 61 31 36 32 dfc3cc0df10ba162
62 32 65 62 38 66 65 32 61 32 32 39 34 22 2c 22 b2eb8fe2a2294","
30 78 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0x00000000000000
30 30 30 30 30 30 30 30 30 30 38 36 61 30 36 65 000000000086a06e
61 62 30 36 35 30 32 39 35 64 63 65 64 38 36 38 ab0650295dced868
30 31 63 64 36 32 39 37 32 37 64 65 65 31 33 34 01cd629727dee134
31 35 22 5d 2c 22 64 61 74 61 22 3a 22 30 78 30 15"],"data":"0x0
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0000000000000000
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0000000000000000
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0000000000000000
30 31 33 31 31 66 37 33 39 37 35 30 30 37 38 22 01311f739750078"
2c 22 62 6c 6f 63 6b 4e 75 6d 62 65 72 22 3a 22 ,"blockNumber":"
30 78 39 64 33 64 63 22 2c 22 74 72 61 6e 73 61 0x9d3dc","transa
63 74 69 6f 6e 49 6e 64 65 78 22 3a 22 30 78 32 ctionIndex":"0x2
22 2c 22 74 72 61 6e 73 61 63 74 69 6f 6e 48 61 ","transactionHa
73 68 22 3a 22 30 78 32 38 33 32 62 63 61 62 61 sh":"0x2832bcaba
64 31 66 65 61 61 38 38 65 38 34 31 62 32 65 37 d1feaa88e841b2e7
35 32 61 36 31 63 30 34 62 32 66 37 32 64 34 34 52a61c04b2f72d44
65 64 31 65 34 33 34 63 35 37 39 65 30 30 35 31 ed1e434c579e0051
62 65 34 31 39 31 31 22 2c 22 62 6c 6f 63 6b 48 be41911","blockH
61 73 68 22 3a 22 30 78 65 66 31 31 63 62 32 31 ash":"0xef11cb21
32 34 63 31 30 31 61 63 62 39 63 64 32 65 38 64 24c101acb9cd2e8d
33 34 66 61 34 37 30 62 33 38 66 36 34 33 36 62 34fa470b38f6436b
66 36 34 36 33 32 65 61 62 31 64 34 61 33 65 66 f64632eab1d4a3ef
62 33 39 61 64 34 31 38 22 2c 22 6c 6f 67 49 6e b39ad418","logIn
64 65 78 22 3a 22 30 78 33 22 2c 22 72 65 6d 6f dex":"0x3","remo
76 65 64 22 3a 66 61 6c 73 65 7d 5d 7d 0a ved":false}]}.
--
< 2017/03/06 12:40:12.337147 length=58 from=638 to=695
7b 22 6a 73 6f 6e 72 70 63 22 3a 22 32 2e 30 22 {"jsonrpc":"2.0"
2c 22 65 72 72 6f 72 22 3a 7b 22 63 6f 64 65 22 ,"error":{"code"
3a 2d 33 32 36 30 30 2c 22 6d 65 73 73 61 67 65 :-32600,"message
22 3a 22 45 4f 46 22 7d 7d 0a ":"EOF"}}.
Geth was started using `geth --light --testnet --rpc`
Problem: blockHash is null, despite using "latest" switch in eth_newFilter call.
pawel@ppsh:~$ mv .ethereum/testnet/geth.ipc .ethereum/testnet/geth.ipc.original
pawel@ppsh:~$ socat -t1000 -x -v UNIX-LISTEN:/home/pawel/.ethereum/testnet/geth.ipc,mode=777,reuseaddr,fork UNIX-CONNECT:/home/pawel/.ethereum/testnet/geth.ipc.original
> 2017/03/06 12:48:59.755013 length=283 from=0 to=282
7b 22 6a 73 6f 6e 72 70 63 22 3a 20 22 32 2e 30 {"jsonrpc": "2.0
22 2c 20 22 70 61 72 61 6d 73 22 3a 20 5b 7b 22 ", "params": [{"
74 6f 70 69 63 73 22 3a 20 5b 22 30 78 64 64 66 topics": ["0xddf
32 35 32 61 64 31 62 65 32 63 38 39 62 36 39 63 252ad1be2c89b69c
32 62 30 36 38 66 63 33 37 38 64 61 61 39 35 32 2b068fc378daa952
62 61 37 66 31 36 33 63 34 61 31 31 36 32 38 66 ba7f163c4a11628f
35 35 61 34 64 66 35 32 33 62 33 65 66 22 2c 20 55a4df523b3ef",
6e 75 6c 6c 2c 20 22 30 78 30 30 30 30 30 30 30 null, "0x0000000
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0000000000000000
30 38 36 61 30 36 65 61 62 30 36 35 30 32 39 35 086a06eab0650295
64 63 65 64 38 36 38 30 31 63 64 36 32 39 37 32 dced86801cd62972
37 64 65 65 31 33 34 31 35 22 5d 2c 20 22 61 64 7dee13415"], "ad
64 72 65 73 73 22 3a 20 22 30 78 36 38 39 65 64 dress": "0x689ed
34 32 45 63 30 43 33 62 33 42 37 39 39 44 63 35 42Ec0C3b3B799Dc5
36 35 39 37 32 35 42 66 35 33 36 36 33 35 46 34 659725Bf536635F4
35 64 31 22 7d 5d 2c 20 22 6d 65 74 68 6f 64 22 5d1"}], "method"
3a 20 22 65 74 68 5f 6e 65 77 46 69 6c 74 65 72 : "eth_newFilter
22 2c 20 22 69 64 22 3a 20 30 7d ", "id": 0}
--
< 2017/03/06 12:48:59.757216 length=71 from=0 to=70
7b 22 6a 73 6f 6e 72 70 63 22 3a 22 32 2e 30 22 {"jsonrpc":"2.0"
2c 22 69 64 22 3a 30 2c 22 72 65 73 75 6c 74 22 ,"id":0,"result"
3a 22 30 78 39 36 33 35 34 38 36 38 63 62 38 34 :"0x96354868cb84
30 33 64 62 30 65 64 66 33 61 36 32 33 62 36 63 03db0edf3a623b6c
37 31 38 38 22 7d 0a 7188"}.
--
< 2017/03/06 12:48:59.758909 length=58 from=71 to=128
7b 22 6a 73 6f 6e 72 70 63 22 3a 22 32 2e 30 22 {"jsonrpc":"2.0"
2c 22 65 72 72 6f 72 22 3a 7b 22 63 6f 64 65 22 ,"error":{"code"
3a 2d 33 32 36 30 30 2c 22 6d 65 73 73 61 67 65 :-32600,"message
22 3a 22 45 4f 46 22 7d 7d 0a ":"EOF"}}.
--
> 2017/03/06 12:50:29.750853 length=111 from=0 to=110
7b 22 6a 73 6f 6e 72 70 63 22 3a 20 22 32 2e 30 {"jsonrpc": "2.0
22 2c 20 22 70 61 72 61 6d 73 22 3a 20 5b 22 30 ", "params": ["0
78 39 36 33 35 34 38 36 38 63 62 38 34 30 33 64 x96354868cb8403d
62 30 65 64 66 33 61 36 32 33 62 36 63 37 31 38 b0edf3a623b6c718
38 22 5d 2c 20 22 6d 65 74 68 6f 64 22 3a 20 22 8"], "method": "
65 74 68 5f 67 65 74 46 69 6c 74 65 72 43 68 61 eth_getFilterCha
6e 67 65 73 22 2c 20 22 69 64 22 3a 20 36 7d nges", "id": 6}
--
< 2017/03/06 12:50:29.753861 length=568 from=0 to=567
7b 22 6a 73 6f 6e 72 70 63 22 3a 22 32 2e 30 22 {"jsonrpc":"2.0"
2c 22 69 64 22 3a 36 2c 22 72 65 73 75 6c 74 22 ,"id":6,"result"
3a 5b 7b 22 61 64 64 72 65 73 73 22 3a 22 30 78 :[{"address":"0x
36 38 39 65 64 34 32 65 63 30 63 33 62 33 62 37 689ed42ec0c3b3b7
39 39 64 63 35 36 35 39 37 32 35 62 66 35 33 36 99dc5659725bf536
36 33 35 66 34 35 64 31 22 2c 22 74 6f 70 69 63 635f45d1","topic
73 22 3a 5b 22 30 78 64 64 66 32 35 32 61 64 31 s":["0xddf252ad1
62 65 32 63 38 39 62 36 39 63 32 62 30 36 38 66 be2c89b69c2b068f
63 33 37 38 64 61 61 39 35 32 62 61 37 66 31 36 c378daa952ba7f16
33 63 34 61 31 31 36 32 38 66 35 35 61 34 64 66 3c4a11628f55a4df
35 32 33 62 33 65 66 22 2c 22 30 78 30 30 30 30 523b3ef","0x0000
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0000000000000000
30 30 30 30 64 38 66 31 63 64 63 38 63 31 38 64 0000d8f1cdc8c18d
66 63 33 63 63 30 64 66 31 30 62 61 31 36 32 62 fc3cc0df10ba162b
32 65 62 38 66 65 32 61 32 32 39 34 22 2c 22 30 2eb8fe2a2294","0
78 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 x000000000000000
30 30 30 30 30 30 30 30 30 38 36 61 30 36 65 61 00000000086a06ea
62 30 36 35 30 32 39 35 64 63 65 64 38 36 38 30 b0650295dced8680
31 63 64 36 32 39 37 32 37 64 65 65 31 33 34 31 1cd629727dee1341
35 22 5d 2c 22 64 61 74 61 22 3a 22 30 78 30 30 5"],"data":"0x00
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0000000000000000
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0000000000000000
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0000000000000000
30 66 63 35 34 39 33 31 61 31 62 34 35 37 22 2c 0fc54931a1b457",
22 62 6c 6f 63 6b 4e 75 6d 62 65 72 22 3a 6e 75 "blockNumber":nu
6c 6c 2c 22 74 72 61 6e 73 61 63 74 69 6f 6e 49 ll,"transactionI
6e 64 65 78 22 3a 22 30 78 30 22 2c 22 74 72 61 ndex":"0x0","tra
6e 73 61 63 74 69 6f 6e 48 61 73 68 22 3a 22 30 nsactionHash":"0
78 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 x000000000000000
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0000000000000000
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0000000000000000
30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 0000000000000000
30 22 2c 22 62 6c 6f 63 6b 48 61 73 68 22 3a 6e 0","blockHash":n
75 6c 6c 2c 22 6c 6f 67 49 6e 64 65 78 22 3a 22 ull,"logIndex":"
30 78 30 22 2c 22 72 65 6d 6f 76 65 64 22 3a 66 0x0","removed":f
61 6c 73 65 7d 5d 7d 0a alse}]}.
--
< 2017/03/06 12:50:29.759841 length=58 from=568 to=625
7b 22 6a 73 6f 6e 72 70 63 22 3a 22 32 2e 30 22 {"jsonrpc":"2.0"
2c 22 65 72 72 6f 72 22 3a 7b 22 63 6f 64 65 22 ,"error":{"code"
3a 2d 33 32 36 30 30 2c 22 6d 65 73 73 61 67 65 :-32600,"message
22 3a 22 45 4f 46 22 7d 7d 0a ":"EOF"}}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment