-
Notifications
You must be signed in to change notification settings - Fork 2
API Document
default url: http://localhost:8000/
Creates new transaction or a contract creation And signed transaction.
args:
- Type: transaction type (Binary,LoginCandidate,LogoutCandidate,Delegate,UnDelegate,Redeem)
- From: sender address
- To: recipient address
- Gas: exectue transaction spend fuel
- GasPrice: fuel price
- Value: transfer amount
- Data: extra data or contract code
- Passphrase: account passphrase
curl:
curl -X POST -d '{"id": 1, "method": "Uranus.SignAndSendTransaction", "params": [{"From": "0xFa9DbC22324b7052372f0DE718aBc1BAFf5Afa7c","Tos": ["0xd46e8dd67c5d32be8058bb8eb970870f07244567"],"Gas": "0x76c0", "GasPrice": "0x9184e72a000","Value": "0x9184e72a", "Data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675","Passphrase":"coinbase"}]}' http://localhost:8000
result:
{
"id": 1,
"result": "0x3f0a6e187d39abcad295d0c98076678067d5c38ddcad3e99a3c06dde9a925227",
"error": null
}
Send a new signed transaction or a contract creation.
args:
- Data: transaction rlp bytes hex .
curl:
curl -X POST -d '{"id": 1, "method": "Wallet.SendRawTransaction", "params": ["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"]}' http://localhost:8000
result:
{
"id": 1,
"result": "0x3f0a6e187d39abcad295d0c98076678067d5c38ddcad3e99a3c06dde9a925227",
"error": null
}
Returns balance at a given address.
args:
-
Address: account address.
-
BlockHeight: The following options are possible for the defaultBlock parameter:
- HEX String - an integer block number
- String "earliest" for the earliest/genesis block
- String "latest" - for the latest mined block
- String "pending" - for the pending state/transactions
curl:
curl -X POST -d '{"id": 1, "method": "Uranus.GetBalance", "params": [{"Address":"0xFa9DbC22324b7052372f0DE718aBc1BAFf5Afa7c","BlockHeight":"latest"}]}' http://localhost:8000
result:
{
"id": 1,
"result": 18000000000000000000,
"error": null
}
Returns nonce at a given address.
args:
see GetBalance args
curl:
curl -X POST -d '{"id": 1, "method": "Uranus.GetNonce", "params": [{"Address":"0xFa9DbC22324b7052372f0DE718aBc1BAFf5Afa7c","BlockHeight":"latest"}]}' http://localhost:8000
result:
{
"id": 1,
"result": "0x1",
"error": null
}
Returns code at a given address.
args :
see GetBalance args
curl:
curl -X POST -d '{"id": 1, "method": "Uranus.GetCode", "params": [{"Address":"0xFa9DbC22324b7052372f0DE718aBc1BAFf5Afa7c","BlockHeight":"latest"}]}' http://localhost:8000
result:
{
"id": 1,
"result": "0x4b0a243dce3ba812412e17958a",
"error": null
}
Executes the given transaction on the state for the given block number.
args:
- From: sender address.
- To: recipient address.
- Gas: Integer of the gas provided for the transaction execution. uranus_call consumes zero gas, but this parameter may be needed by some executions.
- Gasprice: Integer of the gasPrice used for each paid gas.
- Value: Integer of the value sent with this transaction.
- Data: Hash of the method signature and encoded parameters. For details see Ethereum Contract ABI
- BlockHeight:see GetBalance BlockHeight args
curl:
curl -X POST -d '{"id": 1, "method": "Uranus.Call", "params": [{"From": "0xfF38733Cc8433a6Ad934908525488423Bd7008ca","To":["0xF22469188Fe0dF43E74561C23f5d2A959Cd74E9c"],"Gas": "0x9f759", "GasPrice": "0x9184e72a000", "Data": "0x6d4ce63c","BlockHeight":"latest"}]}' http://localhost:8000
result:
{"id":1,"result":"0x000000000000000000000000000000000000000000000000000000000000000a","error":null}
Returns node send transaction suggest gas price
args :
- no need args
curl:
curl -X POST -d '{"id": 1, "method": "Uranus.SuggestGasPrice", "params": []}' http://localhost:8000
result:
{
"id": 1,
"result": "0x430e23400",
"error": null
}
Create new account and key file by passphrase and returns account address.
args:
- Data: account passphrase
curl:
curl -X POST -d '{"id": 1, "method": "Wallet.NewAccount", "params": ["123456"]}' http://localhost:8000
result:
{
"id": 1,
"result": "0xc4a097a83e24b0a243dce3ba812412e17958a191",
"error": null
}
Delete a account and key file by address and passphrase,
args:
- Address: account address
- Passphrase: account passphrase
curl:
curl -X POST -d '{"id": 1, "method": "Wallet.Delete", "params": [{"Address":"0xc4a097a83e24b0a243dce3ba812412e17958a191","Passphrase":"123456"}]}' http://localhost:8000
result:
{
"id": 1,
"result": true,
"error": null
}
Update account passphrase.
args:
- Address: account address
- Passphrase: account old passphrase
- NewPassphrase: account new passphrase
curl:
curl -X POST -d '{"id": 1, "method": "Wallet.Update", "params": [{"Address":"0xdec741b31abda5e103d95cd7f535ed2042ff3daf","Passphrase":"123456","NewPassphrase":"111111"}]}' http://localhost:8000
result:
{
"id": 1,
"result": true,
"error": null
}
Return a list of all account address.
args:
- no need args
curl:
curl -X POST -d '{"id": 1, "method": "Wallet.Accounts", "params": []}' http://localhost:8000
result:
{
"id": 1,
"result": ["0xe8a7318ffa0eedaa5f40edf1dd8b7638bdd6e9a2", "0xd64642619cc6cd1cf264c6523e343a3530bcd908"],
"error": null
}
Import a Pravite key into wallet.
args:
- PrivKeyHex: Pravite key hex
- Passphrase: generate account passphrase
curl:
curl -X POST -d '{"id": 1, "method": "Wallet.ImportRawKey", "params": [{"PrivKeyHex":"7343677dae4a948c5b6281b92e8a72d7af7ca1a458831b606462a1bb18725e8d","Passphrase":"23456"}]}' http://localhost:8000
result:
{
"id": 1,
"result": "0xf0f1a89f5ff108335b1549a3be97577c7b709781",
"error": null
}
Export a Pravite key as hex.
args:
- Address: address hex
- Passphrase: generate account passphrase
curl:
curl -X POST -d '{"id": 1, "method": "Wallet.ExportRawKey", "params": [{"Address":"0x9fb7a173e6b3eabeacb946c211a8954393707490","Passphrase":"123456"}]}' http://localhost:8000
result:
{
"id": 1,
"result": "96fb43f02b947d9049c0e0d7e2ac471fb07c3c7ee00fd9f1b5c37eadd4c20148",
"error": null
}
Returns a block info by block height.
args :
- BlockHeight: see GetBalance args blockHeight
- FullTx: if true ,return block all transaction info ,else only return transaction hash
curl:
curl -X POST -d '{"id": 1, "method": "BlockChain.GetBlockByHeight", "params": [{"BlockHeight":"0x1","FullTX":false}]}' http://localhost:8000
result:
{
"id": 1,
"result": {
"height": "0x8",
"difficulty": "0xf49db",
"extraData": "0x302e312e30",
"gasLimit": "0x4c4b40",
"gasUsed": "0x0",
"hash": "0x000010017413ef42e7542b3693f69e918dc8cdc18ac83c621d40d73fdda7756c",
"miner": "0x210f48c05511dd64da1f46f9163d2e2c75bba988",
"nonce": "0x00000000000c56c2",
"parentHash": "0x000003b80ef59de18584fd22845107ab1c30686141f87a9bfc404cf0583e62f8",
"receiptsRoot": "0x4309694914832f628905efbf1706938f222ad28b9f5cb2cb8d8e77466330b2df",
"size": "0x256",
"stateRoot": "0x17911d7b1ebb1c5bc41e3078b3e5d1d18e3eeae9fce7417b3a1812f4bd1ca403",
"timestamp": "0x5b826dc6",
"totalDifficulty": "0x89899f",
"transactions": [{
"blockHash": "0x000010017413ef42e7542b3693f69e918dc8cdc18ac83c621d40d73fdda7756c",
"blockHeight": "0x8",
"type":"0x0",
"from": "0x210f48c05511dd64da1f46f9163d2e2c75bba988",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
"hash": "0x266f00801f59cf7036b62be91fa9064f6017ccf22d4fbc8196fd6ccc708bd7d6",
"input": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675",
"nonce": "0x0",
"tos": ["0xd46e8dd67c5d32be8058bb8eb970870f07244567"],
"transactionIndex": "0x0",
"value": "0x9184e72a",
"signature": "0xd9f262752b404651a581933af6aaeb2b43f682d9229eca2cbdc07e3b8b5367d97992571033155d792396424e77124fd98b79415dc3ca1c9f46bf1f9e1cbac5c900"
}],
"transactionsRoot": "0xf82cda501f685cbfc8bdb40c0049c107ae829c903897b5dded0f533bf5de23c7"
},
"error": null
}
Returns a block info by block Hash.
args:
- BlockHash: block Hash
- FullTx: see GetBlockByHeight args FullTx
curl:
curl -X POST -d '{"id": 1, "method": "BlockChain.GetBlockByHash", "params": [{"BlockHash":"0x000010017413ef42e7542b3693f69e918dc8cdc18ac83c621d40d73fdda7756c","FullTX":false}]}' http://localhost:8000
result:
{
"id": 1,
"result": {
"Height": "0x8",
"difficulty": "0xf49db",
"extraData": "0x302e312e30",
"gasLimit": "0x4c4b40",
"gasUsed": "0x0",
"hash": "0x000010017413ef42e7542b3693f69e918dc8cdc18ac83c621d40d73fdda7756c",
"miner": "0x210f48c05511dd64da1f46f9163d2e2c75bba988",
"nonce": "0x00000000000c56c2",
"parentHash": "0x000003b80ef59de18584fd22845107ab1c30686141f87a9bfc404cf0583e62f8",
"receiptsRoot": "0x4309694914832f628905efbf1706938f222ad28b9f5cb2cb8d8e77466330b2df",
"size": "0x256",
"stateRoot": "0x17911d7b1ebb1c5bc41e3078b3e5d1d18e3eeae9fce7417b3a1812f4bd1ca403",
"timestamp": "0x5b826dc6",
"totalDifficulty": "0x89899f",
"transactions": ["0x266f00801f59cf7036b62be91fa9064f6017ccf22d4fbc8196fd6ccc708bd7d6"],
"transactionsRoot": "0xf82cda501f685cbfc8bdb40c0049c107ae829c903897b5dded0f533bf5de23c7"
},
"error": null
}
Returns transaction info by txhash.
args:
- Data: transaction hash
curl:
curl -X POST -d '{"id": 1, "method": "BlockChain.GetTransactionByHash", "params": ["0x266f00801f59cf7036b62be91fa9064f6017ccf22d4fbc8196fd6ccc708bd7d6"]}' http://localhost:8000
result:
{
"id": 1,
"result": {
"blockHash": "0x000010017413ef42e7542b3693f69e918dc8cdc18ac83c621d40d73fdda7756c",
"blockHeight": "0x8",
"type":"0x0",
"from": "0x210f48c05511dd64da1f46f9163d2e2c75bba988",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
"hash": "0x266f00801f59cf7036b62be91fa9064f6017ccf22d4fbc8196fd6ccc708bd7d6",
"input": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675",
"nonce": "0x0",
"tos": ["0xd46e8dd67c5d32be8058bb8eb970870f07244567"],
"transactionIndex": "0x0",
"value": "0x9184e72a",
"signature": "0xd9f262752b404651a581933af6aaeb2b43f682d9229eca2cbdc07e3b8b5367d97992571033155d792396424e77124fd98b79415dc3ca1c9f46bf1f9e1cbac5c900"
},
"error": null
}
Returns receipt by transaction hash.
args
- Data: transaction hash
curl:
curl -X POST -d '{"id": 1, "method": "BlockChain.GetTransactionReceipt", "params": ["0x266f00801f59cf7036b62be91fa9064f6017ccf22d4fbc8196fd6ccc708bd7d6"]}' http://localhost:8000
result:
{
"id": 1,
"result": {
"blockHash": "0x000010017413ef42e7542b3693f69e918dc8cdc18ac83c621d40d73fdda7756c",
"blockNumber": "0x8",
"contractAddress": null,
"cumulativeGasUsed": "0x5cec",
"from": "0x210f48c05511dd64da1f46f9163d2e2c75bba988",
"gasUsed": "0x5cec",
"logs": [],
"root": "0x18d6dbd752e161b95a149c67fc2f140a4e8f268e20d253f8c115f7098ef70944",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"transactionHash": "0x266f00801f59cf7036b62be91fa9064f6017ccf22d4fbc8196fd6ccc708bd7d6",
"transactionIndex": "0x0"
},
"error": null
}
Returns txPool have transactions.
args:
no need args
curl:
curl -X POST -d '{"id": 1, "method": "TxPool.Content", "params": []}' http://localhost:8000
result:
{
"id": 1,
"result": {
"pending": {
"0xFa9DbC22324b7052372f0DE718aBc1BAFf5Afa7c": {
"0": {
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"blockHeight": null,
"type":"0x0",
"from": "0xfa9dbc22324b7052372f0de718abc1baff5afa7c",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
"hash": "0x3f0a6e187d39abcad295d0c98076678067d5c38ddcad3e99a3c06dde9a925227",
"input": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675",
"nonce": "0x0",
"tos": ["0xd46e8dd67c5d32be8058bb8eb970870f07244567"],
"transactionIndex": "0x0",
"value": "0x9184e72a",
"signature": "0xc643850705de00ae2a593c13b28f71842d7fcf151b8abfaa2d0e5010120fc39476917fe8215975bba564090949d49641bd8a645ad0662df77df2290f643a911101"
}
}
},
"queued": {}
},
"error": null
}
Returns TxPool transaction numbers.
args:
no need args
curl:
curl -X POST -d '{"id": 1, "method": "TxPool.Status", "params": []}' http://localhost:8000
result:
{
"id": 1,
"result": {
"pending": "0x1",
"queued": "0x0"
},
"error": null
}
Returns TxPool transaction numbers.
args:
- url:peer url string.
curl:
curl -X POST -d '{"id": 1, "method": "Admin.AddPeer", "params": ["enode://44f62d3728e1636f8a589e68b430015c82cd5b39735c483c84c5cfd0404a929f6e7fe93834d9dbb420911a841a9ab31c596f1c8378a94340ae0d8e333b038fd1@127.0.0.1:7080"]}' http://localhost:8000
result:
{
"id": 1,
"result": true,
"error": null
}
Disconnects from a a remote node if the connection exists
args:
- url:peer url string.
curl:
curl -X POST -d '{"id": 1, "method": "Admin.RemovePeer", "params": ["enode://44f62d3728e1636f8a589e68b430015c82cd5b39735c483c84c5cfd0404a929f6e7fe93834d9dbb420911a841a9ab31c596f1c8378a94340ae0d8e333b038fd1@127.0.0.1:7080"]}' http://localhost:8000
result:
{
"id": 1,
"result": true,
"error": null
}
Retrieves all the information we know about each individual peer at the protocol granularity.
args:
no need args
curl:
curl -X POST -d '{"id": 1, "method": "Admin.Peers", "params": []}' http://localhost:8000
result:
{
"id": 1,
"result": [{
"id": "44f62d3728e1636f8a589e68b430015c82cd5b39735c483c84c5cfd0404a929f6e7fe93834d9dbb420911a841a9ab31c596f1c8378a94340ae0d8e333b038fd1",
"name": "Peer 44f62d3728e1636f(127.0.0.1:7080)",
"caps": null,
"network": {
"localAddress": "127.0.0.1:37268",
"remoteAddress": "127.0.0.1:7080"
},
"protocols": {
"uransus": {
"version": 1,
"difficulty": 1000000,
"head": "0x749432a8195e9269b14dd5a3cc59b1c84733b4a85a43e35891080c6c085838ac"
}
}
}],
"error": null
}
Retrieves all the information we know about the host node at the protocol granularity.
args:
no need args
curl:
curl -X POST -d '{"id": 1, "method": "Admin.NodeInfo", "params": []}' http://localhost:8000
result:
{
"id": 1,
"result": {
"id": "18e87f8139606ace8a589ebbd8ed7bcbb9a451421bfc2f674318b31989f02cc0b6cb00b7cb487e74f58b83ef15c3faf5837d9c424aa436fd0e445429f8929af9",
"name": "",
"enode": "enode://18e87f8139606ace8a589ebbd8ed7bcbb9a451421bfc2f674318b31989f02cc0b6cb00b7cb487e74f58b83ef15c3faf5837d9c424aa436fd0e445429f8929af9@[::]:7090",
"ip": "::",
"ports": {
"discovery": 7090,
"listener": 7090
},
"listenAddr": "[::]:7090",
"protocols": {
"uransus": {
"difficulty": 1003803,
"genesis": "0x57e5168db7a5d6b70075fbdc19cd1bfdfbd643dccf1654e4c8a101f9879d4de4",
"head": "0x45b8cb4db1809903b95f791dbaedaa233dc823d41e7918a358e548a24cfa6c7a"
}
}
},
"error": null
}
Start the miner.
args:
no need args
curl:
curl -X POST -d '{"id": 1, "method": "Miner.Start", "params": []}' http://localhost:8000
result:
{
"id": 1,
"result": true,
"error": null
}
Stop the miner.
args:
no need args
curl:
curl -X POST -d '{"id": 1, "method": "Miner.Stop", "params": []}' http://localhost:8000
result:
{
"id": 1,
"result": true,
"error": null
}
Stop the miner.
args:
- Address:coinbase address.
curl:
curl -X POST -d '{"id": 1, "method": "Miner.SetCoinbase", "params": ["0xd46e8dd67c5d32be8058bb8eb970870f07244567"]}' http://localhost:8000
result:
{
"id": 1,
"result": true,
"error": null
}
Retrieves the list of the validators at specified block.
args:
- BlockHeight:see GetBalance BlockHeight args
curl:
curl -X POST -d '{"id": 1, "method": "Dpos.GetValidators", "params": ["latest"]}' http://localhost:8000
result:
{
"id": 1,
"result": ["0x970e8128ab834e8eac17ab8e3812f010678cf791"],
"error": null
}
Retrieves the list of the voters at specified block
args:
- BlockHeight:see GetBalance BlockHeight args
curl:
curl -X POST -d '{"id": 1, "method": "Dpos.GetVoters", "params": ["latest"]}' http://localhost:8000
result:
{
"id": 1,
"result": {
"0x970e8128ab834e8eac17ab8e3812f010678cf791": "0x0"
},
"error": null
}
Retrieves the list of the candidate at specified block
args:
- BlockHeight:see GetBalance BlockHeight args
curl:
curl -X POST -d '{"id": 1, "method": "Dpos.GetCandidates", "params": ["latest"]}' http://localhost:8000
result:
{
"id": 1,
"result": ["0x970e8128ab834e8eac17ab8e3812f010678cf791"],
"error": null
}
Retrieves the list of the delegators of specified candidate at specified block
args:
- Candidate: Candidate address.
- BlockHeight:see GetBalance BlockHeight args
curl:
curl -X POST -d '{"id": 1, "method": "Dpos.GetDelegators", "params": [{"BlockHeight":"latest","Candidate":"0x970e8128ab834e8eac17ab8e3812f010678cf791"}]}' http://localhost:8000
result:
{
"id": 1,
"result": ["0x970e8128ab834e8eac17ab8e3812f010678cf791"],
"error": null
}
Retrieves voter info at specified block.
args:
- Delegator: Delegator address.
- BlockHeight:see GetBalance BlockHeight args
curl:
curl -X POST -d '{"id": 1, "method": "Dpos.GetVoterInfo", "params": [{"BlockHeight":"latest","Delegator":"0x64378Ae5fed6f36E3759BCE3616e3250B27cE033"}]}' http://localhost:8000
result:
{
"id": 1,
"result": {
"lockedBalance": "0x2b5e3af16b1880000",
"timestamp": "0x1572fe012469636e",
"candidates": ["0x64378ae5fed6f36e3759bce3616e3250b27ce033"]
},
"error": null
}
Retrieves the bft latest irreversible block
args:
no need args
curl:
curl -X POST -d '{"id": 1, "method": "Dpos.GetConfirmedBlockNumber", "params": []}' http://localhost:8000
result:
{
"id": 1,
"result": "0x3779",
"error": null
}
Retrieves the bft latest irreversible block
args:
no need args
curl:
curl -X POST -d '{"id": 1, "method": "Dpos.GetBFTConfirmedBlockNumber", "params": []}' http://localhost:8000
result:
{
"id": 1,
"result": "0x3966",
"error": null
}