美文网首页
[快速入门]使用web3j监听besu上智能合约的事件

[快速入门]使用web3j监听besu上智能合约的事件

作者: 张亚伦 | 来源:发表于2021-07-13 17:16 被阅读0次

    原理总结:

    1. 注册事件过滤器(eth_newFilter)
    2. 获取过滤器的全部内容(eth_getFilterLogs)
    3. 获取过滤器自上次轮询之后新生成的内容(eth_getFilterChanges)

    下面示例通过websocket方式进行事件监听。
    包含原始监听方法(web3j生成的)和自定义监听方法。

    1)原始监听方法

    开启监听:

      private static void NativeMonitor(String address) throws Exception {
            printDate("NativeMonitor-------start   ");
            OperateSimpleStorage demo = new OperateSimpleStorage();
            WebSocketService ws = new WebSocketService("ws://192.168.1.173:20001", false);
            ws.connect();
            demo.web3j = Web3j.build(ws);
    
            String nodePrivateKey = "64755535577827648861303110208099730047500721376293500434445799234699007278691";
            BigInteger gasPrice = BigInteger.valueOf(0);
            BigInteger gasLimit = BigInteger.valueOf(5000000);
            demo.credentials = Credentials.create(new BigInteger(nodePrivateKey).toString(16));
            demo.staticGasProvider = new StaticGasProvider(gasPrice, gasLimit);
            demo.address = address;
    
            SimpleStorage contract = SimpleStorage.load(
                    address,
                    demo.web3j,
                    (TransactionManager) (new RawTransactionManager(demo.web3j, demo.credentials, 40, 500)),
                    demo.staticGasProvider);
            Flowable<SimpleStorage.SetEventIndexParamEventResponse> res = contract.setEventIndexParamEventFlowable(new DefaultBlockParameterNumber(0), DefaultBlockParameterName.LATEST);
            res.subscribe((m) -> {
                System.out.println("*************** start ********************");
                System.out.println(objectToJson(m));
                System.out.println("*************** end  ********************");
            }, (e) -> {
                System.out.println(e);
            });
            printDate("NativeMonitor-------end  ");
        }
    

    日志输出:

    address----------------------------------0xC5bbA68089785E3bC6B4a300C87A88124af21A4f
    NativeMonitor-------start   Tue Jun 29 16:52:07 CST 2021
    
    16:52:08.204 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Opened WebSocket connection to ws://192.168.1.173:20001
    16:52:09.008 [main] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_newFilter","params":[{"topics":["0xa991d4b93f07260dd532613694474d84d9047d8040f481a277d4989f3b9e5754"],"fromBlock":"0x0","toBlock":"latest","address":["0xC5bbA68089785E3bC6B4a300C87A88124af21A4f"]}],"id":0}
    16:52:09.079 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":0,"result":"0x3eca2f946ec6a393e7ecdbabae3136f8"} from server ws://192.168.1.173:20001
    16:52:09.106 [main] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_getFilterLogs","params":["0x3eca2f946ec6a393e7ecdbabae3136f8"],"id":1}
    16:52:19.689 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":1,"result":[{"logIndex":"0x0","removed":false,"blockNumber":"0x16e72e","blockHash":"0xf17cd979ead87b0be0fe6059f434e200add632e95a4c9503585e8faff0cd6449","transactionHash":"0x00ef5a7983240e84837817432bb263e61fd699911bb1bd21a353c23ca4bfd9c5","transactionIndex":"0x0","address":"0xc5bba68089785e3bc6b4a300c87a88124af21a4f","data":"0x000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000005766e3030310000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005626e303032000000000000000000000000000000000000000000000000000000","topics":["0xa991d4b93f07260dd532613694474d84d9047d8040f481a277d4989f3b9e5754","0x000000000000000000000000000000000000000000000000000000000000006f","0x000000000000000000000000c5bba68089785e3bc6b4a300c87a88124af21a4f"]},{"logIndex":"0x0","removed":false,"blockNumber":"0x16ede2","blockHash":"0x570e551e5fe04f2e7100fd9e78633192ced1cdeacce8b08635ec6d408eea3390","transactionHash":"0xf18c096115c12cc9cc72a19d137c64e1975b3fda6eeb2589b4b2bfd9b3ff3229","transactionIndex":"0x0","address":"0xc5bba68089785e3bc6b4a300c87a88124af21a4f","data":"0x000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000007766e3030333333000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005626e303033000000000000000000000000000000000000000000000000000000","topics":["0xa991d4b93f07260dd532613694474d84d9047d8040f481a277d4989f3b9e5754","0x0000000000000000000000000000000000000000000000000000000001627f43","0x000000000000000000000000c5bba68089785e3bc6b4a300c87a88124af21a4f"]}]} from server ws://192.168.1.173:20001
    *************** start ********************
    {"addr":"0xc5bba68089785e3bc6b4a300c87a88124af21a4f","bnCode":"bn002","log":{"address":"0xc5bba68089785e3bc6b4a300c87a88124af21a4f","blockHash":"0xf17cd979ead87b0be0fe6059f434e200add632e95a4c9503585e8faff0cd6449","blockNumber":1500974,"blockNumberRaw":"0x16e72e","data":"0x000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000005766e3030310000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005626e303032000000000000000000000000000000000000000000000000000000","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0xa991d4b93f07260dd532613694474d84d9047d8040f481a277d4989f3b9e5754","0x000000000000000000000000000000000000000000000000000000000000006f","0x000000000000000000000000c5bba68089785e3bc6b4a300c87a88124af21a4f"],"transactionHash":"0x00ef5a7983240e84837817432bb263e61fd699911bb1bd21a353c23ca4bfd9c5","transactionIndex":0,"transactionIndexRaw":"0x0"},"no":111,"serialNum":"vn001","val":256}
    *************** end  ********************
    *************** start ********************
    {"addr":"0xc5bba68089785e3bc6b4a300c87a88124af21a4f","bnCode":"bn003","log":{"address":"0xc5bba68089785e3bc6b4a300c87a88124af21a4f","blockHash":"0x570e551e5fe04f2e7100fd9e78633192ced1cdeacce8b08635ec6d408eea3390","blockNumber":1502690,"blockNumberRaw":"0x16ede2","data":"0x000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000007766e3030333333000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005626e303033000000000000000000000000000000000000000000000000000000","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0xa991d4b93f07260dd532613694474d84d9047d8040f481a277d4989f3b9e5754","0x0000000000000000000000000000000000000000000000000000000001627f43","0x000000000000000000000000c5bba68089785e3bc6b4a300c87a88124af21a4f"],"transactionHash":"0xf18c096115c12cc9cc72a19d137c64e1975b3fda6eeb2589b4b2bfd9b3ff3229","transactionIndex":0,"transactionIndexRaw":"0x0"},"no":23232323,"serialNum":"vn00333","val":256}
    *************** end  ********************
    16:52:19.753 [pool-3-thread-1] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x3eca2f946ec6a393e7ecdbabae3136f8"],"id":2}
    NativeMonitor-------end  Tue Jun 29 16:52:19 CST 2021
    
    ---------finished---------
    ---------finished---------
    ---------finished---------
    16:52:19.797 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":2,"result":[]} from server ws://192.168.1.173:20001
    16:52:34.753 [pool-3-thread-1] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x3eca2f946ec6a393e7ecdbabae3136f8"],"id":3}
    16:52:34.789 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":3,"result":[]} from server ws://192.168.1.173:20001
    16:52:49.754 [pool-3-thread-2] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x3eca2f946ec6a393e7ecdbabae3136f8"],"id":4}
    16:52:49.796 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":4,"result":[]} from server ws://192.168.1.173:20001
    16:53:04.753 [pool-3-thread-1] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x3eca2f946ec6a393e7ecdbabae3136f8"],"id":5}
    16:53:04.780 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":5,"result":[]} from server ws://192.168.1.173:20001
    16:53:19.753 [pool-3-thread-3] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x3eca2f946ec6a393e7ecdbabae3136f8"],"id":6}
    16:53:19.778 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":6,"result":[{"logIndex":"0x0","removed":false,"blockNumber":"0x16ef56","blockHash":"0x905b3193772823b5b68022ac7f6d5ee00924ce7efe019546b5e0725d76396f30","transactionHash":"0xfd0e084e8363d5a114ed857a81bab922017035c7e73c536bc8ee4d1bb92291b9","transactionIndex":"0x0","address":"0xc5bba68089785e3bc6b4a300c87a88124af21a4f","data":"0x000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000a766e323032313036323900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a626e323032313036323900000000000000000000000000000000000000000000","topics":["0xa991d4b93f07260dd532613694474d84d9047d8040f481a277d4989f3b9e5754","0x00000000000000000000000000000000000000000000000000000000013463c5","0x000000000000000000000000c5bba68089785e3bc6b4a300c87a88124af21a4f"]}]} from server ws://192.168.1.173:20001
    *************** start ********************
    {"addr":"0xc5bba68089785e3bc6b4a300c87a88124af21a4f","bnCode":"bn20210629","log":{"address":"0xc5bba68089785e3bc6b4a300c87a88124af21a4f","blockHash":"0x905b3193772823b5b68022ac7f6d5ee00924ce7efe019546b5e0725d76396f30","blockNumber":1503062,"blockNumberRaw":"0x16ef56","data":"0x000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000a766e323032313036323900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a626e323032313036323900000000000000000000000000000000000000000000","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0xa991d4b93f07260dd532613694474d84d9047d8040f481a277d4989f3b9e5754","0x00000000000000000000000000000000000000000000000000000000013463c5","0x000000000000000000000000c5bba68089785e3bc6b4a300c87a88124af21a4f"],"transactionHash":"0xfd0e084e8363d5a114ed857a81bab922017035c7e73c536bc8ee4d1bb92291b9","transactionIndex":0,"transactionIndexRaw":"0x0"},"no":20210629,"serialNum":"vn20210629","val":256}
    *************** end  ********************
    
    Process finished with exit code -1
    
    
    

    2)自定义监听方法

    web3j调用时间默认15秒。(详见文件JsonRpc2_0Web3j.class中的DEFAULT_BLOCK_TIME)

    开启监听:

    //支持单个和多个事件,同时可以根据事件的indexed参数进行过滤
     private static void CustomMonitor(String address) throws Exception{
            WebSocketService ws = new WebSocketService("ws://192.168.1.173:20001",true);
            ws.connect();
            Web3j web3jWs = Web3j.build(ws);
            EthFilter filter = new EthFilter(DefaultBlockParameter.valueOf(new BigInteger("0")),
                    DefaultBlockParameterName.LATEST, address);
    
    //             [.addSingleTopic(...) | .addOptionalTopics(..., ...) | ...];
     // 监听指定的事件
    //        Event SETEVENT_EVENT = new Event("SetEvent",
    //                Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
    //        filter.addSingleTopic(EventEncoder.encode(SETEVENT_EVENT));
    // filter.addOptionalTopics("0x0000000000000000000000000000000000000000000000000000000000000001");
    
            web3jWs.ethLogFlowable(filter).subscribe(log -> {
                System.out.println(objectToJson(log));
            });
    
        }
    

    日志输出:

    17:39:59.459 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Opened WebSocket connection to ws://192.168.1.173:20001
    17:39:59.567 [main] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_newFilter","params":[{"topics":[],"fromBlock":"0x0","toBlock":"latest","address":["0x7c4063D66506051117d00B0c62b8d8343364CF68"]}],"id":0}
    17:39:59.579 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":0,"result":"0x51b0a57852e54f4b5704f3ba1cb41fc2"} from server ws://192.168.1.173:20001
    17:39:59.618 [main] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_getFilterLogs","params":["0x51b0a57852e54f4b5704f3ba1cb41fc2"],"id":1}
    17:39:59.764 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":1,"result":[{"logIndex":"0x0","removed":false,"blockNumber":"0x81","blockHash":"0xb74ad900df7cc856afa804947ed24fc3d62fc5fbbb1256428f838f468f33420d","transactionHash":"0x19bce97bda81b89a99e94d203db2fb56df04739936b399f846566f3f7e1df25d","transactionIndex":"0x0","address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","data":"0x","topics":["0x5c105cb8c4301efd6cb5e58d7edc6409c9875d38a2fa6cfc271f38e4a32364ad","0x0000000000000000000000000000000000000000000000000000000000000001","0x7880aec93413f117ef14bd4e6d130875ab2c7d7d55a064fac3c2f7bd51516380"]},{"logIndex":"0x0","removed":false,"blockNumber":"0x9f","blockHash":"0x018fc370134d3b335617f3bc7d66edf1b1f73837fed048b045aceb4ef271040d","transactionHash":"0x287819c2c50034a74c97e00d82bb850f594e4fc0b2b9478c0443078301ad3c18","transactionIndex":"0x0","address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","data":"0x0000000000000000000000000000000000000000000000000000000000000001","topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"]},{"logIndex":"0x0","removed":false,"blockNumber":"0xae","blockHash":"0x18039cfbbe197736e4222ee1cae5902b4c996ddaa170e7f1ac1f92424071a4f9","transactionHash":"0x87e1cc7862585424e9f1c22e149c668a4b717c19a41ff4ae4594978f319e5e9f","transactionIndex":"0x0","address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","data":"0x000000000000000000000000000000000000000000000000000000000000029a","topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"]},{"logIndex":"0x0","removed":false,"blockNumber":"0xea","blockHash":"0x581f3808baba34dcc9eca25aa2fdb8cac765d555ec8baf61dd7f68042f9c353a","transactionHash":"0x515a8d12a33356608310766821e10ec7ed8c5dd1e7c5fb752dfae644c6fc7e1e","transactionIndex":"0x0","address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","data":"0x000000000000000000000000000000000000000000000000000000000000029a","topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"]},{"logIndex":"0x0","removed":false,"blockNumber":"0xfd","blockHash":"0x5a4a038e88527d38351fc5c00d5a2c389827c39605b970fb53111ce878ba6fc5","transactionHash":"0x8c78297c6059cc58c4934b250038c929947bef7b355e76e2f53b529930460eea","transactionIndex":"0x0","address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","data":"0x000000000000000000000000000000000000000000000000000000000000029a","topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"]},{"logIndex":"0x0","removed":false,"blockNumber":"0x118","blockHash":"0xf938f07089cb38f8544ceacc372a3bf53887a60592dab2d722a36f622563b626","transactionHash":"0x9477c5787e3a54a7054b40c409faf9ccfc51182a575c3545009405e779e271c3","transactionIndex":"0x0","address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","data":"0x000000000000000000000000000000000000000000000000000000000000029a","topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"]},{"logIndex":"0x0","removed":false,"blockNumber":"0x12d","blockHash":"0x22d5c028ffe61089626d02dcd774c0a615dc3df8fca7932dc92b032efa8cb7ea","transactionHash":"0x3cc485624239b5d29aac34c8cc207f1e58513d5e29e99d6e48b49ce9e109fb22","transactionIndex":"0x0","address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","data":"0x","topics":["0x5c105cb8c4301efd6cb5e58d7edc6409c9875d38a2fa6cfc271f38e4a32364ad","0x0000000000000000000000000000000000000000000000000000000000000001","0xc888c9ce9e098d5864d3ded6ebcc140a12142263bace3a23a36f9905f12bd64a"]},{"logIndex":"0x0","removed":false,"blockNumber":"0x145","blockHash":"0x7aea794ca4460338d1161887375516157e65e483eb3d7cf35750f1d3deb1a8bf","transactionHash":"0x6fc1a080f22495224514bfbae0d114beb92a13138b74092f248372b1582c09eb","transactionIndex":"0x0","address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","data":"0x000000000000000000000000000000000000000000000000000000000000029a","topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"]},{"logIndex":"0x0","removed":false,"blockNumber":"0x15f","blockHash":"0xe0f78ec244d65b1288c378cc63da2107bcd1d384d8e3b0d977a1852fe64c3deb","transactionHash":"0x76a7c50c0e12b6076122ff062a2c6ccca12f07ec59b054d670247e4765e47db4","transactionIndex":"0x0","address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","data":"0x000000000000000000000000000000000000000000000000000000000000029a","topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"]},{"logIndex":"0x0","removed":false,"blockNumber":"0x1b1","blockHash":"0xdb23c1eab90a35e60ef585aef892288b92a42477c36dc6e83d0457a88e0f1077","transactionHash":"0x6206af1b743c10dfd98ca04f9bad3c8a57aac2db822af15842259396fe2da2b1","transactionIndex":"0x0","address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","data":"0x","topics":["0x5c105cb8c4301efd6cb5e58d7edc6409c9875d38a2fa6cfc271f38e4a32364ad","0x0000000000000000000000000000000000000000000000000000000000000003","0x8d2c2158f9ead7f5454262243267791619ed032b2c29b23d8c77fec5a7429b00"]},{"logIndex":"0x0","removed":false,"blockNumber":"0x1c3","blockHash":"0x7323e1e813ab26946f05e02c4645615003320d73c5749aa21108b4781e2d04a8","transactionHash":"0x1bc021ac986a1034f7ab1c2aa9f7831e624af040376e57f1346e41742f9a0adc","transactionIndex":"0x0","address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","data":"0x","topics":["0x5c105cb8c4301efd6cb5e58d7edc6409c9875d38a2fa6cfc271f38e4a32364ad","0x0000000000000000000000000000000000000000000000000000000000000003","0x8d2c2158f9ead7f5454262243267791619ed032b2c29b23d8c77fec5a7429b00"]},{"logIndex":"0x0","removed":false,"blockNumber":"0x1e9","blockHash":"0xd8abae651a5534bec9a862d8eebc3d389b45e1afd43dc0aeb522c2b9e0355127","transactionHash":"0x2d21e9a6610b4ab089caf63f3958aa604473aab23a704e665daeeda02a103b4a","transactionIndex":"0x0","address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","data":"0x000000000000000000000000000000000000000000000000000000000000029a","topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"]},{"logIndex":"0x0","removed":false,"blockNumber":"0x2fa","blockHash":"0x39266379a8b4e25c1940f381e404e57441c6fb3485b32d5ffff7a02495bb84b9","transactionHash":"0x391a1022549c2275d7b52282cc3f8d65550a6d42b8f36f8e3d9493c4dc495e6a","transactionIndex":"0x0","address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","data":"0x000000000000000000000000000000000000000000000000000000000000029a","topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"]},{"logIndex":"0x0","removed":false,"blockNumber":"0x34f","blockHash":"0xd2306db917fd100b1832e93d71888507e89bd1e4fb2750d18d3ab85a3bf5c40b","transactionHash":"0xa0719ddd5821ba75f518f56456e6c752989103bf303f763362f23c2b88174203","transactionIndex":"0x0","address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","data":"0x000000000000000000000000000000000000000000000000000000000000029a","topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"]},{"logIndex":"0x0","removed":false,"blockNumber":"0x3bd","blockHash":"0x9f97e911f2caac5f03a43e240b178387de96c932f64048a74db22a6a74959198","transactionHash":"0xf2e926320aaa8618509e047c295d4a74439bee3efa27c5b31b830679d8d31c59","transactionIndex":"0x0","address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","data":"0x000000000000000000000000000000000000000000000000000000000000029a","topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"]},{"logIndex":"0x0","removed":false,"blockNumber":"0x3e1","blockHash":"0xaf226567301b8305823486c06b7333ca135a7826262fdffb4ef02c648ee6c495","transactionHash":"0x884a6cfc6b36ae2995414d2961928a32a3c57d5fdfa20d9fbcdeab4e72678bae","transactionIndex":"0x0","address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","data":"0x000000000000000000000000000000000000000000000000000000000000029a","topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"]},{"logIndex":"0x0","removed":false,"blockNumber":"0x40d","blockHash":"0xad6c6d003423e5da0d03f07f3848f9b8ccceeb194378ed780f49a92a6758dcbb","transactionHash":"0xbbd544b1ec7c888f9f0bfbdb90503d85854dc2f1511861e3bd09c6655b04fce6","transactionIndex":"0x0","address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","data":"0x000000000000000000000000000000000000000000000000000000000000029a","topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"]},{"logIndex":"0x0","removed":false,"blockNumber":"0x7c2","blockHash":"0x755718403ee960856aadcd7d1926d430db3a8a6fc3cbe396cd9baf9abeba1089","transactionHash":"0x28f2e6e5f66de3fa731bb313d879bf835b5f2510a1f04f97512c454caf194704","transactionIndex":"0x0","address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","data":"0x000000000000000000000000000000000000000000000000000000000000029a","topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"]}]} from server ws://192.168.1.173:20001
    {"address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","blockHash":"0xb74ad900df7cc856afa804947ed24fc3d62fc5fbbb1256428f838f468f33420d","blockNumber":129,"blockNumberRaw":"0x81","data":"0x","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0x5c105cb8c4301efd6cb5e58d7edc6409c9875d38a2fa6cfc271f38e4a32364ad","0x0000000000000000000000000000000000000000000000000000000000000001","0x7880aec93413f117ef14bd4e6d130875ab2c7d7d55a064fac3c2f7bd51516380"],"transactionHash":"0x19bce97bda81b89a99e94d203db2fb56df04739936b399f846566f3f7e1df25d","transactionIndex":0,"transactionIndexRaw":"0x0"}
    {"address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","blockHash":"0x018fc370134d3b335617f3bc7d66edf1b1f73837fed048b045aceb4ef271040d","blockNumber":159,"blockNumberRaw":"0x9f","data":"0x0000000000000000000000000000000000000000000000000000000000000001","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"],"transactionHash":"0x287819c2c50034a74c97e00d82bb850f594e4fc0b2b9478c0443078301ad3c18","transactionIndex":0,"transactionIndexRaw":"0x0"}
    {"address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","blockHash":"0x18039cfbbe197736e4222ee1cae5902b4c996ddaa170e7f1ac1f92424071a4f9","blockNumber":174,"blockNumberRaw":"0xae","data":"0x000000000000000000000000000000000000000000000000000000000000029a","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"],"transactionHash":"0x87e1cc7862585424e9f1c22e149c668a4b717c19a41ff4ae4594978f319e5e9f","transactionIndex":0,"transactionIndexRaw":"0x0"}
    {"address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","blockHash":"0x581f3808baba34dcc9eca25aa2fdb8cac765d555ec8baf61dd7f68042f9c353a","blockNumber":234,"blockNumberRaw":"0xea","data":"0x000000000000000000000000000000000000000000000000000000000000029a","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"],"transactionHash":"0x515a8d12a33356608310766821e10ec7ed8c5dd1e7c5fb752dfae644c6fc7e1e","transactionIndex":0,"transactionIndexRaw":"0x0"}
    {"address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","blockHash":"0x5a4a038e88527d38351fc5c00d5a2c389827c39605b970fb53111ce878ba6fc5","blockNumber":253,"blockNumberRaw":"0xfd","data":"0x000000000000000000000000000000000000000000000000000000000000029a","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"],"transactionHash":"0x8c78297c6059cc58c4934b250038c929947bef7b355e76e2f53b529930460eea","transactionIndex":0,"transactionIndexRaw":"0x0"}
    {"address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","blockHash":"0xf938f07089cb38f8544ceacc372a3bf53887a60592dab2d722a36f622563b626","blockNumber":280,"blockNumberRaw":"0x118","data":"0x000000000000000000000000000000000000000000000000000000000000029a","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"],"transactionHash":"0x9477c5787e3a54a7054b40c409faf9ccfc51182a575c3545009405e779e271c3","transactionIndex":0,"transactionIndexRaw":"0x0"}
    {"address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","blockHash":"0x22d5c028ffe61089626d02dcd774c0a615dc3df8fca7932dc92b032efa8cb7ea","blockNumber":301,"blockNumberRaw":"0x12d","data":"0x","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0x5c105cb8c4301efd6cb5e58d7edc6409c9875d38a2fa6cfc271f38e4a32364ad","0x0000000000000000000000000000000000000000000000000000000000000001","0xc888c9ce9e098d5864d3ded6ebcc140a12142263bace3a23a36f9905f12bd64a"],"transactionHash":"0x3cc485624239b5d29aac34c8cc207f1e58513d5e29e99d6e48b49ce9e109fb22","transactionIndex":0,"transactionIndexRaw":"0x0"}
    {"address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","blockHash":"0x7aea794ca4460338d1161887375516157e65e483eb3d7cf35750f1d3deb1a8bf","blockNumber":325,"blockNumberRaw":"0x145","data":"0x000000000000000000000000000000000000000000000000000000000000029a","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"],"transactionHash":"0x6fc1a080f22495224514bfbae0d114beb92a13138b74092f248372b1582c09eb","transactionIndex":0,"transactionIndexRaw":"0x0"}
    {"address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","blockHash":"0xe0f78ec244d65b1288c378cc63da2107bcd1d384d8e3b0d977a1852fe64c3deb","blockNumber":351,"blockNumberRaw":"0x15f","data":"0x000000000000000000000000000000000000000000000000000000000000029a","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"],"transactionHash":"0x76a7c50c0e12b6076122ff062a2c6ccca12f07ec59b054d670247e4765e47db4","transactionIndex":0,"transactionIndexRaw":"0x0"}
    {"address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","blockHash":"0xdb23c1eab90a35e60ef585aef892288b92a42477c36dc6e83d0457a88e0f1077","blockNumber":433,"blockNumberRaw":"0x1b1","data":"0x","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0x5c105cb8c4301efd6cb5e58d7edc6409c9875d38a2fa6cfc271f38e4a32364ad","0x0000000000000000000000000000000000000000000000000000000000000003","0x8d2c2158f9ead7f5454262243267791619ed032b2c29b23d8c77fec5a7429b00"],"transactionHash":"0x6206af1b743c10dfd98ca04f9bad3c8a57aac2db822af15842259396fe2da2b1","transactionIndex":0,"transactionIndexRaw":"0x0"}
    {"address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","blockHash":"0x7323e1e813ab26946f05e02c4645615003320d73c5749aa21108b4781e2d04a8","blockNumber":451,"blockNumberRaw":"0x1c3","data":"0x","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0x5c105cb8c4301efd6cb5e58d7edc6409c9875d38a2fa6cfc271f38e4a32364ad","0x0000000000000000000000000000000000000000000000000000000000000003","0x8d2c2158f9ead7f5454262243267791619ed032b2c29b23d8c77fec5a7429b00"],"transactionHash":"0x1bc021ac986a1034f7ab1c2aa9f7831e624af040376e57f1346e41742f9a0adc","transactionIndex":0,"transactionIndexRaw":"0x0"}
    {"address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","blockHash":"0xd8abae651a5534bec9a862d8eebc3d389b45e1afd43dc0aeb522c2b9e0355127","blockNumber":489,"blockNumberRaw":"0x1e9","data":"0x000000000000000000000000000000000000000000000000000000000000029a","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"],"transactionHash":"0x2d21e9a6610b4ab089caf63f3958aa604473aab23a704e665daeeda02a103b4a","transactionIndex":0,"transactionIndexRaw":"0x0"}
    {"address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","blockHash":"0x39266379a8b4e25c1940f381e404e57441c6fb3485b32d5ffff7a02495bb84b9","blockNumber":762,"blockNumberRaw":"0x2fa","data":"0x000000000000000000000000000000000000000000000000000000000000029a","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"],"transactionHash":"0x391a1022549c2275d7b52282cc3f8d65550a6d42b8f36f8e3d9493c4dc495e6a","transactionIndex":0,"transactionIndexRaw":"0x0"}
    {"address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","blockHash":"0xd2306db917fd100b1832e93d71888507e89bd1e4fb2750d18d3ab85a3bf5c40b","blockNumber":847,"blockNumberRaw":"0x34f","data":"0x000000000000000000000000000000000000000000000000000000000000029a","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"],"transactionHash":"0xa0719ddd5821ba75f518f56456e6c752989103bf303f763362f23c2b88174203","transactionIndex":0,"transactionIndexRaw":"0x0"}
    {"address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","blockHash":"0x9f97e911f2caac5f03a43e240b178387de96c932f64048a74db22a6a74959198","blockNumber":957,"blockNumberRaw":"0x3bd","data":"0x000000000000000000000000000000000000000000000000000000000000029a","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"],"transactionHash":"0xf2e926320aaa8618509e047c295d4a74439bee3efa27c5b31b830679d8d31c59","transactionIndex":0,"transactionIndexRaw":"0x0"}
    {"address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","blockHash":"0xaf226567301b8305823486c06b7333ca135a7826262fdffb4ef02c648ee6c495","blockNumber":993,"blockNumberRaw":"0x3e1","data":"0x000000000000000000000000000000000000000000000000000000000000029a","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"],"transactionHash":"0x884a6cfc6b36ae2995414d2961928a32a3c57d5fdfa20d9fbcdeab4e72678bae","transactionIndex":0,"transactionIndexRaw":"0x0"}
    {"address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","blockHash":"0xad6c6d003423e5da0d03f07f3848f9b8ccceeb194378ed780f49a92a6758dcbb","blockNumber":1037,"blockNumberRaw":"0x40d","data":"0x000000000000000000000000000000000000000000000000000000000000029a","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"],"transactionHash":"0xbbd544b1ec7c888f9f0bfbdb90503d85854dc2f1511861e3bd09c6655b04fce6","transactionIndex":0,"transactionIndexRaw":"0x0"}
    {"address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","blockHash":"0x755718403ee960856aadcd7d1926d430db3a8a6fc3cbe396cd9baf9abeba1089","blockNumber":1986,"blockNumberRaw":"0x7c2","data":"0x000000000000000000000000000000000000000000000000000000000000029a","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"],"transactionHash":"0x28f2e6e5f66de3fa731bb313d879bf835b5f2510a1f04f97512c454caf194704","transactionIndex":0,"transactionIndexRaw":"0x0"}
    17:39:59.844 [pool-3-thread-1] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x51b0a57852e54f4b5704f3ba1cb41fc2"],"id":2}
    ---------finished---------
    ---------finished---------
    ---------finished---------
    17:39:59.858 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":2,"result":[]} from server ws://192.168.1.173:20001
    17:40:14.846 [pool-3-thread-1] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x51b0a57852e54f4b5704f3ba1cb41fc2"],"id":3}
    17:40:14.871 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":3,"result":[]} from server ws://192.168.1.173:20001
    17:40:29.845 [pool-3-thread-2] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x51b0a57852e54f4b5704f3ba1cb41fc2"],"id":4}
    17:40:29.848 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":4,"result":[]} from server ws://192.168.1.173:20001
    17:40:44.846 [pool-3-thread-1] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x51b0a57852e54f4b5704f3ba1cb41fc2"],"id":5}
    17:40:44.849 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":5,"result":[]} from server ws://192.168.1.173:20001
    17:40:59.846 [pool-3-thread-3] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x51b0a57852e54f4b5704f3ba1cb41fc2"],"id":6}
    17:40:59.849 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":6,"result":[]} from server ws://192.168.1.173:20001
    17:41:14.845 [pool-3-thread-2] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x51b0a57852e54f4b5704f3ba1cb41fc2"],"id":7}
    17:41:14.853 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":7,"result":[]} from server ws://192.168.1.173:20001
    17:41:29.845 [pool-3-thread-4] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x51b0a57852e54f4b5704f3ba1cb41fc2"],"id":8}
    17:41:29.847 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":8,"result":[]} from server ws://192.168.1.173:20001
    17:41:44.845 [pool-3-thread-1] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x51b0a57852e54f4b5704f3ba1cb41fc2"],"id":9}
    17:41:44.847 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":9,"result":[]} from server ws://192.168.1.173:20001
    17:41:59.844 [pool-3-thread-1] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x51b0a57852e54f4b5704f3ba1cb41fc2"],"id":10}
    17:41:59.886 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":10,"result":[]} from server ws://192.168.1.173:20001
    17:42:14.845 [pool-3-thread-1] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x51b0a57852e54f4b5704f3ba1cb41fc2"],"id":11}
    17:42:14.852 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":11,"result":[]} from server ws://192.168.1.173:20001
    17:42:29.846 [pool-3-thread-1] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x51b0a57852e54f4b5704f3ba1cb41fc2"],"id":12}
    17:42:29.849 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":12,"result":[]} from server ws://192.168.1.173:20001
    17:42:44.845 [pool-3-thread-1] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x51b0a57852e54f4b5704f3ba1cb41fc2"],"id":13}
    17:42:44.849 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":13,"result":[{"logIndex":"0x0","removed":false,"blockNumber":"0xa22","blockHash":"0x8a1c0847d26c1e804d0d528d4fa4455110e8f25f85dabe3650aa37ca370292e6","transactionHash":"0x882017cb00b173e7c1bf38b678f2f407de550dc41907f0a91e1bc756745c0112","transactionIndex":"0x0","address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","data":"0x0000000000000000000000000000000000000000000000000000000000000001","topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"]}]} from server ws://192.168.1.173:20001
    {"address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","blockHash":"0x8a1c0847d26c1e804d0d528d4fa4455110e8f25f85dabe3650aa37ca370292e6","blockNumber":2594,"blockNumberRaw":"0xa22","data":"0x0000000000000000000000000000000000000000000000000000000000000001","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0x0de2d86113046b9e8bb6b785e96a6228f6803952bf53a40b68a36dce316218c1"],"transactionHash":"0x882017cb00b173e7c1bf38b678f2f407de550dc41907f0a91e1bc756745c0112","transactionIndex":0,"transactionIndexRaw":"0x0"}
    17:42:59.846 [pool-3-thread-1] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x51b0a57852e54f4b5704f3ba1cb41fc2"],"id":14}
    17:42:59.849 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":14,"result":[{"logIndex":"0x0","removed":false,"blockNumber":"0xa28","blockHash":"0xd24a3546abd1ade98454f55f26885396140510d949e404153d2407d0561ffe4d","transactionHash":"0x2cb7d64c5af472d9a177383b86d58377bbac3f57cd352d8e7ddf31ac444ebc05","transactionIndex":"0x0","address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","data":"0x","topics":["0x5c105cb8c4301efd6cb5e58d7edc6409c9875d38a2fa6cfc271f38e4a32364ad","0x0000000000000000000000000000000000000000000000000000000000000003","0x8d2c2158f9ead7f5454262243267791619ed032b2c29b23d8c77fec5a7429b00"]}]} from server ws://192.168.1.173:20001
    {"address":"0x7c4063d66506051117d00b0c62b8d8343364cf68","blockHash":"0xd24a3546abd1ade98454f55f26885396140510d949e404153d2407d0561ffe4d","blockNumber":2600,"blockNumberRaw":"0xa28","data":"0x","logIndex":0,"logIndexRaw":"0x0","removed":false,"topics":["0x5c105cb8c4301efd6cb5e58d7edc6409c9875d38a2fa6cfc271f38e4a32364ad","0x0000000000000000000000000000000000000000000000000000000000000003","0x8d2c2158f9ead7f5454262243267791619ed032b2c29b23d8c77fec5a7429b00"],"transactionHash":"0x2cb7d64c5af472d9a177383b86d58377bbac3f57cd352d8e7ddf31ac444ebc05","transactionIndex":0,"transactionIndexRaw":"0x0"}
    17:43:14.845 [pool-3-thread-1] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x51b0a57852e54f4b5704f3ba1cb41fc2"],"id":15}
    17:43:14.851 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":15,"result":[]} from server ws://192.168.1.173:20001
    17:43:29.845 [pool-3-thread-1] DEBUG org.web3j.protocol.websocket.WebSocketService - Sending request: {"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x51b0a57852e54f4b5704f3ba1cb41fc2"],"id":16}
    17:43:29.847 [WebSocketConnectReadThread-12] DEBUG org.web3j.protocol.websocket.WebSocketClient - Received message {"jsonrpc":"2.0","id":16,"result":[]} from server ws://192.168.1.173:20001
    

    【扩展】:如果合约事件方法包含indexed 参数,那么调用时可以用filter.addOptionalTopics("xxx")方法进行指定数据过滤。但需要注意索引参数的编码

    一般索引参数示例:

    类型 topic值 参数值
    uint 0x0000000000000000000000000000000000000000000000000000000000000001 1
    bool 0x0000000000000000000000000000000000000000000000000000000000000001 true
    address 0x000000000000000000000000e1518d16f98b8f9502a19c41d8a9fa16e36d27ef 0xE1518D16F98b8f9502a19c41d8A9fA16E36d27Ef

    其他用法示例:
    通过http方式监听besu上智能合约的事件
    使用web3.js监听besu上的合约事件

    相关文章

      网友评论

          本文标题:[快速入门]使用web3j监听besu上智能合约的事件

          本文链接:https://www.haomeiwen.com/subject/tmespltx.html