CryptoCoinsInfoClub.com

Blockchain Javascript Api

How To Create An Application On Blockchain Using Hyperledger

How To Create An Application On Blockchain Using Hyperledger

How to create an application on blockchain using Hyperledger We are going to build a digital bank using Hyperledger Composer. It will have customers and accounts. At the end of it, youll be able to transfer funds and record all transactions on blockchain. Well expose a RESTful API for the same, so that even a person who has no clue what blockchain is can make a beautiful user interface (UI) around it. Well also create this applications UI in Angular. Im super excited to share this step-by-step guide with you. So lets get started right away! Source: When I was first coding this out, I ran into errors. Lots and lots of them. But I think thats good, because it made me learn a lot of things. Errors are essential. I got to a point where I felt switching it on and off would make things better. It almost made me lose my mind, but its an integral part in every hackers life. Before getting started, you need to ensure that the machine youre using is equipped with the required configurations. You may need to download certain prerequisites and set up a basic dev environment. Below are the links to do that. Follow those steps before starting to develop an application, otherwise youll definitely run into stupid errors. First install the Hyperledger composer . Then install the development environment . Theres no need to start Playground while youre installing the environment. Make sure docker is running, and when you run./startFabric.sh its going to take a couple of minutes. So be patient. Now that your machine is all set, we can start coding! Source: Our Business Network Definition (BND) consists of the data model, transaction logic, and access control rules. The data model and access control rules are coded in domain specific language (which is very simple to catch up with). The tr Continue reading >>

Block.io: Bitcoin Api And More

Block.io: Bitcoin Api And More

Block.io does not control your addresses, you do. You use the Blockchain to process your own assets. Processing a transaction on your website takes only a few steps: When a user owes you coins, create an address on Block.io for them by calling get_new_address. You can use a label to identify this transaction. For instance, get_new_address with label=useridXdonutsXdate. The get_new_address call will generate a new transaction address. Give them the new address so they can send you coins/assets. You can now check if the user has sent the transaction by calling get_address_balance for the above label. If the coin balance returned is the amount you requested from your user, you can give them their merchandize. Simple. When presenting the address to your user for the transaction, it is best to use a QR Code to make the process simpler for them. You can generate QR code using various libraries, including this one for Javascript. With Block.io, you can create wallet addresses for users inside your games, auction sites, stores, etc. To create a user's wallet on your account, create addresses for them using get_new_address. You should specify a sequence of labels for that user. For instance, if we wish to create a number of addresses for User A, we'd want to call get_new_address with label=userAx{address_number} as many times as wish to create a new address for User A. Once we have addresses for User A, we can query balances for their addresses, and send coins on the user's behalf. Our Green Addresses () allow our users to transact coins instantly with enabled sites. More specifically, we ensure coins cannot be double spent, so our users can use coins without network confirmations. This removes the Blockchain confirmation delay (10min for Bitcoin, 1min for Dogecoin, etc.), whil Continue reading >>

Sample Nodejs App To Query The Ethereum Blockchain

Sample Nodejs App To Query The Ethereum Blockchain

Sample NodeJS app to query the Ethereum blockchain Had a discussion last night with some friends and was really curious how to develop applications utilising blockchain technology. I found the Ethereum API a few months back but I was not clear on how to start until last night. Eric, a former colleague, blogged about a sample on how to do it in Java using Spring Boot and Thymeleaf. One key thing in his blog was the use of the Infura API rather than spinning up a node to communicate with the Ethereum blockchain. Check out his blog "My first foray into the world of blockchain" . Inspired by all of this, I tried web3js which Eric suggested. web3js , an Ethereum Javascript API, is developed by the Ethereum team. I came up with a basic nodeJS sample below using web3js. It's basically the nodeJS version of what Eric has done in his blog . Really simple stuff but I needed to figure out things for a few hours to get it running. require('dotenv').config();var BigNumber = require('bignumber.js');var Web3 = require('web3')var web3 = new Web3(new Web3.providers.HttpProvider(process.env.API_URL));var balance = web3.eth.getBalance(process.env.ACCOUNT, function (error, result) { if (!error) { console.log(web3.utils.fromWei(new BigNumber(result), 'ether')); } else { console.error(error); } }); Continue reading >>

Chiccocoin: Learn What Is A Blockchain By Creating One Innodejs

Chiccocoin: Learn What Is A Blockchain By Creating One Innodejs

