Aspire Exchange Integration
By adding support for Aspire (ASP) and it’s underlying blockchain gAsp (GASP), your exchange gets the GASP and ASP community and market support. Additionally your exchange will now have the ability to easily add market support for any other asset created on Aspire.
Explore: AspireAssets
Technically, the process is rather straightforward. However, as Aspire is not a fork of Bitcoin Core, adding Aspire support to your exchange is slightly different from adding support for a cryptocurrency that is, like Litecoin or Dogecoin.
We’ve outline the general process below for ASP, but the process is identical for all Aspire assets
Aspire Exchange Integration
Basic Set-up
Aspire Exchange Integration
Handling Deposits using Separate Addresses
- Create a regular GASP address for each user wanting to deposit GASP or ASP using the API of the GASP Core instance that
aspire-server
is connecting to. - Poll for deposits using
get_sends
API method, filtering forasset==ASP
,destination==deposit_address
andblock_index<=current_block_index-number_of_desired_confirmations
. Record the quantity of the send transaction and the transaction’stxid
. - ‘Prime’ the deposit address by sending it 0.0005 GASP. (1 GASP Should easily cover 1900 users for a long time.)
- For deposit, send the quantity deposited to the holding address using the
do_send
API method with the flagunconfirmed=True
(so you don’t have to wait for the priming to confirm). Record thetxid
of this transaction. - When the second send is confirmed (poll
get_sends
again), credit the user’s account balance.
Aspire Exchange Integration
Handling Deposits using Memo Transactions
- Create a GASP deposit address. The address will hold deposited GASP and ASP funds for all users using the exchange.
- ‘Prime’ the deposit address by sending it 0.0005 GASP. (1 GASP Should easily cover 1900 users for a long time.)
- Make the deposit address require a memo by broadcasting
OPTIONS 1
from that address. The value and fee_fraction can be 0. - When a user wishes to deposit to your exchange, generate a unique hexadecimal invoice ID for the deposit and convey that to the user. The user must send Aspire assets into the address along with the matching invoice ID in the memo field. If the user fails to include a memo, the send will be rejected by the network and the user’s address will retain the assets they sent.
- Poll for deposits using
get_sends
API method, filtering forasset==ASP
,destination==deposit_address
andblock_index<={current_block_index-number_of_desired_confirmations}
andmemo_hex=={invoice_id}
. Record the quantity of the send transaction and the transaction’stxid
. - When the send is confirmed with 2 confirmations (poll
get_sends
again), credit the user’s account balance. - Memo transactions are available as of block height 1.
Aspire Exchange Integration
Handling Withdrawals
- Prime the holding address if its current balance is below 0.0005 GASP (1 GASP Should easily cover 1900 users for a long time).
- Send the funds to the user-provided address with
create_send
(Aspire API).
Aspire Exchange Integration
Best Practices
- For deposits, wait for at least two confirmations on the send to the deposit address and one confirmation for the send to the holding address.
- Keep the private key for the holding address secret and safe.
- Keep the bulk of your exchange’s funds in cold storage.
- Set a maximum ASP and GASP withdrawal amount, both per day and per event.