Enable any website to instant purchase or sale of digital assets and cryptocurrencies via ShapeShift Skeleton

What is ShapeShift

ShapeShift is a service which allow users to specify the currency they want to exchange and where to send the exchanged coins to. In a first step, user receives a public address he or she has to deposit to, and specifies where to send exchanged assets to. In a second step, user deposits the asset to the provided address, and in the last step ShapeShift is responsible to send different type of assets back on the agreed exchange rate, as soon as they receive users deposit. Exchange rate itself has an expiration time, and will not change until it will expire.

If business owner would like to integrate such a solution to their website, one of the best candidates is a ShapeShift Skeleton – simple widget which allows instant purchase or sale of digital assets and cryptocurrencies. Widget itself is an open-source, and allows users to exchange assets without leaving the site. In addition, template for this widget allows developers to customize the look and feel of the tool, to match particular look and feel of their product.

Installation

Go to ShapeShift github, clone the repo, install the dependencies, and run the server. From command line it would look as following:

git clone https://github.com/Shapeshift-Public/ShapeShift-Skeleton
cd ShapeShift-Skeleton # clones the repo locally
npm install # installs dependencies from package.json
npm install -g bower # installs bower (if you do not have it installed already)
bower installs # installs web dependencies
node dev-server.js # runs a dev server

Code is open sourced and could be found here

Usage

If you will go to http://localhost:3000 in your browser, you should see this:

skeleton-initial-screen.png

Default exchange is from BTC to LTC (Bitcoin to Litecoin), there are many more assets/currencies, 60+ at the moment of writing, including ETH, ETC, BCH, XMR, DASH, ZEC, NEO and many ERC20 tokens, such as ANT, BAT, OMG, etc.

Return Address field is used to return the deposited funds if the exchange failed.

Withdrawal Address is the destination of the funds you want to exchange.

Amount is the how much you want to receive.

After pressing Shift button, you should see:

skeleton-deposit-waiting.png

Under the hood, widget made a request to ShapeShift API, providing the withdrawal address, amount and return address, and got following response:

skeleton-api-call.png

Now user has to deposit requested amount of Ether (0.04566097 in our case) to receive 0.001 BTC to the Withdrawal Address. Notice the expiration field, which gives a user just a few minutes to make a deposit, otherwise it will fail, and funds will be returned to the Return Address.

Customization

In the template directory, you will find templates to customize look and feel for coin selector, shift button, deposit info and potential error information, to make sure that integrated solution matches your website.

About the Author

Posted by

Categories:

Projects
%d bloggers like this: