Blockchain

Block.io: Bitcoin API and More

Withdrawal Methods

Overview

Block.io eases your burden of storing information regarding users’ addresses, and labels. Below, we provide various methods that allow you to make fine-grained transactions using your addresses. You can prepare transactions using any or specific addresses, or labels. You can send the specified amounts to up to 2500 destination addresses, or labels in a single API call.

Minimum Amounts You can prepare transactions for sending at least 0.02 DOGE, 0.00002 BTC, or 0.0002 LTC.

Block.io Fees Block.io does not charge fees (unless otherwise noted on the Settings page). You always pay your own network fees, however, which are in addition to the withdrawal amounts specified.

Network Fees The speed with which miners confirm your transaction depends on the network fees you pay, and the network fees you pay depend on the size of your transaction (in bytes). Larger transactions incur higher network fees. You can specify the priority for your transactions using an additional parameter priority={low,medium,high,custom} to adjust the network fee you wish to pay. Block.io will adjust appropriate network fees for priority={low,medium,high} automatically by monitoring the state of the relevant network. You can specify custom network fees using the parameters priority=custom and custom_network_fee=CUSTOM_NETWORK_FEE.

Transaction Batching You can send coins to upto 2500 destination addresses in a single transaction. We recommend using a single transaction to send coins to multiple recipients, wherever possible. This allows you to incur lower network fees overall, improves confirmation times for your transactions, as well as the health of the relevant network and its blockchain.

Ensuring Uniqueness of Withdrawals Since each transaction is created by you client-side, and signed by you client-side, you will monitor your own application’s logic to ensure uniqueness of transactions.

Sequential vs. Parallel Execution When you prepare transactions, Block.io provides appropriate data for you to construct transactions client-side. If you execute transactions in parallel, you might be using the same coins (inputs) in two or more transactions. This will cause your transactions to fail (an error from Block.io when you submit signed transactions to Block.io) since each input can only be used once. To avoid this pitfall, you will execute your transactions sequentially (i.e., one after the other), rather than in parallel (i.e., simultaneously).

Process for Executing Transactions (“Withdrawals”)

When you wish to transact using your addresses (“withdraw coins”), you will perform the following steps:

1. Preparing Transaction You will first ask Block.io for data appropriate to create a transaction. You do this by supplying source addresses (addresses to withdraw coins from), destination addresses (addresses to which you wish to send coins), and optionally the transaction’s priority for network fees, or custom network fees you wish to pay for your transaction. You do not need Block.io for this data since you can get this from any other source you deem fit yourself. However, the latter may be complicated for users.

2. Inspecting Prepared Transaction Data You will then inspect the data with which you will create your transaction. This means you are responsible for assuring the coins you spend (“inputs”), the coins to be received by a destination (“outputs”), network fees, etc. are as you wish them.

3. Creating and Signing Transaction You will then use the set of inputs and outputs you’ve prepared to create the transaction using the Bitcoin, Litecoin, Dogecoin, etc. networks’ protocols. This is made easier by Block.io through our reference libraries for creating transactions client-side. Additionally, if you are not providing private keys yourself, your software will decrypt the appropriate private keys client-side using your Secret PIN, and then sign the transaction you’ve created.

4. Submitting the Transaction The unsigned transaction, and signatures you’ve generated in the previous step can then be submitted to Block.io. Block.io will double-check to ensure you are not accidentally paying exorbitant network fees, and that the signatures you’ve generated for your transaction are appropriate for the relevant network. If all tests pass, Block.io will append its own key’s signature to your transaction if you only partially signed the transaction. Once the transaction you generated is fully signed, it will be broadcast to the relevant coin’s peer-to-peer network. For fully signed transactions, you can submit your transaction to the appropriate peer-to-peer network yourself, without using Block.io’s infrastructure.

Prepare Transaction

Retrieve data to send coins from any addresses in your account to up to 2500 destination addresses.

$block_io->prepare_transaction(array(‘amounts’ => ‘AMOUNT1,AMOUNT2,…’, ‘to_addresses’ => ‘ADDRESS1,ADDRESS2,…’));

Prepare Transaction using Custom Network Fee

Retrieve data to send coins from any addresses in your account to up to 2500 destination addresses. Use custom network fee.

$block_io->prepare_transaction(array(‘amounts’ => ‘AMOUNT1,AMOUNT2,…’, ‘to_addresses’ => ‘ADDRESS1,ADDRESS2,…’, ‘priority’ => ‘custom’, ‘custom_network_fee’ => ‘CUSTOM_NETWORK_FEE’));

Prepare Transaction using Specific Source Addresses

Retrieve data to send coins from up to 2500 addresses, to up to 2500 destination addresses.

$block_io->prepare_transaction(array(‘amounts’ => ‘AMOUNT1,AMOUNT2,…’, ‘from_addresses’ => ‘ADDRESS1,ADDRESS2,…’, ‘to_addresses’ => ‘ADDRESS1,ADDRESS2,…’));

Prepare Transaction using Specific Source Address Labels

Retrieve data to send coins from up to address labels, to up to 2500 destination addresses, or addresses labels.

$block_io->prepare_transaction(array(‘amounts’ => ‘AMOUNT1,AMOUNT2,…’, ‘from_labels’ => ‘LABEL1,LABEL2,…’, ‘to_addresses’ => ‘ADDRESS1,ADDRESS2,…’)); $block_io->prepare_transaction(array(‘amounts’ => ‘AMOUNT1,AMOUNT2,…’, ‘from_labels’ => ‘LABEL1,LABEL2,…’, ‘to_labels’ => ‘LABEL1,LABEL2,…’));

The amounts=AMOUNT1,AMOUNT2,… and to_addresses=ADDRESS1,ADDRESS2,… parameters specify that destination ADDRESS1 will receive AMOUNT1, ADDRESS2 will receive AMOUNT2, etc. The source addresses (from_addresses=…) will need at least SUM(AMOUNT1,AMOUNT2…)+Network Fees in balances for this withdrawal to succeed.

Summarize Prepared Transaction

This SDK-only method will generate a summary of the transaction you prepared so you know what amounts you’re sending, the network fees you’re paying, and the Block.io fees you’re paying. You will inspect the response from prepare transaction API calls yourself; this is just a summary of the data before you create the transaction client-side.

$block_io->summarize_prepared_transaction(PREPARE_TRANSACTION_API_RESPONSE);

Create and Sign Transaction

You will use the inputs, outputs, encrypted user key, input address data from the prepare transaction API responses.

$block_io->create_and_sign_transaction(PREPARE_TRANSACTION_API_RESPONSE);

Submit Transaction

Once you have created the transaction client-side, and signed it client-side, you can submit it to Block.io for additional signatures and/or broadcasting to the peer-to-peer blockchain network.

$block_io->submit_transaction(array(‘transaction_data’ => CREATE_AND_SIGN_TRANSACTION_RESPONSE));

Estimate Network Fee

Estimates the Network Fee you will need to pay when you execute a transaction. The Network Fee is required by the blockchain network, not Block.io.

When you change withdrawal parameters, the estimated network fees or lower/upper bounds for custom network fee may change as well.

Please use the same parameters as you would with any prepare transaction API call; only one example is given below.

$block_io->get_network_fee_estimate(array(‘amounts’ => ‘AMOUNT1,AMOUNT2,…’, ‘to_addresses’ => ‘ADDRESS1,ADDRESS2,…’));

Related Articles

Back to top button

Adblock Detected

Please consider supporting us by disabling your ad blocker