We have provided Ethereum and Starcoin JSON RPC API collections in this repo. You could import them and test conveniently.
Testing Ethereum
Go to Postman Workspace page, then import ethereum.postman_collection.json
Go to Postman Environments page, then import ethereum.postman_environment.json
Go to Infura.io, choose an Ethereum network(for example, kovan) and get your project_id
Modify the network name and project_id in Postman ethereum Environments with your own
Choose an API, and click Send button
Testing Starcoin
Go to Postman Workspace page, then import starcoin.postman_collection.json
Go to Postman Environments page, then import starcoin.postman_environment.json
Run your local Starcoin network, or join online Starcoin network, like barnard, please refer to official Starcoin documentation. The difference is that here we will open all Websocket and HTTP APIs for testing. For security, please do not tell your node URL to others.
Note: if an API's response contains result: null instead of error: {...}, it's working as expected.
Start barnard node
./starcoin -n barnard --push-server-url http://miner-metrics-pushgw.starcoin.org:9191/ --push-interval 60 --miner-thread 4 --websocket-apis all --http-apis all
Start local dev node
./starcoin -n dev --miner-thread 2 --websocket-apis all --http-apis all
Modify the URL in Postman starcoin environments with your own
Note: chain.get_block_txn_infos returns an array of all transactions on a block.
Get transaction by hash
Ethereum
Starcoin
eth_getTransactionByHash
chain.get_transaction
Get transaction by block hash and index
Ethereum
Starcoin
eth_getTransactionByBlockHashAndIndex
chain.get_txn_info_by_block_and_index
Get transaction receipt
Ethereum
Starcoin
eth_getTransactionReceipt
chain.get_transaction
Note: chain.get_transaction returns information of an executed transaction. To get information of a pending transaction, please use txpool.pending_txn.
Note: state.get_account_state_set returns a big array containing all information of an account, the number of transactions equals the sequence_number of the account.
Note: eth_chainId in Ethereum also returns the chain ID, but in hex format. The chain.id method in Starcoin will also return the chain name of Starcoin, for example, barnard, proxima, etc.
Send transaction
Ethereum
Starcoin
eth_call
txpool.submit_hex_transaction
Note: hex transaction should be constructed from signer and transaction parameters, check the details out in starcoin.js.
Get gas price
Ethereum
Starcoin
eth_gasPrice
txpool.gas_price
Get peer count
Ethereum
Starcoin
net_peerCount
network_manager.known_peers -> result.length
Notes: node.peers in Starcoin will also returns a big array containing all peers' information.