Skip to content

39 Implement endpoints for XMR API #41

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

Draft
wants to merge 9 commits into
base: staging
Choose a base branch
from

Conversation

phoenix-web3
Copy link
Collaborator

@phoenix-web3 phoenix-web3 commented Dec 7, 2021

Description

  • Integration of Wallet-rpc-monero packages
  • Fix some bugs on monerod package and docker-composes

We need to implement the following endpoints:

  • checkTxProof( )
  • checkSpendProof( )
  • getHeight( )
  • getBlockByHash( )
  • getBlockByNumber( )
  • estimateFee( )

Additional endpoints implemented:

  • getTxProof( )
  • getSpendProof( )

Fixes #39 (issue)

Dependencies (if any)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Test checkTxProof( )

  • Test checkSpendProof( )

  • Test getHeight( )

curl -X POST --header 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"getHeight","params":{}, "id":1}' http://localhost:60001/rpc
{"id": 1, "jsonrpc": "2.0", "result": {"latestBlockIndex": 125592, "latestBlockHash": "67139795664d64281c6337eef64b64d2a55b65d12f6386ef8552fbc43a1381dc"}}~
  • Test getBlockByHash( )
~$ curl -X POST --header 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"getBlockByHash","params":{"blockHash":"67139795664d64281c6337eef64b64d2a55b65d12f6386ef8552fbc43a1381dc"}, "id":1}' http://localhost:60001/rpc

{"id": 1, "jsonrpc": "2.0", "result": {"blob": "010000000000000000000000000000000000000000000000000000000000000000000012270000013c01ff0001ffffffffffff0302df5d56da0c7d643ddd1ce61901c7bdc5fb1738bfe39fbe69c28a3a7032729c0f2101168d0c4ca86fb55a4cf6a36d31431be1c53a3bd7411bb24e8832410289fa6f3b00", "block_header": {"block_size": 80, "block_weight": 80, "cumulative_difficulty": 1, "cumulative_difficulty_top64": 0, "depth": 126331, "difficulty": 1, "difficulty_top64": 0, "hash": "76ee3cc98646292206cd3e86f74d88b4dcc1d937088645e9b0cbca84b7ce74eb", "height": 0, "long_term_weight": 80, "major_version": 1, "miner_tx_hash": "c099809301da6ad2fde11969b0e9cb291fc698f8dc678cef00506e7baf561de4", "minor_version": 0, "nonce": 10002, "num_txes": 0, "orphan_status": false, "pow_hash": "", "prev_hash": "0000000000000000000000000000000000000000000000000000000000000000", "reward": 17592186044415, "timestamp": 0, "wide_cumulative_difficulty": "0x1", "wide_difficulty": "0x1"}, "credits": 0, "json": "{\n  \"major_version\": 1, \n  \"minor_version\": 0, \n  \"timestamp\": 0, \n  \"prev_id\": \"0000000000000000000000000000000000000000000000000000000000000000\", \n  \"nonce\": 10002, \n  \"miner_tx\": {\n    \"version\": 1, \n    \"unlock_time\": 60, \n    \"vin\": [ {\n        \"gen\": {\n          \"height\": 0\n        }\n      }\n    ], \n    \"vout\": [ {\n        \"amount\": 17592186044415, \n        \"target\": {\n          \"key\": \"df5d56da0c7d643ddd1ce61901c7bdc5fb1738bfe39fbe69c28a3a7032729c0f\"\n        }\n      }\n    ], \n    \"extra\": [ 1, 22, 141, 12, 76, 168, 111, 181, 90, 76, 246, 163, 109, 49, 67, 27, 225, 197, 58, 59, 215, 65, 27, 178, 78, 136, 50, 65, 2, 137, 250, 111, 59\n    ], \n    \"signatures\": [ ]\n  }, \n  \"tx_hashes\": [ ]\n}", "miner_tx_hash": "c099809301da6ad2fde11969b0e9cb291fc698f8dc678cef00506e7baf561de4", "status": "OK", "top_hash": "", "untrusted": false}}
  • Test getBlockByNumber( )
