¡Esta es una revisión vieja del documento!
Habilitar servicio de la billetera:
prosus-wallet --rpc-bind-port=16191 --wallet-file=archivowallet --password=contraseña
Para comprobar si el servicio funciona:
http://localhost:16191/json_rpc
Los métodos vigentes están en https://github.com/ProsusCorp/prosus.money/blob/master/cli/src/Wallet/WalletRpcServer.cpp
- getbalance
- transfer
- store
- stop_wallet
- get_payments
- get_transfers
- get_transaction
- get_height
- get_address
- query_key
- reset
Please note, there is no "refresh" RPC method. RPC wallet refresh is performed automatically each 20 seconds.
getbalance
Return balance.
URL:
/json_rpc
Input:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Prosus.Money wallet api",
"description": "Schema for transfer method in Prosus.Money wallet",
"type": "object",
"properties" : {
"jsonrpc" : {
"type" : "string"
},
"method" : {
"type" : "string"
}
}
}
Output:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Prosus.Money wallet api",
"description": "Schema for transfer method in Prosus.Money wallet",
"type": "object",
"properties" : {
"locked_amount" : {
"type" : "integer"
},
"available_balance" : {
"type" : "integer"
}
}
}
transfer
Transfer money to several destinations with specified fee, mixin ambiguity degree, and unlock time.
Please note: fee param is a mandatory and should not be less than current minimal fee which can be obtained from node.
URL:
/json_rpc
Input:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Prosus.Money wallet api",
"description": "Schema for transfer method in Prosus.Money wallet",
"type": "object",
"properties" : {
"jsonrpc" : {
"type" : "string"
},
"method" : {
"type" : "string"
},
"destinations" : {
"type" : "array",
"items" : {
"amount" : {
"type" : "integer"
},
"address" : {
"type" : "string"
}
},
"minItems" : 1
},
"payment_id": {
"type" : "string"
}
"fee" : {
"type" : "integer"
},
"mixin" : {
"type" : "integer"
},
"unlock_time" : {
"type" : "integer"
"description" : "Unix timestamp"
}
}
}
Output:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Prosus.Money wallet api",
"description": "Schema for transfer method in Prosus.Money wallet",
"type": "object",
"properties" : {
"tx_hash" : {
"type" : "string"
},
"tx_key" : {
"type" : "string"
},
}
}
store
Store wallet data.
URL:
/json_rpc
Input:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Prosus.Money wallet api",
"description": "Schema for transfer method in Prosus.Money wallet",
"type": "object",
"properties" : {
"jsonrpc" : {
"type" : "string"
},
"method" : {
"type" : "string"
}
}
}
Output:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Prosus.Money wallet api",
"description": "Schema for transfer method in Prosus.Money wallet",
"type": "object",
"properties" : {}
}
reset
Erases simplewallet's internal state but keeps safe the wallet.bin. The method should be used to re-synchronize the wallet from scratch. The next refresh (which is automatically called each 20 seconds) will update the simplewallet state.
URL:
/json_rpc
Input:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Prosus.Money wallet api",
"description": "Schema for transfer method in Prosus.Money wallet",
"type": "object",
"properties" : {
"jsonrpc" : {
"type" : "string"
},
"method" : {
"type" : "string"
}
}
}
Output:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Prosus.Money wallet api",
"description": "Schema for transfer method in Prosus.Money wallet",
"type": "object",
"properties" : {}
}
get_payments
Receives all the payments with a corresponding payment_id that were sent to the wallet. This method is used to get the xPR (prosus) payments for the 3rd party services. As Prosus.Money uses only one address to receive xPR deposits, a unique payment_id should be assigned and shown to each user. The method will return all the payments for this user.
URL:
/json_rpc
Input:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Prosus.Money wallet api",
"description": "Schema for transfer method in Prosus.Money wallet",
"type": "object",
"properties" : {
"jsonrpc" : {
"type" : "string"
},
"method" : {
"type" : "string"
},
"payment_id" : {
"type" : "string"
}
}
}
Output:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Prosus.Money wallet api",
"description": "Schema for transfer method in Prosus.Money wallet",
"type": "object",
"properties" : {
"payments" : {
"type" : "array",
"items" : {
"amount" : {
"type" : "integer"
},
"block_height" : {
"type" : "integer"
},
"tx_hash" : {
"type" : "string"
},
"unlock_time" : {
"type" : "integer"
}
}
}
}
}
get_transfers
Returns the list of all the wallet's incoming and outgoing transfers.
URL:
/json_rpc
Input:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Prosus.Money wallet api",
"description": "Schema for transfer method in Prosus.Money wallet",
"type": "object",
"properties" : {
"jsonrpc" : {
"type" : "string"
},
"method" : {
"type" : "string"
}
}
}
Output:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Prosus.Money wallet api",
"description": "Schema for transfer method in Prosus.Money wallet",
"type": "object",
"properties" : {
"result" : {
"type" : "transfers"
"transfers" : {
"type" : "array",
"items" : {
"address" : {
"type" : "string"
},
"amount" : {
"type" : "integer"
},
"blockIndex" : {
"type" : "integer"
},
"fee" : {
"type" : "integer"
},
"output" : {
"type" : "boolean"
},
"paymentId" : {
"type" : "string"
},
"time" : {
"type" : "integer"
},
"transactionHash" : {
"type" : "string"
},
"unlockTime" : {
"type" : "integer"
},
}
}
}
}
}
get_height
Returns the last top known block height for simplewallet. This method can be used to verify that simplewallet is correctly synchronized.
URL:
/json_rpc
Input:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Prosus.Money wallet api",
"description": "Schema for transfer method in Prosus.Money wallet",
"type": "object",
"properties" : {
"jsonrpc" : {
"type" : "string"
},
"method" : {
"type" : "string"
}
}
}
Output:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Prosus.Money wallet api",
"description": "Schema for transfer method in Prosus.Money wallet",
"type": "object",
"properties" : {
"height" : {
"type" : "integer"
}
}
}
get_transaction
Returns the transaction details.
URL:
/json_rpc
Input example:
{
"jsonrpc":"2.0",
"id":"test",
"method":"get_transaction",
"params":{
"tx_hash":"b0285cacb20ec402d56e4b87f629afc5ee6b19cf7a790a226173cb03c2615a31"
}
}
Output example:
{
"id":"test",
"jsonrpc":"2.0",
"result":{
"destinations":[
{
"address":"Prosus2uvk3GCQ2SSHd3w9RjKRjkcHPJL7mKSy25twnH5nxSxehzad7WSUTfZob83dU59K8ojrd3PidXSkMDfrj1KhkJ4Lpt5e14A",
"amount":2010542676062
},
{
"address":"Prosus1EFCREFuMHPwWTJ217xsTcEdgqqTBsnuvZtk6ujYnXBkwHSNHAgH3ajVGRJLTfSAKLRxDH4EdVNQtYcNJM97ycCSJCSwA4pA",
"amount":57000000000
}
],
"transaction_details":{
"address":"Prosus23GCQ2SSHd3w9RjKRjkcHPJL7mKSyuvk25twnH5nxSxehzad7WSUTfZob83dU59K8ojrd3PidXSkMDfrj1KhkJ4Lpt5e14",
"amount":2124542676062,
"blockIndex":271652,
"confirmations":25433,
"fee":57000000000,
"output":true,
"paymentId":"",
"time":1536706367,
"transactionHash":"b0285cacb20ec402d56e4b87f629afc5ee6b19cf7a790a226173cb03c2615a31",
"txKey":"d2854e0414154881005254e6a80f94db7248712a7f4e212c1100519a673a48a3",
"unlockTime":0
}
}
}
get_address
Returns the wallet's public address.
URL:
/json_rpc
Input example:
{
"jsonrpc":"2.0",
"id":"test",
"method":"get_address",
"params":{
}
}
Output example:
{
"id":"test",
"jsonrpc":"2.0",
"result":{
"address":"Prosus1uvk3GCQ2SSHd3w9RjKRjkcHPJL7mKSy25twnH5nxSxehzad7WSUTfZob83dU59K8ojrd3PidXSkMDfrj1KhkJ4Lpt5e14"
}
}
get_paymentid
Returns the new randomly generated Payment ID.
URL:
/json_rpc
Input example:
{
"jsonrpc":"2.0",
"id":"test",
"method":"get_paymentid",
"params":{
}
}
Output example:
{
"id":"test",
"jsonrpc":"2.0",
"result":{
"payment_id":"f373ff6def6499f7984d448808f5f24221fc690c231b76e6916b4c00cffe439b"
}
}
get_tx_key
Returns the transaction's secret key if it is stored in wallet's cache; which can be used to prove that you paid the receiver. The transaction ID and the receiver's public address are also needed as a parameter.
URL:
/json_rpc
Input example:
{
"jsonrpc": "2.0",
"id": "test",
"method": "get_tx_key",
"params": {
"tx_hash": "F86EF58C98C724C2261F3EB009B47E475472F75D3B4B2FF0FC749D607367090D"
}
}
Output example:
{
"id":"test",
"jsonrpc":"2.0",
"result":{
"tx_key":"f0eede5679da2c9cfcd06fb1961d64316e0d4dc54a308247319cb25220bf9503"
}
}
query_key
Returns the wallets private keys. Key type should be passed in params. Available key types: paperwallet
and mnemonic
.
URL:
/json_rpc
Input example:
{
"jsonrpc": "2.0",
"id": "test",
"method": "query_key",
"params": {
"key_type": "mnemonic"
}
}
Error output example:
{
"error":{
"code":-1,
"message":"The wallet is non-deterministic. Cannot display seed."
},
"id":"test",
"jsonrpc":"2.0"
}
Output example:
{
"id":"test",
"jsonrpc":"2.0",
"result":{
"key":"KaqCQ..."
}
}
estimate_fusion
Returns the fusion ready outputs count. Parameter threshold
should be passed with threshold amount to optimize. If it is not passed it will estimate with default dust threshold.
URL:
/json_rpc
Input example:
{
"jsonrpc": "2.0",
"id": "test",
"method": "estimate_fusion",
"params": {
"threshold":100000000
}
}
Output example:
{
"id": "test",
"jsonrpc": "2.0",
"result": {
"fusion_ready_count": 101
}
}
send_fusion
Optimize wallet (fuse many small outputs into fewer larger ones) to be able to send large amounts in a single transaction as with smaller inputs count its size will be smaller.
URL:
/json_rpc
Input:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Prosus.Money wallet api",
"description": "Schema for send fusion transaction method in Prosus.Money wallet",
"type": "object",
"properties" : {
"jsonrpc" : {
"type" : "string"
},
"method" : {
"type" : "string"
},
"threshold" : {
"type" : "integer"
},
"mixin" : {
"type" : "integer"
},
"unlock_time" : {
"type" : "integer"
"description" : "Unix timestamp"
}
}
}
Output:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Prosus.Money wallet api",
"description": "Schema for send fusion transaction method in Prosus.Money wallet",
"type": "object",
"properties" : {
"tx_hash" : {
"type" : "string"
}
}
}
Examples
getbalance
{
"jsonrpc": "2.0",
"method": "getbalance",
"params": {}
}
transfer
Please note, payment_id is an optional argument and can be left out.
{
"jsonrpc":"2.0",
"method":"transfer",
"params":{
"destinations":[
{
"amount":11111,
"address":"Prosus1uvk3GCQ2SSHd3w9RjKRjkcHPJL7mKSy25twnH5nxSxehzad7WSUTfZob83dU59K8ojrd3PidXSkMDfrj1KhkJ4Lpt5e14"
},
{
"amount":22222,
"address":"Prosus2GCQ2SSHd3w9RjKRjkcHPJL7mKSy25twnH5nuvk3xSxehzad7WSUTfZob83dU59K8ojrd3PidXSkMDfrj1KhkJ4Lpt5e14"
}
],
"payment_id":"",
"fee":1000000,
"mixin":0,
"unlock_time":0
}
}
store
{
"jsonrpc": "2.0",
"method": "store",
"params": {}
}
reset
{
"jsonrpc": "2.0",
"method": "reset",
"params": {}
}
get_payments
{
"jsonrpc":"2.0",
"method":"get_payments",
"params":{
"payment_id": "78cc4b76a48bd50ab955ac61a0c04e4a82079fbcf27298f87b39c76aefccbcc9"
}
}
get_transfers
{
"jsonrpc": "2.0",
"method": "get_transfers",
"params": {}
}
get_height
{
"jsonrpc": "2.0",
"method": "get_height",
"params": {}
}
send_fusion
Input example:
{
"jsonrpc": "2.0",
"id": "test",
"method": "send_fusion",
"params": {
"threshold":100000000,
"mixin":3,
"unlock_time":0
}
}
Output example:
{
"id": "test",
"jsonrpc": "2.0",
"result": {
"tx_hash": "2bc081ba8fcd29ce254d0db28c5568489be19121be74d5a2577dbf969330eb30"
}
}