Riccardo Canella @ricanella92 Love #basket, #bike and #HIMYM since my childhood. #Fullstack #Javascript addicted Chiccocoin: Learn what is a Blockchain by creating one inNodeJS Disclaimer: chiccocoin is not a true cryptocurrency and we do not sell it, this article is for recreational / educational purposes only Every day on our feeds we find news about new cryptocurrency or someone who says that they are a big bubble that will soon explode and of which only the blockchain will remain. But, what is the blockchain? Is a continuously growing list of records, called blocks, which are linked and secured using cryptography. So, the blockchain is an immutable, sequential chain of records called Blocks. Each block can contain transactions, files or any data you like. The important thing is that theyre chained together using hashes. Blockchains are secure by design and are an example of a distributed computing system with high Byzantine fault tolerance . This makes blockchains potentially suitable for the recording of events, medical records, and other records management activities, such as identity management, transaction processing or voting. Understanding Blockchains reading article or tutorials isnt easy. Wandering among the many online guides I found this article by Daniel van Flymen and my curiosity to understand how it really worked has grown so much to try to create a blockchain using NodeJS. The first step to creating a new project is to create the logo. It makes everything real. To do this I used Squarespace logo creator and this is the result: Now we can really start with our project. To facilitate the creation of the APIs to interact with the blockchain I started the project directly with ExpressJS using the package npm express-generator Now were going to create our Continue reading >>

Blockchain Developer Api For Bitcoin, Ethereum, Testnet, Litecoin And More | Blockcypher

Blockchain Developer Api For Bitcoin, Ethereum, Testnet, Litecoin And More | Blockcypher

// _ _ // |_) | _ _ | / ._ |_ _ ._// |_) | (_) (_ |< \_ \/ |_) | | (/_ | // / | Continue reading >>

The Blockchain Explained To Web Developers, Part 2: In Practice

The Blockchain Explained To Web Developers, Part 2: In Practice

The Blockchain Explained to Web Developers, Part 2: In Practice Gildas Garcia & Kevin Maschtaler May 20, 2016 Is the blockchain a revolution? The technology that powers Bitcoin sure has the potential to disrupt the entire Internet, as we explained in a previous post . But how can you, a developer, use the blockchain to build applications? Are the tools easy to use, despite the complexity of the underlying concepts? How good is the developer experience? We wanted to find out, and there is no better tutorial than developing an app from scratch. So we've made a simple decentralized ad server called Zero Dollar Homepage, powered by blockchain. This is the story of our experience. Read on to learn how hard the blockchain is for developers today. Update (05/12/2017): This post is getting old and the blockchain technology is moving fast. The links to the Eris documentation are broken since Eris Industries was rebranded to Monax . The blockchain shines when it replaces intermediaries. We chose to focus on Ad Platforms, which are intermediaries between announcers (who buy visibility) and content providers (who sell screen real estate). Our project was to build a decentralized ad platform running on the blockchain. Since the famous Million Dollar Homepage experiment, innovating in the field of paid ads can't make you rich anymore. Instead, we chose to build a tool that allows to display ads for free - a Zero Dollar Homepage. For free, but not for nothing: advertisers exchange ad visibility for open-source contributions. So we've built a decentralized app to manage how ads display on a particular page. Advertisers need to take up a coding challenge to be able to put their ads on this page. In concrete terms, whenever we merge a Pull Request (PR) on one of marmelab's open-source r Continue reading >>

A Blockchain In 200 Lines Ofcode

A Blockchain In 200 Lines Ofcode

I like programming and Careless Whisper. The basic concept of blockchain is quite simple: a distributed database that maintains a continuously growing list of ordered records. However, it is easy to get mixed up as usually when we talk about blockchains we also talk about the problems we are trying to solve with them. This is the case in the popular blockchain-based projects such as Bitcoin and Ethereum . The term blockchain is usually strongly tied to concepts like transactions , smart contracts or cryptocurrencies . This makes understanding blockchains a necessarily harder task, than it must be. Especially source-code-wisely. Here I will go through a super-simple blockchain I implemented in 200 lines of Javascript called NaiveChain . The first logical step is to decide the block structure. To keep things as simple as possible we include only the most necessary: index, timestamp, data, hash and previous hash. The hash of the previous block must be found in the block to preserve the chain integrity The block needs to be hashed to keep the integrity of the data. A SHA-256 is taken over the content of the block. It should be noted that this hash has nothing to do with mining , since there is no Proof Of Work problem to solve. To generate a block we must know the hash of the previous block and create the rest of the required content (= index, hash, data and timestamp). Block data is something that is provided by the end-user. A in-memory Javascript array is used to store the blockchain. The first block of the blockchain is always a so-called genesis-block, which is hard coded. At any given time we must be able to validate if a block or a chain of blocks are valid in terms of integrity. This is true especially when we receive new blocks from other nodes and must decide whe Continue reading >>

