Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transaction details #3402

Open
kosik opened this issue Jan 16, 2024 · 14 comments
Open

transaction details #3402

kosik opened this issue Jan 16, 2024 · 14 comments

Comments

@kosik
Copy link

kosik commented Jan 16, 2024

Hello Developers!

I decided to implement a function which finds out if transactions-volume has exceeded a 4-weeks extremum.

I planned to use getRawTransaction JSON-RPC API method for this. I launched a fresh node with -txindex and sent the following commands:

$> dogecoind -server -daemon -rest -alerts -rpcauth -logtimestamps -logips -txindex -debug=1 -datadir=/path_here -conf=/path_here/dogecoin.conf -wallet=file_name.dat

$> curl --user user_name --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getrawtransaction", "params": ["5b2a3f53f605d62c53e62932dac6925e3d74afa5a4b459745c36d42d0ed26a69", true, "1a91e3dace36e2be3bf030a65679fe821aa1d6ef92e7c9902eb318182c355691"]}' -H 'content-type: text/plain;' http://127.0.0.1:22555/

{"result":null,"error":{"code":-1,"message":"getrawtransaction \"txid\" ( verbose )\n\nNOTE: By default this function only works for mempool transactions. 
If the -txindex option is\nenabled, it also works for blockchain transactions.\nDEPRECATED: for now, it also works for transactions with unspent outputs.\n\nReturn the raw transaction data.\n\nIf verbose is 'true' ... ... 

Here is the 1 ever transaction-Id and the 1 Block-Id. I anticipated the API returns details of the transaction: an amount and addresses to which it was transferred. In fact, the node responds with a Deprecated message and does not suggest which API to use instead.

Could you please advise how to solve this particular issue?

Do you see an alternative solutions to implement this? If I understand correct what Dogecoin node does is - persists new blocks in BerkleyDb. I am thinking to attempt to connect my application to the database directly and apply a SQL query. The first problem that I see is that the Node uses 2013 database, the latest version was released in 2020, and it is unknown whether it will support requests from Java application.

@patricklodder
Copy link
Member

The problem is caused by the params you're passing to getrawtransaction :

Expected params:

[
  hash,
  bool
]

Your input:

 [
  "5b2a3f53f605d62c53e62932dac6925e3d74afa5a4b459745c36d42d0ed26a69",
  true,
  "1a91e3dace36e2be3bf030a65679fe821aa1d6ef92e7c9902eb318182c355691"
]

@patricklodder
Copy link
Member

@kosik did this fix your issue?

@kosik
Copy link
Author

kosik commented Jan 18, 2024

Hello Patrick,

I see, i used wrong signature. But with with the two params and -txindex enabled the API responds, -_No such mempool or blockchain transaction. Use gettransaction for wallet transactions._

I need to scan the whole block-chain, not only a wallet-transactions. It seems like there are no suitable API to query the data at this moment.

So if we had a JSON-RPC API which accepts a kind of BerkeleyDB compatible SQL and responds with a JSON object it might be a cool feature

@victorsk2019
Copy link

it is unknown whether it will support requests from Java application.

Hi! I've implemented a simple Java RPC client few years ago for my website to display various blockchain and network information for fun. It takes required RPC credentials as parameters and returns JSON RPC response, then you can parse JSON response to obtain needed values. This way you can apply RPC method calls using Java, which I think is exactly what you are looking for.

@georgeartem
Copy link

georgeartem commented Jan 18, 2024 via email

@patricklodder
Copy link
Member

But with with the two params and -txindex enabled the API responds, -No such mempool or blockchain transaction. Use gettransaction for wallet transactions.

Assuming that this is on mainnet per your above startup arguments, what transaction are you searching?

Transaction 5b2a3f53f605d62c53e62932dac6925e3d74afa5a4b459745c36d42d0ed26a69 does not exist on my mainnet chain, also not in block 1a91e3dace36e2be3bf030a65679fe821aa1d6ef92e7c9902eb318182c355691.

@kosik
Copy link
Author

kosik commented Jan 18, 2024

Aha,

It is mainnet, no pruned, starting with 0 block. Here is how i received the transaction:

`curl --user user_name --data-binary '{"jsonrpc": "1.0", "id":"0", "method": "getblockhash", "params": [0]}' -H 'content-type: text/plain;' http://127.0.0.1:22555/
{"result":"1a91e3dace36e2be3bf030a65679fe821aa1d6ef92e7c9902eb318182c355691","error":null,"id":"0"}

curl --user user_name --data-binary '{"jsonrpc": "1.0", "id":"0", "method": "getblock", "params": [1a91e3dace36e2be3bf030a65679fe821aa1d6ef92e7c9902eb318182c355691]}' -H 'content-type: text/plain;' http://127.0.0.1:22555/

{"result":{"hash":"1a91e3dace36e2be3bf030a65679fe821aa1d6ef92e7c9902eb318182c355691","confirmations":5053555,"strippedsize":224,"size":224,"weight":896,"height":0,"version":1,"versionHex":"00000001","merkleroot":"5b2a3f53f605d62c53e62932dac6925e3d74afa5a4b459745c36d42d0ed26a69","tx":["5b2a3f53f605d62c53e62932dac6925e3d74afa5a4b459745c36d42d0ed26a69"],"time":1386325540,"mediantime":1386325540,"nonce":99943,"bits":"1e0ffff0","difficulty":0.000244140625,"chainwork":"0000000000000000000000000000000000000000000000000000000000100010","nextblockhash":"82bc68038f6034c0596b6e313729793a887fded6e92a31fbdf70863f89d9bea2"},"error":null,"id":"0"}
`
I passed an arbitrary transactionId into getRawTransaction and this is helped. Thank you a lot !
I will experiment to understand why not all transactions are accepting, but for the moment it is enough to go further.

The idea itself is a financial strategy described in the book by <John J Murphy - Technical Analysis Of The Financial Markets>, on page 215, The Weekly Rule. The strategy helps to keep positions open on the right market side and not loose money.

The author suggest to keep eye on price extremums.
I decided to start with transactions-volume and transactions amount. Probably, the volume is even more important. I am going to validate this and find what works better. Maybe I will add the price link too.

Finally, I will connect this feature to the Telegram messenger and it will automatically alert if there is high volatility, major reversal or other important events on the network

@patricklodder
Copy link
Member

.. starting with 0 block ..

Start with 1. The genesis transaction isn't indexed because it's not spendable.

@kosik
Copy link
Author

kosik commented Feb 11, 2024

Hello, I have implemented the part calculating daily transactions amount and launched execution finding day-by-day monetary volume. The computation took about 1 minute per day on my equipment. Nevertheless, as i see now, the amount of transactions in blockchain has drastically increased about 9 month ago.

For example: on day 3468, there were over 2 million transactions on the Dogecoin network. Throughout the whole previous blockchain history this value remained about ~50k per day, or less, depends on a day.

This TX's amount requires about 30 minutes of computations on my equipment. It is not OK, but the question is other:

Such a significant increase in the number of transactions may indicate that the Dogecoin has become very popular among users due to a New-Application based on the Dogecoin network.

I did not hear about such breakthrough Products. So, question: does anyone know where the source of the traffic is from?

If there is no clear source, could it be a deliberate attack by an interested parties?

dogecoin-stat-logs

@patricklodder
Copy link
Member

does anyone know where the source of the traffic is from?

It's a bunch of bots that are adding data (images, blobs, but mostly json) in if (false) { "insert data here" } equivalent script constructs. There are some discord groups out there that encourage this, because they hope that the "tokens" they launch will make them rich. Bottom line this is the same greed that dominates the EVM chains. Nothing new.

could it be a deliberate attack by an interested parties?

From a currency perspective it can be seen as an attack - but unsuccessful and a known weakness - but I have seen no evidence that this is deliberately malicious, except there seems to be a lot of congratulations going back and forth whenever that 2M tx/day milestone gets hit. That's kind of sad, but let's not forget that this is Dogecoin and we've seen dumber things happen.


All this truly means one thing: we would be wise to invest R&D time into alternative full validation technology earlier than we initially thought we had to. It's been known for years that we have to create an alternative to validating decades of transaction history sequentially. Between 2014 and 2023 I was thinking that we'd need a solution by 2035 or 2040. Now I think that we may need a solution by 2026 or 2030.

There are some recent developments, like STARK header proofs that solves part of the problem with cryptography, and a first step towards utxo set sync that solves parts with consensus / game theory, and those ideas are going to evolve more rapidly now. Interesting times.

@victorsk2019
Copy link

May I suggest looking into CPU instruction support to optimize full node builds with avx2, sse2. I know these features are still in "experimental" stage but as I recall there were benchmark tests done showing improved synchronization/cryptographic computation performance with these options turned on. This may help slightly enhance full node performance, and, subsequently boost overall network performance also? I, for one, am running my full node with avx2 on 😎
Screenshot_20240211_094755

@patricklodder
Copy link
Member

Of course. Anyone can compile with those flags and run it and it will be improved upon with the currently reduced scope for 1.14.7.

Unfortunately we've not been able to get the full functionality in for the now-planned release, so it'll have to stay in experimental mode for now. This was the main reason why I was reluctant to release 1.14.7 earlier. We'll just have to take smaller steps.

@kosik
Copy link
Author

kosik commented Feb 22, 2024

Hello!

I did not found them on Discord, but found a website which seems the source, pretending selling NFT;

Anyway, Blockchain is a ledger system. HashTable is a data structure for storing key-value. The data structure is not for keeping big BLOB values. Thus it is senseless to utilize the data structure in order to store media data-archive.

I see following solution:

I can imagine a real case, when a third-party organization need to store a custom-structure in a blockchain, publicly. In the same time, the primary blockchain purpose is for validation, not for storing private data.

Ok! Why not add this feature, to store complex structures on the blockchain, but organize the API in a way that stores the data intelligently.

Let assume an organization need prove that an arbitrary data is valid. This can be a binary data, or a structure similar to structure describing ORM entities for database. Anyway, this is an organization specific custom data.

You don't keep personal things in a public place, like city park, city hall reception area or library. If you need a prove, you can sign the data with a private key and put the hash into block-chain.

Keep personal(custom) data in your private data-store.

In order to support the idea I could implement an extension. The extension will provide a set of utilities to help sign an arbitrary data with a private key; decode the data with a public key. The extension will provide a facility to store the custom structures in an external database plus maintain the reference between the custom-data and the custom-data-hash-key in main blockchain.

The first version of the extension might sense to make with BerkeleyDB support. Approximately with the same structure as the main blockchain. The extension will allow to read the data and could be configured and launched together with Dogecoin Node, or separately.

I don’t know what software miners use to write new blocks. But if it is technically possible, to limit the Dogecoin Node API to accepts new transactions the Value field will correspond format to a specific hash-format, then this Extension plus the Limit would guarantee the stability of the network against let is say garbage-content-attacks.

@patricklodder
Copy link
Member

I could implement an extension

This already exists and has been standardized. See https://standards.lnp-bp.org/rgb/lnpbp-0013 and https://docs.lightning.engineering/the-lightning-network/taproot-assets/taproot-assets-protocol

The problem is not the tech, the problem is that the narrative of "here a way to store your own stuff in a custom realm so it doesn't bother anyone" isn't as sexy to degens as "here's a way to let everyone else store and pay for your stuff and it cannot ever be removed by anyone".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@patricklodder @kosik @georgeartem @victorsk2019 and others