Habilitar servicio de la billetera:

prosus-wallet --rpc-bind-port=16191 --wallet-file=archivowallet --password=clavewallet --rpc-user=usuario --rpc-password=contrasena 

Para comprobar si el servicio funciona:

  http://usuario:contrasena@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
  • get_paymentid

Tenga en cuenta que no existe un método RPC para “actualización”. La actualización de los datos RPC de la billetera se realiza automáticamente cada 20 segundos.

Para ver ejemplos de uso, en distintos lenguajes de programación, visita nuestro repositorio GitHub


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"
   }
}

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..."
   }
}