n-y-z-o / nyzoVerifier

Verifier for the Nyzo cryptocurrency
The Unlicense
73 stars 42 forks source link

Any RPC API docs? #35

Closed Wangmmx closed 3 years ago

Wangmmx commented 3 years ago

Is there a restful interface document or json-rpc interface document? I have many interfaces that I can’t find, such as obtaining balance based on address(id__...), obtaining block details based on block height, etc.

iwbinb commented 3 years ago

Is there a restful interface document or json-rpc interface document? I have many interfaces that I can’t find, such as obtaining balance based on address(id__...), obtaining block details based on block height, etc.

Check here. the nyzo rpc docs https://github.com/Open-Nyzo/nyzoVerifier/blob/JSONRPC/JSONRPC_README.md. If you need to synchronize and save blocks in real time, please add the following parameters:

  1. synchronize blocks in real tim add always_track_blockchain=1 to /var/lib/nyzo/production/preferences
  2. save all blocks option a: keeps all individual block add block_file_consolidator=disable to /var/lib/nyzo/production/preferences option b: consolidate/compress the older blocks by batches of 1000 into a single file add block_file_consolidator=consolidate to /var/lib/nyzo/production/preferences
Wangmmx commented 3 years ago

Is there a restful interface document or json-rpc interface document? I have many interfaces that I can’t find, such as obtaining balance based on address(id__...), obtaining block details based on block height, etc.

Check here. the nyzo rpc docs https://github.com/Open-Nyzo/nyzoVerifier/blob/JSONRPC/JSONRPC_README.md. If you need to synchronize and save blocks in real time, please add the following parameters:

  1. synchronize blocks in real tim add always_track_blockchain=1 to /var/lib/nyzo/production/preferences
  2. save all blocks option a: keeps all individual block add block_file_consolidator=disable to /var/lib/nyzo/production/preferences option b: consolidate/compress the older blocks by batches of 1000 into a single file add block_file_consolidator=consolidate to /var/lib/nyzo/production/preferences

Thank you for your prompt reply! What I need here is these JSON-RPC methods.

Do these methods have to be connected to and supported by Yandev RPC server? Is there a way not to connect?

And where do the nodes and ports in the example refer to? I use the node on the client side, which doesn’t look right

Looking forward to your reply!

iwbinb commented 3 years ago

Is there a restful interface document or json-rpc interface document? I have many interfaces that I can’t find, such as obtaining balance based on address(id__...), obtaining block details based on block height, etc.

Check here. the nyzo rpc docs https://github.com/Open-Nyzo/nyzoVerifier/blob/JSONRPC/JSONRPC_README.md. If you need to synchronize and save blocks in real time, please add the following parameters:

  1. synchronize blocks in real tim add always_track_blockchain=1 to /var/lib/nyzo/production/preferences
  2. save all blocks option a: keeps all individual block add block_file_consolidator=disable to /var/lib/nyzo/production/preferences option b: consolidate/compress the older blocks by batches of 1000 into a single file add block_file_consolidator=consolidate to /var/lib/nyzo/production/preferences

Thank you for your prompt reply! What I need here is these JSON-RPC methods.

Do these methods have to be connected to and supported by Yandev RPC server? Is there a way not to connect?

And where do the nodes and ports in the example refer to? I use the node on the client side, which doesn’t look right

Looking forward to your reply!

It not the Yandev RPC server. This RPC branch only adds the RPC function, and is also connected to the nyzo mainnet. Exemple from bash using curl to call the "info" command: curl -X POST http://127.0.0.1:4000/jsonrpc -H 'Cache-Control: no-cache' -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0", "method": "info", "id": 1}' Btw, you can join nyzo discord https://discord.gg/REzrUZG In the #development, you can get the detail help.

Wangmmx commented 3 years ago

Is there a restful interface document or json-rpc interface document? I have many interfaces that I can’t find, such as obtaining balance based on address(id__...), obtaining block details based on block height, etc.

Check here. the nyzo rpc docs https://github.com/Open-Nyzo/nyzoVerifier/blob/JSONRPC/JSONRPC_README.md. If you need to synchronize and save blocks in real time, please add the following parameters:

  1. synchronize blocks in real tim add always_track_blockchain=1 to /var/lib/nyzo/production/preferences
  2. save all blocks option a: keeps all individual block add block_file_consolidator=disable to /var/lib/nyzo/production/preferences option b: consolidate/compress the older blocks by batches of 1000 into a single file add block_file_consolidator=consolidate to /var/lib/nyzo/production/preferences