~$ curl -X POST --header 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"getBlockByNumber","params":{"blockNumber":"125592"}, "id":1}' http://localhost:60001/rpc

{"id": 1, "jsonrpc": "2.0", "result": {"blob": "010000000000000000000000000000000000000000000000000000000000000000000012270000013c01ff0001ffffffffffff0302df5d56da0c7d643ddd1ce61901c7bdc5fb1738bfe39fbe69c28a3a7032729c0f2101168d0c4ca86fb55a4cf6a36d31431be1c53a3bd7411bb24e8832410289fa6f3b00", "block_header": {"block_size": 80, "block_weight": 80, "cumulative_difficulty": 1, "cumulative_difficulty_top64": 0, "depth": 127031, "difficulty": 1, "difficulty_top64": 0, "hash": "76ee3cc98646292206cd3e86f74d88b4dcc1d937088645e9b0cbca84b7ce74eb", "height": 0, "long_term_weight": 80, "major_version": 1, "miner_tx_hash": "c099809301da6ad2fde11969b0e9cb291fc698f8dc678cef00506e7baf561de4", "minor_version": 0, "nonce": 10002, "num_txes": 0, "orphan_status": false, "pow_hash": "", "prev_hash": "0000000000000000000000000000000000000000000000000000000000000000", "reward": 17592186044415, "timestamp": 0, "wide_cumulative_difficulty": "0x1", "wide_difficulty": "0x1"}, "credits": 0, "json": "{\n  \"major_version\": 1, \n  \"minor_version\": 0, \n  \"timestamp\": 0, \n  \"prev_id\": \"0000000000000000000000000000000000000000000000000000000000000000\", \n  \"nonce\": 10002, \n  \"miner_tx\": {\n    \"version\": 1, \n    \"unlock_time\": 60, \n    \"vin\": [ {\n        \"gen\": {\n          \"height\": 0\n        }\n      }\n    ], \n    \"vout\": [ {\n        \"amount\": 17592186044415, \n        \"target\": {\n          \"key\": \"df5d56da0c7d643ddd1ce61901c7bdc5fb1738bfe39fbe69c28a3a7032729c0f\"\n        }\n      }\n    ], \n    \"extra\": [ 1, 22, 141, 12, 76, 168, 111, 181, 90, 76, 246, 163, 109, 49, 67, 27, 225, 197, 58, 59, 215, 65, 27, 178, 78, 136, 50, 65, 2, 137, 250, 111, 59\n    ], \n    \"signatures\": [ ]\n  }, \n  \"tx_hashes\": [ ]\n}", "miner_tx_hash": "c099809301da6ad2fde11969b0e9cb291fc698f8dc678cef00506e7baf561de4", "status": "OK", "top_hash": "", "untrusted": false}}~
  • Test estimateFee( )
~$ curl -X POST --header 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"getFeePerByte","params":{}, "id":1}' http://localhost:60001/rpc

{"id": 1, "jsonrpc": "2.0", "result": {"feePerByte": 1136910000}}~

Test Configuration:

  • Operating system (output of cat /etc/os-release):
NAME="Ubuntu"
VERSION="18.04.5 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.5 LTS"
VERSION_ID="18.04"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
  • Kernel version (output of uname -sr): Linux 4.15.0-143-generic
  • Architecture (output of uname -m): x86_64

Related PR or Docs PR

Docs PR related #
Other PR related #

Good practices to consider

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@phoenix-web3 phoenix-web3 force-pushed the 39-implements-endpoints-for-xmr-api branch from 92120e3 to 14ac9c8 Compare December 21, 2021 20:04
@phoenix-web3 phoenix-web3 force-pushed the 39-implements-endpoints-for-xmr-api branch from 37e645c to d6f1993 Compare December 27, 2021 08:46
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

Successfully merging this pull request may close these issues.

Implement endpoints for XMR API
1 participant