The Blockchain Explained To Web Developers, Part 1: The Theory

The Blockchain Explained To Web Developers, Part 1: The Theory

The Blockchain Explained to Web Developers, Part 1: The Theory The blockchain is the new hot technology. If you haven't heard about it, you probably know Bitcoin. Well, the blockchain is the underlying technology that powers Bitcoin. Experts say the blockchain will cause a revolution similar to what Internet provoked. But what is it really, and how can it be used to build apps today? This post is the first in a series of three, explaining the blockchain phenomenon to web developers. We'll discuss the theory, show actual code, and share our learnings, based on a real world project. To begin, let's try to understand what blockchains really are. Although the blockchain was created to support Bitcoin , the blockchain concept can be defined regardless of the Bitcoin ecosystem. The literature usually defines a blockchain as follows: A blockchain is a ledger of facts, replicated across several computers assembled in a peer-to-peer network. Facts can be anything from monetary transactions to content signature. Members of the network are anonymous individuals called nodes. All communication inside the network takes advantage of cryptography to securely identify the sender and the receiver. When a node wants to add a fact to the ledger, a consensus forms in the network to determine where this fact should appear in the ledger; this consensus is called a block. I don't know about you, but after reading these definitions, I still had troubles figuring out what this is all about. Let's get a bit deeper. Decentralized peer-to-peer networks aren't new. Napster and BitTorrent are P2P networks. Instead of exchanging movies, members of the blockchain network exchange facts. Then what's the real deal about blockchains? P2P networks, like other distributed systems, have to solve a very dif Continue reading >>

Creating An App On Blockchain Technology Using Javascript

Creating An App On Blockchain Technology Using Javascript

Creating an app on Blockchain technology using JavaScript Blockchain technology is difficult, but with new JavaScript APIs Lisky hopes to make decentralization easier to program for developers. Creating an app on Blockchain technology using JavaScript As Blockchain technology comes into its own, it is becoming increasingly important for software developers and programmers to acquaint themselves with the benefits which blockchain can provide the architects and users of digital platforms and applications. Lisk is an application platform whose Software Development Kit allows users to code in JavaScript to build Blockchain applications, without needing to beBlockchainliterate. Fully customizable, apps built on Lisk can take any form, from new social media networks, games, and online stores to financial or accounting applications. In simplifying the creation of blockchain applications, Lisk is democratizing blockchain, extending the technologys benefits to all - even those with just rudimental programming experience. We sat down with Will Clark, Full Stack Lead at Lisky, to learn more about how developing blockchain-enabled applications through blockchain APIs is becoming easier. ADM: From a developers standpoint how has Blockchain technology changed the approach of creating platforms? Clark: Traditional platforms require a central authority to facilitate user interactions, whether it is a messaging platform (Twitter), a marketplace (eBay), or whatever. That hands a lot of control and responsibility to the central authority, because they essentially own the data. They are responsible for handling it securely, but they also have the power to modify or censor that data as they see fit. Building a platform on top of a blockchain removes the need for a central authority, and th Continue reading >>

Api Reference | Hyperledger Composer

Api Reference | Hyperledger Composer

