Ethereum Go-ethereum pending transactions - ethereum

GETH VERSION
Geth
Version: 1.8.10-stable
Git Commit: eae63c511ceafab14b92e274c1b18bf1700e2d3d
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.10.1
Operating System: linux
GOPATH=/home/myuser/go
GOROOT=/usr/lib/go-1.10
Node running under:
geth --testnet --rpc --rpcapi "eth,net,web3,personal,parity" --syncmode="light"
Problem 1:
When I tried to run out Node with --syncmode="full" or --syncmode="fast", CurrentBlock is always behind then HighestBlock, Approximately 64 blocks. So Node is running under --syncmode="light".
My Goal is to find all pending transactions on my accounts.
Steps to reproduce
eth.getBlock('pending').transactions
["0x2e6d5273fa29e892313166b8de458793fb0728f13a9077ab2295c1dc2371529c", "0xcc2e659ea3f8b6f6c1b812d559198427b0b2adf0316213c903e08c277384a1c6", "0x6a194f095f3b9ee65fa2eb9765617edda8ea99c2f8ad3e09d03d61735acd3a34", "0x604f53727f6ad056d82f57ce07b4e28cfae16c098dca909bffeaa51fb3584843"]
Curl eth_getTransactionByBlockHashAndIndex
curl -X POST -H "Content-Type: application/json" --data'{"id":8,"jsonrpc":"2.0","method":"eth_getTransactionByBlockHashAndIndex","params":["0xc0a9a6075081add64ac2f69b52f40de7b3d726281fc00a9ab23f90c892ae3346", "0x0"]}' http://localhost:8545
It returns:
{ "jsonrpc":"2.0",
"id":8,
"result":
{"blockHash":"0xc0a9a6075081add64ac2f69b52f40de7b3d726281fc00a9ab23f90c892ae3346",
"blockNumber":"0x344c3b",
"from":"0x40e0b46c7a461c02ab6e70d5536e23a9d727f9f8",
"gas":"0x927c0",
"gasPrice":"0x218711a00",
"hash":"0x2e6d5273fa29e892313166b8de458793fb0728f13a9077ab2295c1dc2371529c",
"input":"0xfe6362ae000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000c3332353136303935323130370000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c3037363832333538353537300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002e516d54755334664370664531563444784c547079507074596874664845446f5734774c745159675837375a376378000000000000000000000000000000000000",
"nonce":"0x161",
"to":"0xabe486e0ad5319d8047d5ef83e8c1cb1dce0d8c5",
"transactionIndex":"0x0","value":"0x0","v":"0x2a",
"r":"0xd1c106a22480e173784267c4da3db1707e2efd7598d9c55c6e060842d8e42390",
"s":"0x15786e1f7f4bd53e402d4911b0334b38973609415868687f171501b64770331e"}}
it works perfect, Now lets ask for this transaction using getTransactionByHash
Now lets check eth_getTransactionByHash:
curl -X POST -H "Content-Type: application/json" --data '{"id":8,"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0x2e6d5273fa29e892313166b8de458793fb0728f13a9077ab2295c1dc2371529c"]}' http://localhost:8545
It returns
{"jsonrpc":"2.0","id":8,"result":null}
I have to get the same result, But i got null!
Any idea? Or any suggestion of another way how to get incoming pending transactions?

