Transactions dis- and reappear from txpool_inspect at random - ethereum

I'm implementing an application inspecting the ethereum mempool at regular intervals via the geth call txpool_inspect. There I have observed some strange behaviour, for some wallet addresses the transactions seem to go missing at random and then reappear on later queries.
I'm not sure how to create a long-term reproducible example for this, but, as of the time of writing this, the call
curl $MY_ETHEREUM_RPC_URL \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"txpool_inspect","params":[],"id":1,"jsonrpc":"2.0"}'
will produce a result containing the address + the transactions by nonce for the address 0x8a6bd90abb79ba36266c881561d5d0b1dc528f80 on some calls and on other calls not contain it. Even though the transactions in question have been in the mempool for 3+ days.
Can this behaviour be explained somehow? Is txpool_inspect not expected the return the entire contents of the mempool at all times?

Related

How do I save a historical (past) dataset in Foundry

I want to save a version of my dataset called (order_clean). But not the current version. The version I want to save is from the past. I understand this is a historical transaction that still exists within my retention policy window. How would I be able to do this?
This can be done via an API call and hitting a specific endpoint.
This answer assumes a working knowledge around authorization tokens and curl requests:
Obtain the desired dataset’s RID (Example in screenshot below), as well as the transaction ID of the transaction corresponding to the version of the dataset you want.
[
Create a new branch in your specific dataset by running a curl request populated as follows:
curl -X POST -H "Content-type: application/json" -H "Authorization: Bearer YOUR_AUTH_TOKEN" "STACK_URL/foundry-catalog/api/catalog/datasets/YOUR_DATASET_RID/branchesUnrestricted2/NEW_BRANCH_NAME" -d '{"parentRef": "YOUR_TRANSACTION_ID", "parentBranchId": "master"}'
Replace YOUR_AUTH_TOKEN, STACK_URL, YOUR_DATASET_RID, NEW_BRANCH_NAME and YOUR_TRANSACTION_ID with appropriate values. Short lived authentication token can be generated following these instructions.
Save the branch into a new dataset with a transform in a Code Repo, specifying the Input with the path to the dataset as well as the new branch’s name from #2.

etherscan or ethplorer doesn't see test transaction

I want to get address transaction list and as I can see that is possible only if dancing with a tambourine. So I decided to use some third party service(which I think shame for ethereum developers but we have that what we have). But those service can't see transactions or balance on the address even balance showing via command
curl -X POST http://localhost:8545 -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":"0xcd88f3430a2e01e61554e655719e0f92d3e1ba37", "pending"],"id":1}'
{"jsonrpc":"2.0","id":1,"result":"0xde0b6b3a7640000"}
(sent via goerli)
but when I perform request like
https://api.etherscan.io/api?module=account&action=txlist&address=0xcd88f3430a2e01e61554e655719e0f92d3e1ba37&sort=asc&apikey=...
I get
message "No transactions found"
Or on
https://kovan-api.ethplorer.io/getAddressTransactions/0xcd88f3430a2e01e61554e655719e0f92d3e1ba37?apiKey=...
[]
Can you please explain to me what happen and how easily to extract transaction list for the address.
Found it, need to use different domain for goerli transactions
https://api-goerli.etherscan.io/

How to generate a key pair to support Ethereum accounts?

I am planning to create my own HD wallet to support ERC 20 standard token, I am generating the seed using the javascript bitcore-mnemonics plugin. Now I want to generate a private key, public key and address from my generate 12 words mnemonics using javascript. How I can achieve this, I need help?
You can directly query your node, i.e., Parity with parity_newAccountFromPhrase - it accepts seeds like bitcore-mnemonics:
curl --data '{"method":"parity_newAccountFromPhrase","params":["stylus outing overhand dime radial seducing harmless uselessly evasive tastiness eradicate imperfect","hunter2"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545
I give you the answer with curl as you did not specify what exactly you are looking for, but JSONRPC wrappers should be available for all majore programming languages.
Reference.

salt state to run JSON API

I am quite new to SALT, I need to query a JSON API through slat state, may I know how best I should do. I am trying below is of no help though.
Salt ‘*’ cmd.run ‘curl --insecure -u "username:password" -X POST -H "Content-Type: application/json" -d '{"action":"RouterName","method":"methodname","data":[{"limit":100000, "uid" : "Query UID"}],"tid":1}' https:///zport/dmd/device_router’
Can I use any state file to query JSON API of my application through SALT.
There is a difference between module and state.
Modules: Module runs the command/function every time and does not care if the task needs to be run or not.
State: On the other hand, the state cares about the status of the task that needs to be executed. Based on the result, it decides if the task should be run or the system is in the desired state that the task wants it to be.
More about this issue this.
To somehow answer your question, you cannot be sure what is the state of a server that you are trying to curl from. That means, that you need to use a module to get the current output and decide upon that.

Sending SMS using the Pushbullet API via Bash scripting (curl)

I'm working on a cli for the Pushbullet HTTP API using Bash scripting. Sending pushes (notes and links), as well as creating, deleting, and modifying contacts & devices are all straight forward using curl and Bash. However, sending SMS and files are a bit more complex, as both require sending more complex JSON-formatted requests to the server (multiple JSON-formatted requests, in the case of pushing files).
I've tried sending many variations on the following (both with and without escape characters), but the server keeps replying about JSON-formatting errors. The following code is based off of the example given in the Pushbullet HTTP API documentation.
curl -su $auth_id: -X POST https://api.pushbullet.com/v2/ephemerals --header "Content-Type: application/json"
--data-binary '{ "\"type"\": "\"push"\", "\"push"\": { \
"\"type"\": "\"messaging_extension_reply"\", \
"\"package_name"\": "\"com.pushbullet.android"\", \
"\"source_user_iden"\": "\"$source_idens"\", \
"\"target_device_iden"\": "\"$target_idens"\", \
"\"conversation_iden"\": "\"$sms_device"\", \
"\"message"\": "\"Hello"\" \
} }'
Using bash -x, I can see that this is (supposedly) what is being sent to the server:
--data-binary '{"type": "push", "push": {
"type": "messaging_extension_reply",
"package_name": "com.pushbullet.android",
"source_user_iden": "<source_idens>",
"target_device_iden": "<device_idens>",
"conversation_iden": "<sms_phone_number>",
"message": "Hello" } }'
In all cases, the server returns:
{"error":{"type":"invalid_request","message":"Failed to parse JSON body.","cat":"(=^‥^=)"}}
What is the appropriate formatting of a JSON request using curl to send an SMS via the Pushbullet API? Am I overlooking something obvious? I'm trying to accomplish this using only curl and Bash, I see no reason why it's not possible (maybe not the fastest or most elegant way, but certainly possible).
I found the solution to my issue so I thought I'd share it. It was actually very simple:
Because the curl command includes a JSON-formatted response with single quotes, variable expansion was not occurring. This is a limitation (or perhaps a feature) of Bash. So, even though the server responded with { } indicating no errors in the request, the requests were actually being sent without the proper values for parameters, such asuser_iden,source_user_iden, etc.
Solution:
Enclose all variable expansions inside the JSON-formatted request in a double-quote and single-quote, like so:
"'"$user_idens"'"
First I'd like to apologize for how bad the API is, especially file upload and sending SMS. I was thinking of adding multipart or base64 file uploads to /v2/pushes. I think the first one might help you with curl, not sure about the base64 one. multipart is a huge pain though, so I'd prefer to make it better than the current setup if possible, rather than about equally as bad. Suggestions are welcome.
I tried your command line and it seemed to work, so I'm not sure what is going wrong. Here's the command line I did. Perhaps your quote escaping or newlines are causing the JSON error?
curl -u <access_token> -X POST https://api.pushbullet.com/v2/ephemerals --header "Content-Type: application/json" --data-binary '{"type": "push", "push": {"type": "messaging_extension_reply","package_name": "com.pushbullet.android","source_user_iden": "iden","target_device_iden": "device_idens", "conversation_iden": "sms_phone_number","message": "Hello" } }'