Common API - Client API - Admin API - Runtime API Hyperledger Composer is an application development framework for building Blockchain applications based on Hyperledger. This is the JavaScript documentation for the Hyperledger Composer Client, Admin, and Runtime JavaScript APIs. All the classes are listed in the Class Index The major components of Hyperledger Composer are: The Hyperledger Composer language for describing the structure of resources (assets, participantsand transactions) that participate in a blockchain backed business network. JavaScript APIs to query, create, update and delete resources and submit transactionsfrom client applications. Hyperledger Composer resources are stored on the Blockchain. JavaScript transaction processor functions that runs on Hyperledger Fabric when transactions aresubmitted for processing. These functions may update the state of resourcesstored on the Blockchain via server-side Hyperledger Composer APIs. Applications that are using the client, admin APIs, or running inside a transaction function can be written to use ES6.As an example, it allows the use of the async/await syntax. // connect using the 'newUserCard', create an asset, add it to a registry and get all assets. try{ await businessNetworkConnection.connect('newUserCard'); let newAsset = factory.newAsset('org.example.basic','SampleAsset','1148'); await assestRegistry.add(newAsset); result = await assetRegistry.getAll(); LOG.info(result); await businessNetworkConnection.disconnect(); } catch (error){ // error handling } The promise chain syntax can also be used however it is highly recommended to use async/await. Using promises the example above would be: // connect using the 'newUserCard', create an asset, add it to a registry and get all assets. return businessNetwork Continue reading >>

Private Blockchains: Hyperledger Composer Javascript Api - Damien Cosset

Private Blockchains: Hyperledger Composer Javascript Api - Damien Cosset