Thank you for your prompt reply! What I need here is these JSON-RPC methods. Do these methods have to be connected to and supported by Yandev RPC server? Is there a way not to connect? And where do the nodes and ports in the example refer to? I use the node on the client side, which doesn’t look right Looking forward to your reply!

It not the Yandev RPC server. This RPC branch only adds the RPC function, and is also connected to the nyzo mainnet. Exemple from bash using curl to call the "info" command: curl -X POST http://127.0.0.1:4000/jsonrpc -H 'Cache-Control: no-cache' -H 'Content-Type: application/json' -d '{"jsonrpc": "2.0", "method": "info", "id": 1}' Btw, you can join nyzo discord https://discord.gg/REzrUZG In the #development, you can get the detail help.

Ok I will try to use it with my local node which is connected to the nyzo mainnet, and also, join the discord, thanks a lot!

Wangmmx commented 3 years ago

Successfully called the JSON-RPC port. By the way, I see that this is JSONRPC branch of Open-Nyzo/nyzoVerifier. Will this be merged into the master branch later? Because the functions we developed were also based on the JSONRPC branch , it is not conducive to maintenance if it is not merged

iwbinb commented 3 years ago

Successfully called the JSON-RPC port. By the way, I see that this is JSONRPC branch of Open-Nyzo/nyzoVerifier. Will this be merged into the master branch later? Because the functions we developed were also based on the JSONRPC branch , it is not conducive to maintenance if it is not merged

It's the same. Long-term maintenance by the community development team, and synchronized with the master branch. Btw, some exchanges also use this RPC.

EggPool commented 3 years ago

The open-nyzo/nyzoVerifier if the community json-rpc branch. It's referenced here as a PR so one can use it without changing repo.

If you added calls to the rpc branch, you're welcome to start a PR on the open Nyzo repo to have them merged.

As for merging them in master branch, I don't think it will be, at least in current state. Whole master branch is about fine tuned, optimized code, with custom and minimal implementations of everything, including http server and specific json parsing, and no external dependencies unless really, really unavoidable (ie: core crypto).

The rpc-branch on the other hand makes use of third party libraries to handle the json-rpc server.

Speaking for myself of course, just guessing what the founder devs would do or not do.

Wangmmx commented 3 years ago

Yes, I'm doing the support of the exchange @iwbinb And thanks for you reply @EggPool! The nyzo rpc docs mentioned earlier is a community project, so I started to build my node on that basis. Switched to the master branch and did not see JSONRPC related content, so I want to know whether this branch will be merged

EggPool commented 3 years ago

To the best of my knowledge, there is no reason to believe it will be.

The master branch from the founder devs - this repo - does not need and likely will not have json-rpc. Unless radical changes, Integrated Json-rpc is only available as community - but maintained - fork, on open-nyzo repo and related PR in the main repo.

Wangmmx commented 3 years ago

I mean, will the JSONRPC branch of the Open-Nyzo/nyzoVerifier project be merged into the master branch of Open-Nyzo/nyzoVerifier? Maybe I raised this issue in the wrong place. The answer that said before told me JSONRPC branch is synchronized with the master.

iwbinb commented 3 years ago

I mean, will the JSONRPC branch of the Open-Nyzo/nyzoVerifier project be merged into the master branch of Open-Nyzo/nyzoVerifier? Maybe I raised this issue in the wrong place. The answer that said before told me JSONRPC branch is synchronized with the master.

Not atm. But maybe in the future. The branch is synchronized with the master. So just use it as fine. 😀

Wangmmx commented 3 years ago

I mean, will the JSONRPC branch of the Open-Nyzo/nyzoVerifier project be merged into the master branch of Open-Nyzo/nyzoVerifier? Maybe I raised this issue in the wrong place. The answer that said before told me JSONRPC branch is synchronized with the master.

Not atm. But maybe in the future. The branch is synchronized with the master. So just use it as fine. 😀

That's good, thank you very much

Wangmmx commented 3 years ago

The method 'transactionconfirmed' of JSONRPC api got an error: java.lang.NullPointerException

Is there something wrong with my code ? curl -X POST http://127.0.0.0:30288/jsonrpc -H 'Content-type:application/json' -d '{"jsonrpc":"2.0","method" :"transactionconfirmed","params" :{"tx":"53deda5c5e53194aae9eb7de7bedc617a7f86d7c91fb49b216b8e0e9d1514526ba71fcfcf6c835b55f3cabc7dc68d82eae0e3ddedfc4dca9b51a33cd7a0a0b00"},"id":1}'

Wangmmx commented 3 years ago

Is there any JSONRPC interface to get the transaction body details by signature hex?

Wangmmx commented 3 years ago

Open other issues and close this one, thanks a lot!