bytecoin icon indicating copy to clipboard operation
bytecoin copied to clipboard

RPC API methods not found

Open kocho opened this issue 6 years ago • 9 comments

Hello, I'm trying to query the bytecoin chain using some API methods listed here and here but all i'm getting is that the methods are not found. The only one working for me is get_status..

I'm running version 3.0.2. Is there anywhere an up to date list of possible API calls?

kocho avatar May 09 '18 08:05 kocho

I've found the full list here: https://github.com/bcndev/bytecoin/blob/master/src/rpc_api.hpp

rs-blashyrkh avatar May 09 '18 08:05 rs-blashyrkh

Thanx, I'm looking into it, but can't seem to find some calls that would allow me to get transactions within a block?

get_transfers method is returning not found.

kocho avatar May 09 '18 08:05 kocho

"get_transfers", two named parameters: from_height (=blockno-1), to_height (=blockno).

rs-blashyrkh avatar May 09 '18 08:05 rs-blashyrkh

curl -X POST http://localhost:8081/json_rpc -H 'Content-Type: application/json-rpc' -d '{"jsonrpc": "2.0", "id": "test", "method": "get_transfers", "params": {"from_height": 2, "to_height":5}}'

Still, doen't matter which params i put in, theres no error regarding parsing or params, but always just: {"error":{"code":-32601,"message":"Method not found"},"id":"test","jsonrpc":"2.0"}

kocho avatar May 09 '18 08:05 kocho

Do you need all block transactions or just "your" transactions? If you need all, you have to look for bytecoind api ("get_transfers" is walletd api). If you need only your transaction, you should send your request to walletd api port.

rs-blashyrkh avatar May 09 '18 08:05 rs-blashyrkh

I need all transactions in a block, this should be the bytecoind api, but i don't see anything relevant?

kocho avatar May 09 '18 08:05 kocho

Did you try sync_blocks?

rs-blashyrkh avatar May 09 '18 08:05 rs-blashyrkh

curl -X POST http://localhost:8081/json_rpc -H 'Content-Type: application/json-rpc' -d '{"jsonrpc": "2.0", "id": "test", "method": "sync_blocks", "params": {}}'

Response: { "id": "test", "jsonrpc": "2.0", "result": { "blocks": [], "start_height": 0, "status": { "incoming_peer_count": 0, "lower_level_error": "", "next_block_effective_median_size": 0, "outgoing_peer_count": 0, "recommended_fee_per_byte": 0, "top_block_difficulty": 0, "top_block_hash": "", "top_block_height": 0, "top_block_timestamp": 0, "top_block_timestamp_median": 0, "top_known_block_height": 0, "transaction_pool_version": 0 } } }

kocho avatar May 09 '18 09:05 kocho

@kocho Mind the daemon you send request to. This is an example of get_transfers request to walletd:

curl -s -u <user>:<pass> -X POST http://localhost:8070/json_rpc -H 'Content-Type: application/json-rpc' -d '{"jsonrpc": "2.0", "id": "test", "method": "get_transfers", "params": {}}' | jq

bcndev avatar May 10 '18 11:05 bcndev