Simplewallet BLOC API allow you to integrate BLOC Payement into e-commerce or physical store to operate the funds and accept deposits using only one address and Payment ID method.
BLOC JSON RPC API
BLOC E-Commerce and automated services solution
The cryptocurrency BLOC has unfolded and advanced a set of key methods to portray universal and integrated access to act as an alternative or replace the current banking system in regards to the expensive and restricted POS contactless terminals. BLOC is providing an open platform that enables companies to build their own products using the BLOC API. Enter the URL of the API where to connect to. Make sure you enter it exactly like on the exemple, then enter the RPC password. Test the implementation in your application using the form and exemple provided below.
Accepting BLOC payments with simplewallet
Introduction to simple wallet
BLOC integration process differes from other cryptocurrencies. Firstly, the coin has three separate binaries:
Simplewallet do not support multiple addresses assigned to one wallet, so your service or website will have one deposit address 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 SimpleWallet
Example of integration
To start integration process you should first download BLOC RPC Wallet, you can find it here: https://bloc.money/download
You may also build RPC Wallet from source code: https://github.com/furiousteam/BLOC
1. A user, willing to deposit BLOC, comes to the service. The service holds only one wallet with just one address. The service generates the 64 hexadecimal characters string and assigns to this newly arrived user. This string is the payment id, which will be required to identify all of the users payments to the service 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/receipient address (used by all the users to deposit funds).
<amount> the amount of the transaction.
[payment_id] is a unique 64 hexadecimal characters 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 0.0002 BLOC to the service/recipient address using a 64 hexadecimal characters unique identifier Payement ID :
transfer 0 abLoc6mnNn1Eczab4iywmTCKxGxWm82f9HPAG5wjTmxeNMu9WTNiD13hYkXc71ES4hLBxJJC5irWmYYJ4KEvcgjMM6qUG1RtnMn 0.0002 -p 1C5B1C57BE57797CCBBC3AA525703FDD6DFC90E9FA1B3D1C0E546AF9E05B69DF
2. The user opens his simplewallet and uses the above mentioned command to deposit the funds.
3. The service uses BLOC SIMPLEWALLET JSON RPC API to get the payment info from its simplewallet. The request is: "get_payments", with a parameter payment_id=. E.g.:
The response will contain all the payments with the corresponding payment id. Each of the elements contains the following fields:
Simplewallet command line arguments and commands
Command line arguments and commands
simplewallet [--wallet-file=<file>|--generate-new-wallet=<file>] [--remote-daemon=<host>:<port>] [<COMMAND>]
--help Produce help message
--version Output version information
--generate-new-wallet arg Generate new wallet and save it to <arg> or <address>.wallet by default --set_log arg set log level (0-4) --testnet Used to deploy test nets. The daemon must be launched with --testnet flag --remote-daemon <url> Connect to the remote daemon at <url:port> using RPC Port --wallet-file <file> Open the wallet <file> --password <pass> Use the password <pass> to open the wallet --legacy-security Enable legacy mode (no password for RPC). WARNING: INSECURE. USE ONLY AS A LAST RESORT --rpc-bind-ip Upecify ip to bind rpc server --rpc-bind-port Starts wallet as rpc server for wallet operations, sets bind port for server --rpc-password Specify the RPC password to connect to the wallet using RPC calls
|Command||Description||Arg 1||Arg 2||Arg 3||Arg 4||Arg 5|
|help||Print help on wallet commands||-||-||-||-||-|
|reset||Discard cache data and start synchronizing from scratch||-||-||-||-||-|
|bc_height||Show blockchain height||-||-||-||-|
|balance||Show current wallet balance||-||-||-||-||-|
|export_keys||Export private view key and private spend key||-||-||-||-||-|
|address||Show current wallet public address||-||-||-||-||-|
|exit||Exit and save wallet||-||-||-||-||-|
|save||Save wallet synchronized data||-||-||-||-||-|
|incoming_transfers||Show incoming transfers||-||-||-||-||-|
|outgoing_transfers||Show outgoing transfers||-||-||-||-||-|
|list_transfers||Show all known transfers||-||-||-||-||-|
|quick_optimize||Quickly optimize your wallet to send large amounts||-||-||-||-||-|
|full_optimize||Fully optimize the wallet to send large amounts||-||-||-||-||-|
|transfer||Transfer amount to address with mixin_count (number of transactions yours is indistinguishable from)||[uint] mixin_count||[string] address||[double] amount||[string] -p payment_id||[double] -f fee|
|payments||Show payments with the corresponding payment_id. You may indicate more than one payment_id.||[string] payment_id||-||-||-||-|
|set_log||Change current log detailization level.>||[uint] log level (0 - 4)||-||-||-||-|
Simplewallet JSON RPC API
Use the form below to test the integration of the simplewallet BLOC API into your application. Make sure you have filled the connexion details at the top of this page.
To start BLOC simplewallet JSON RPC API server you should specify a port on which server binds (additionally to standard wallet arguments). You can choose any free port. To do that execute the following command from the command line:
./simplewallet_rpc --wallet-file mywallet --password mypassword --rpc-bind-ip=127.0.0.1 --rpc-bind-port 2053 --rpc-password myrpcpassword
Having done that youre ready to operate with the wallet through the following API URLs (e.g., your IP address is 188.8.131.52):
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 0.0001 BLOC
|destinations||yes||array that contains:
"address": "abLoc7qZYJd7cWysPQRivNNMQMFgkXNPgiQXN1i2 twdUWvwr2XMbxsAbwdL3eJjCMSgs8oWyGx7pHCX8jWHrKi8Mea333MTu"
|fee||yes||transaction fee. Minimal fee in BLOC network is 0.0001 BLOC. This parameter should be specified in minimal available BLOC units. For example, if your fee is 0.0001 BLOC, you should pass it as 1||uint64||1|
|unlock_time||yes||height of the block until which transaction is going to be locked for spending.||uint64||0|
get_payments() - Receives all the payments with a corresponding payment_id that were sent to the wallet. This method is used to get the BLOC payments for the 3rd party services. As simplewallet uses only one address to receive BLOC deposits, a unique payment_id (64 hexadecimal characters) should be assigned and shown to each user. The method will return all the payments for this user.
reset() - Erases simplewallet's internal state but keeps safe the wallet file. 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
|it requires no extra parameters|