Private Blockchains: Hyperledger Composer Javascript API In my last article , I gave a quick overview of the Hyperledger Composer framework to build a business network with a private blockchain technology. I used a land registry network to show how the framework works. We then used a React application to use the REST API provided. This time, instead of using the REST API, I made a little command line application using the Javascript API. The concept is simple. You enter commands in your terminal to trigger actions ( retrieve data, create assets and/or transactions ). We will re-use the same land registry network I used in the previous article. First, we need to have our private blockchain running. If you havent gone through my last article to set up your environment, you need to do it right now. If you went through the article, you need to run a few commands to launch the runtime: First, you need to launch the ./startFabric.sh command from the folder I called fabric-tools in the last article. Next, from the land-registry folder, you need to install the composer runtime: composer runtime install --card [email protected] --businessNetworkName land-registry Finally, still from the land-registry folder, deploy the business network: composer network start --card [email protected] --networkAdmin admin --networkAdminEnrollSecret adminpw --archiveFile [email protected] --file networkadmin.card And thats all you need, assuming youve done all the steps in the previous article before. If you only do those three commands without setting a proper environment, it will obviously not work. Note: I will link to the Github repository at the end of this article. The application is rather simple. There is an index.js file. const shell = require('shelljs')const args = process.argv.slice( Continue reading >>

Exploring Stellar Lumensdevelopment Tutorial

Exploring Stellar Lumensdevelopment Tutorial

Blockchain Dev at TheLedger & Writer. BigchainDB, Hyperledger Fabric, Stellar and Ethereum. Exploring Stellar Lumens Development Tutorial Today, I got the opportunity to explore the technical side of Stellar Lumens and make an analysis of the pros/cons. I guess I can finally cross that off my bucket list! The goal of this article is to push a simple transaction to the Stellar network. As I couldnt find much technical how-to information on Stellar, I decided to do it the old way: RTFM ! It would be nuts to immediately dive into the code, therefore I found this high-level architectural overview guide on the Stellar website . All interactions with the Stellar network happen through Horizon , a RESTful HTTP API server. It allows developers to submit transactions, check accounts balance, and subscribe to events. You can use Horizon through your web browser, a command line tool like cURL, or the Stellar SDK which is the easiest solution. The Stellar SDK is available for JavaScript , Java and Go. There are also community-maintained SDKs for Python, C#, and Ruby. The Stellar Core is the backbone of the Stellar network, every Horizon server connects with it. The Stellar Core is responsible for validating transactions and reaching consensus. The core is run by a bunch of individuals creating a decentralized network. Each transaction on the network costs a small fee: 100 stroops (equal to 0.00001 XLM). The should prevent bad entities from spamming the network. SCP opts for safety over liveness in the event of partition or misbehaving nodes, it halts the progress of the network until consensus can be reached. You can find more information on the protocol in their whitepaper . It is possible to become part of the network by running a Stellar Core instance. Such an instance can be e Continue reading >>

10 Best Blockchain Api Providers For Developers

10 Best Blockchain Api Providers For Developers

10 Best Blockchain API Providers For Developers Online-stores all over the web have steadily adopted the tendency of accepting bitcoin payments. This fact does not seem that surprising if we consider the blistering growth of a number of digital assets wallets owners over the last few years. In order to implement a payment method which accepts bitcoin, the most rational thing to do would be to use the dedicated Blockchain API. What are the benefits of this? To start, the Blockchain API can be safely considered a revolutionary solution in the FinTech sphere. It allows e-commerce owners to save time and the financial expenditures needed for the development of electronic payment systems from scratch and focus on others that are more significant and essential for service industry tasks. With this approach and modernization of existing software solutions, you will not be obliged to stick to a certain single programming language or SDK. That, in turn, will take off some of the limits from your team of developers. Sounds impressive? Excellent! In this article, we will go over a list of the top ten best Blockchain API providers which you can employ in your business project. Blockchain API providers: Editors Choice Below are some of the best blockchain APIs (in our humble opinion) and brief descriptions of each. Neurowave . A few years ago, following the rapid development of technological solutions in the financial niche, a Malaysian startup called Neurowave introduced Blockstrap API. Being an API for web-developers and programmers working with bitcoin and other digital assets, it provided the ability to create cryptocurrency-related web-applications compatible with HTML5. This API is the perfect solution for modular platforms. Notice, also, that Blockstrap does not limit develo Continue reading >>

How To Code A Bitcoin Like Blockchain In Javascript

How To Code A Bitcoin Like Blockchain In Javascript

This is a guest post by Michiel Mulders on How To Code a Bitcoin-like Blockchain In JavaScript The basic concept of a blockchain is quite simple: a distributed database that maintains a continuously growing list of ordered records. Add to this mining, mining rewards and blocks containing transactions. I think you get the general idea of a blockchain, right? There is nothing better than coding a blockchain yourself to fully grasp the inner workings of a blockchain. This tutorial will explain you to build a blockchain which returns mining rewards. The full code can be found here . Project Setup:How To Code a Bitcoin-like Blockchain In JavaScript As we like simplicity, we will only use three different files: app.js: contains the Express API for interacting with our blockchain. blockchain.js: contains the classes for constructing our blockchain, blocks, and transactions. package.json : contains our installed npm packages. The most important package we will use is crypto-js . This package contains crypto standards that can be used in JavaScript, like calculating our hash. In my opinion, a hash is the glue between two blocks. A lot of other packages can be found in this package.json file, mainly for compiling JavaScript ES7. Lets take a look at the different classes. A block consists of several properties. First, we pass a timestamp to indicate the moment the block got created. Next parameter is an array of transactions ready to be mined. At last, we define a field that contains the link to the previous block using a hash. This field is optional as the genesis block doesnt have a predecessor. class Block { constructor(timestamp, transactions, previousHash = '') { this.previousHash = previousHash; this.timestamp = timestamp; this.transactions = transactions; this.hash = this. Continue reading >>

Node.js - How Do I Use Blockchain.info's Receive Payments Api With Node Js / Express? - Stack Overflow

Node.js - How Do I Use Blockchain.info's Receive Payments Api With Node Js / Express? - Stack Overflow

How do I use Blockchain.info's Receive Payments API with node JS / Express? They have great documentation for PHP, but nothing really for node! Does anyone here have any projects,where they used the blockchain.info Receive Payments API, in their node apps, to receive money / check for confirmations? I learn a lot better by viewing / recreating example code so any you have would help me out tons! To create the address you can use something like this: api = require('blockchain')app.post('/api/blockchain/createAddress', api.blockchainCreateAddress); exports.blockchainCreateAddress = function(req, res) { var btc_address = ''; var api_url = 'var callback_url = ''; var url = api_url + '?method=create&address=' + btc_address + '&callback=' + encodeURIComponent(callback_url); if (btc_address) { https.get(url, function(resp) { console.log("Calling Blockchain API at " + url) var body = ''; resp.on('data', function(chunk) { body += chunk; }); resp.on('end', function() { try { console.log('Blockchain returns: ' + body); res.json(JSON.parse(body)); } catch(e) { msg.error = e; } }); }).on('error', function(e) { msg.error = e; }); }}; This is the first part, blockchain will respond you with some data, you should store the input_address returned and send payment to that (expose it to the public). After you send a payment to input_address you should create a new module to handle the Blockchain callback. Create something like this and go on following the doc at (Implementing The Callback) [...]app.get('/:value/:input_address/:confirmations/:transaction_hash/:input_transaction_hash/:destination_address', api.blockchainCallback);[...] exports.blockchainCallback = function(req, res) { // Go on and save/store the payment // Continue reading >>

More in ethereum