two hex digits per byte
one byte = 8 bit 4 bit => hex 0000 2*2*2*2 = 16 so one byte = 4bit + 4bit = hex + hex
one byte = 8 bit 4 bit => hex 0000 2*2*2*2 = 16 so one byte = 4bit + 4bit = hex + hex
1、node & npm apk add nodejs npm nano curl 2、mkdir t put files to t or nano test.js 2.1、nano test.js var supertest = require('supertest'); describe('GET http://go-ethe:8545/', function () { let request = supertest('http://go-ethe:8545') it('respond with json 1', function (done) { request.post('/') .send({"jsonrpc":"2.0","method":"miner_start","params":[1],"id":1}) .expect('Content-Type', /json/) .expect(200, done); }); let gethcmd = {"jsonrpc":"2.0","method":"eth_mining","params":[],"id":1} it('respond with json mining actively start ', function (done) { request.post('/') .send(gethcmd) .expect('Content-Type', /json/) .expect(200) .expect((res)=>{if (!(true == res.body.result) ) throw new Error("mining actively start failed!"); }) .end(done); }); it('respond with json 2', function (done) { request.post('/') .send({"jsonrpc":"2.0","method":"miner_stop","params":[],"id":1}) .expect('Content-Type', /json/) .expect(200, done); }); let gethcmd2 = {"jsonrpc":"2.0","method":"eth_mining","params":[],"id":1} it('respond with json mining actively stop ', function (done) { request.post('/') .send(gethcmd2) .expect('Content-Type', /json/) .expect(200) .expect((res)=>{if (!(false == res.body.result) ) throw new Error("mining actively stop failed!"); }) .end(done); }); }); 3、npm init -y && npm i -S supertest mocha ...
………………………………………. ………………………………………. ………………………………………. go-ethereum https://github.com/ethereum/go-ethereum/wiki/Management-APIs#miner geth –rpcapi “db,personal,eth,net,web3” --rpc –rpcaddr “0.0.0.0” –rpccorsdomain “*” –rpcvhosts=* So you want miner, need put “db,personal,miner,eth,net,web3” curl -X POST -H “Content-Type: application/json” –data ‘{“jsonrpc”:“2.0”,“method”:“miner_stop”,“params”:[],“id”:1}’ go-ethe:8545 {“jsonrpc”:“2.0”,“id”:1,“result”:null} Fxxx Document……………………………………….. Import see this url document web3 https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_mining https://github.com/ethereum/web3.js/
filter json { source => “message” } This mean is Try to use json format transfer log, then put some data to message filed. So some filed just be setting, and some data set to message. .Use this to check mach and log https://grokconstructor.appspot.com/do/match https://blog.johnwu.cc/article/elk-logstash-grok-filter.html https://github.com/logstash-plugins/logstash-patterns-core/blob/master/patterns/grok-patterns This is geth log for example A: INFO [11-14|09:58:17.730] Generating DAG in progress epoch=1 percentage=99 elapsed=4m8.643s INFO [11-15|01:41:33.455] Generating DAG in progress epoch=1 percentage=9 elapsed=27.614s B: INFO [11-15|01:19:44.590] Loaded most recent local fast block number=0 hash=656134…58fded td=1 age=49y7mo1h, Loaded most recent local fast block ...
https://gist.github.com/javahippie/efee5417c69aaad3baf297dd2cd71fc6 version: '3.3' services: go-ethereum: build: context: go-ethe/ ports: - "8545:8545" - "30303:30303" networks: - elk networks: elk: driver: bridge FROM ubuntu:xenial RUN apt-get update \ && apt-get install -y wget \ && rm -rf /var/lib/apt/lists/* WORKDIR "/opt" ARG BINARY="geth-linux-amd64-1.8.17-8bbe7207.tar.gz" RUN wget "https://gethstore.blob.core.windows.net/builds/$BINARY" RUN tar -xzvf $BINARY --strip 1 RUN rm $BINARY ADD ./genesis.json ./genesis.json RUN ./geth init genesis.json CMD nohup ./geth --dev --rpc --rpcaddr "0.0.0.0" --rpccorsdomain "*" --mine #geth --syncmode "light" --cache=2048 EXPOSE 8545 EXPOSE 30303