Quick Start Guide

This document is written for users who wants to test and use Coinstack as soon as possible. If you want to request a detailed description of each step below, please refer to the detailed document respectively. Let's build a briliant service using Coinstack.

1. Issue API Key

If you want to use Coinstack, an API key should be prepared, which is issued at Coinstack Dashboard after creating an account.

Java, Node, and Meteor use an access key and secret key, and REST API such as cURL, etc. uses an access token.

For more details on the authentication, see Chapter 4. Authentication.

2. Java

JDK 1.6 or higher version should be prepared for Java SDK of Coinstack, and SDK can be installed by Maven.

If Maven repository is official, the recent version of SDK could be installed by searching 'coinstack' or using the link below. http:\/\/www.mvnrepository.com\/artifact\/io.blocko

<dependency>
    <groupId>io.blocko</groupId>
    <artifactId>coinstack</artifactId>
    <version>3.0.23</version>
</dependency>

For example, You can create CoinStackClient object using an arbitrary access key and secret key assuming that is from Coinstack Dashboard.

Java
import io.blocko.coinstack.*
import io.blocko.coinstack.model.*

CoinStackClient client = new CoinStackClient(new CredentialsProvider() {
            @Override
            public String getAccessKey() {
                return "YOUR_COINSTACK_ACCESS_KEY";
            }

            @Override
            public String getSecretKey() {
                return "YOUR_COINSTACK_SECRET_KEY";
            }
        }, Endpoint.MAINNET);

You can check the status of Blockchain and print the block number and hash value of the latest block.

Java
BlockchainStatus status = client.getBlockchainStatus();
System.out.println(status.getBestHeight());
System.out.println(status.getBestBlockHash());

You can check the balance in specific Blockchain address and print it by Satoshi. 1 Satoshi = 0.00000001 Bitcoin.

Java
long balance = client.getBalance("YOUR_BLOCKCHAIN_ADDRESS");
System.out.println(balance);

You can test the same example with Node and Meteor below.

3. Node

Using npm package manager, Coinstack Node SDK can be installed.

Shell
npm install coinstack-sdk-js
JavaScript
var CoinStack = require('coinstack-sdk-js')

var accessKey = "YOUR_COINSTACK_ACCESS_KEY";
var secretKey = "YOUR_COINSTACK_SECRET_KEY";
var client = new CoinStack(accessKey, secretKey);
client.getBlockchainStatus(function(err, status) {
    console.log(status.best_height);
    console.log(status.best_block_hash);
});

client.getBalance("YOUR_BLOCKCHAIN_ADDRESS", function(err, balance) {
    console.log(balance);
});

4. Meteor

Using atmosphere package manager, Coinstack Meteor SDK can be installed.

Shell
meteor add shepelt:coinstack
JavaScript
var accessKey = "YOUR_COINSTACK_ACCESS_KEY";
var secretKey = "YOUR_COINSTACK_SECRET_KEY";
var client = new CoinStack(accessKey, secretKey);
var status = client.getBlockchainStatusSync();
console.log(status.best_height);
console.log(status.best_block_hash);
client.getBalance("YOUR_BLOCKCHAIN_ADDRESS", function(err, balance) {
    console.log(balance);
});

results matching ""

    No results matching ""