Accepting Bytecoin payments with simplewallet

From Bytecoin Wiki
Jump to: navigation, search

Bytecoin integration process differes from other cryptocurrencies. Firstly, the coin has two separate binaries:

bytecoind — to synchronize with the block chain and mine Bytecoins.

simplewallet — to operate the funds and accept deposits.

Secondly, as of now Bytecoin doesn't support multiple addresses assigned to one wallet, so your service or website will have one deposit addresses for all the users. In order to identify the payments, you have to analyze the payment_id in the "extra" field of the transfer.

Integration guide

1. A user, willing to deposit Bytecoin, comes to the service. The service holds only one wallet with just one address. The service generates the 32-byte (256-bit) sequence, transforms it into a string and assigns to this newly arrived user. This string is the payment id, which will be required to identify all of the user's payments to the service's wallet.

The user is required to indicate this payment id each time he deposits the money.

transfer <mixin_amount> <address> <sum> [-p payment_id]

<mixin_amount> identifies the level of anonymity of the payment, but using 0 is just fine in most cases.

<address> is the service's address (used by all the users to deposit funds).

<sum> is the deposit sum.

[payment_id] is a unique 32-byte identifier of the user assigned by the sevice, which should be indicated after "-p".

The service may also provide the user with the exact payment command (which should be used in simplewallet). Below is the example of such a command, which will transfer 100000 BCN to the service's address 24MU...wkB:

transfer 0 24MUWTSatNeTx4nGwVwn8tdVDorJD6esSThZa17cVzCL8ZDC7YeZwaxibsyepc6MAK9pKSg4cHAd1Yd2MFwWTQxcFAkhwkB 100000 
-p 852adfb2894f72d204926ced238fbe085885e862c5b394f9102 42f675a859c71

2. The user opens his simplewallet and uses the above mentioned command to deposit the funds.

3. The service uses Bytecoin's Wallet JSON RPC API to get the payment info from its simplewallet. The request is: "get_payments", with a parameter payment_id=. E.g.:

	params": {
 		payment_id": "852adfb2894f72d204926ced238fbe085885e862c5b394f910242f675a859c71"

The response will contain all the payments with the corresponding payment id. Each of the elements contains the following fields:

"amount": 300000000, 
"block_height": 144, 
"tx_hash": "78cc4b76a48bd50ab955ac61a0c04e4a82079fbcf27298f87b39c76aefccbcc9", 
"unlock_time": 0
Personal tools