You can always check for transaction details using getTransactionReceipt.
Could you please try this and get back if you do get null sometimes?
Also regarding your question on getting pending transactions, mind you these pending transactions are not for your account or you node (if you haven't posted any). Since you are connected to the public version of Ethereum, you are getting these transactions which are some later point in time picked up by some miner and getting added to the ledger. For the answer, you might write a backend which saves the pending transaction data by polling it continuously and hence serve your purpose. I hope I have answered your question.

Related

How to read data from socket in Lua until no more data is available?

I can't manage to read the data from a luasocket. If i read more than the available data, the function call keeps blocked waiting until the client decides to close.
https://github.com/StringManolo/LuaServer/blob/main/tmpServer.lua#L216
line, errorStr = clientObj:receive("*a")
I'm using this command to test:
$ curl -X POST -d "a=b" http://localhost:1337 -v
Got same problem using Chrome to send a request to the Lua server.
I tryied to read byte to byte, line to line, all, etc.

Getting a 3-Legged Token with Authorization Code Grant

I am currently trying to complete this step by step tutorial which is based on Getting a 3-Legged Token with Authorization Code Grant
here is my cURL code:
curl -v "https://developer.api.autodesk.com/authentication/v1/gettoken"
-X POST
-H "Content-Type:application/x-www-form-urlencoded"
-d "client_id=****&
client_secret=****&
grant_type=authorization_code&
code=1O4F-z9gXRtGlBymcGoD3bV3Ws2cqqjeN78PpgGn&
redirect_uri=http://localhost:3000/api/forge/callback/oauth"
here is the error I am stuck with:
{"developerMessage":"The authorization code/refresh token is expired or
invalid/redirect_uri must have the same value as in the authorization
request.","userMessage":"","errorCode":"AUTH-004","more
info":"http://developer.api.autodesk.com/documentation/v1/errors/AUTH-004"}*
Connection #0 to host developer.api.autodesk.com left intact
Note:
I have double checked that the URI is the same as my callback URL on the forge application.
The spacing on the cURL code is simply for visual reasons, this is not how it is ran within my command line.
I think what's going on is that the code you get after the user logs in has an extremely short expiration time. After all, the POST /authentication/v1/gettoken endpoint is meant to be called immediately after the user logs in.
Btw. I went through the same steps, and since it took me a while to create a Postman request with the code I received, I ended up with the same error as you. Then, when I requested another code and immediately re-sent the Postman request, it succeeded.

Error in uploading data to HDFS Fiware Cosmos global Instance

I am trying to launch a cosmos instance following this document:http://fiware-cosmos.readthedocs.io/en/latest/quick_start_guide_new/index.html.
The first step is executed successfully and i got a access token using which i create a cosmos account acc. to 2nd step and receive this response:
{"organizations": [], "displayName": "varun143", "roles": [], "app_id": "45bed173b2f8482aa15b22556c057112", "isGravatarEnabled": false, "email": "manchandavishal143#gmail.com", "id": "varun143"}.
Now i follow the 3rd step i.e creating a new dir using this command:curl -X PUT "http://storage.cosmos.lab.fiware.org:14000/webhdfs/v1/user/varun143/testdir?op=MKDIRS&user.name=varun143" -H "X-Auth-token: my acess token" | python -m json.tool and get this response:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (52) Empty reply from server
No JSON object could be decoded.
then i create a testdata.txt file in my local & write some data in it as per document and run this command:curl -v -X PUT -T testdata.txt "http://storage.cosmos.lab.fiware.org:14000/webhdfs/v1/user/varun143/testdir/testdata.txt?op=CREATE&user.name=varun143" -H "Content-Type: application/octet-stream" -H "X-Auth-token: my acess token" and get this response attach in this image url:https://imgur.com/uiWU5qr which is not as per document.Now where am i wrong & how to resolve this.Also how can i access cli or GUI of this instance.Thanks in advance.
You are using the old documentation of cosmos, the current documentation is available here https://github.com/ging/fiware-cosmos/blob/master/doc/manuals/quick_start_guide_new.md. Moreover, you need to send an email with the information that you got in step 2 for that the platform administrator creates your account, you have to consider that currently, we are in summer holidays so the creation of your account maybe suffers some delays. Also is important that you be informed that the cloud platform is only for testing purposes and use only batching processing. As a personal advice, if you don't have a real big data problem, don't try to solve it using big data technologies because you are only adding complexity to solve that problem.

Updating value rpccorsdomain?

How can I update rpccorsdomain value with my private node already mining?
Note
I have already setup it before to point to a url --rpccorsdomain "http://mywebsite.com" and need to update it to different value
You can restart the RPC API using either the console or through a curl command.
In the console, you can issue an admin.stopRPC() and then restart it passing in the new cors value with admin.startRPC(host, port, newCorsList, apis).
If you prefer using curl:
curl -X POST --data '{"method": "admin_stopWS"}' nodeHostName:nodePortNumber
curl -X POST --data '{"method": "admin_startWS", "params": [host, port, cors, apis]}' nodeHostName:nodePortNumber
The full list of available management APIs can be found here.
Alternatively, you can just stop the node and restart it passing in the new cors list via command line options.

How to check whether jenkins is fully up and running using webservice ?

I want to know , how to check whether jenkins is fully up and running using webservice ?
i want to use jenkins webservice to check this. Is there any way to do this ?
Thanks.
Probably the easiest way would be to perform a simple HTTP get on the Jenkins server root URL. You get a successful status (200) if Jenkins is fully up. If it is not you'll get 503 - Service Temporarily Unavailable (or possibly other errors depending on specific situation).
From the command line you can use a tool such as wget to perform that request.
Could also use curl:
while [[ $(curl -s -w "%{http_code}" http://server -o /dev/null) != "200" ]]; do
sleep 5
done
In addition to previous answers: If security is enabled, you will get HTTP 403 from the root URL. To get HTTP 200, you can check http://server/login.