CryptoCoinsInfoClub.com

Blockchain Javascript Api

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 >>

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 >>

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 >>

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 >>

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 >>

Lotion - Smooth, Easy Blockchain Apps In Javascript

Lotion - Smooth, Easy Blockchain Apps In Javascript

Smooth, easy blockchain apps. Powered by Tendermint consensus. Lotion is a new way to create blockchain apps in JavaScript, which aims to make writing new blockchains fast and fun. It builds on top of Tendermint using the ABCI protocol. Lotion lets you write secure, scalable applications that can easily interoperate with other blockchains on the Cosmos Network using IBC . Lotion itself is a tiny framework; its true power comes from the network of small, focused modules built upon it. Adding a fully-featured cryptocurrency to your blockchain, for example, takes only a few lines of code . Note: the security of this code has not yet been evaluated. If you expect your app to secure real value, please use Cosmos SDK instead. A lotion application is usually a single function of signature (state, tx) which mutates your blockchain's state in response to a transaction. All of your application state is contained within a single JavaScript object. As a developer, all you need to do is design your application's initial state, then write the function to compute the next state when a transaction happens. Here's a minimal hello world example which simply counts the number of transactions that have occurred so far: let app = require('lotion')({ initialState: { count: 0 }})app.use((state, tx) => { state.count++})app.listen(3000) This will start the lotion application http server on port 3000, which you can use to query the state of the blockchain and create new transactions. The goal of a blockchain is to represent a single state being concurrently edited. In order to avoid conflicts between concurrent edits, it represents the state as a ledger: a series of transformations applied to an initial state. The blockchain must allow all connected nodes to agree about which transformations ar Continue reading >>

What Are The Best Sdk Tools For Automating Blockchain Services?

What Are The Best Sdk Tools For Automating Blockchain Services?

Get started Bring yourself up to speed with our introductory content. What are the best SDK tools for automating blockchain services? As blockchain matures, an ecosystem of tools continues to sprout up around it. Learn how these offerings, including the Hyperledger Fabric Client SDK, can help with a deployment. Oracle cloud services aim to pull users out of IT comfort zone SearchOracle Before you look at specific tools for automating blockchain services, you need to understand blockchain. Blockchain is a technology that allows for the digitization of transaction workflow. In doing this, the technology solves the pitfalls of transaction governance by leveraging the shared ledger system. Blockchain runs over a network, where its members track and exchange assets. A record of all their exchanges is replicated to all members of this network. The applications themselves, which are deployed to a blockchain, consist of a self-executing contract and a client-side application, interfacing with this network through either a SDK or API. Instant Download: 5 Solid Alternatives to Docker In this guide, 20-year software development expert Mark Betz outlines 5 alternatives to Docker, complete with hands-on advice. This email address doesnt appear to be valid. This email address is already registered. Please login . You have exceeded the maximum character limit. Please provide a Corporate E-mail Address. By submitting my Email address I confirm that I have read and accepted the Terms of Use and Declaration of Consent. By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers. You also agree that your personal information may be transferred and processed in the United States, and that you h 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 >>

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 >>

Programming Blockchain In Javascript

Programming Blockchain In Javascript

In the last few posts I talked about implementing Blockchain in iOS using Swift. A lot of people emailed me and asking about the Javascript implementation of the Blockchain. This post shows how to implement the core engine of the Blockchain in Javascript using Node. The first step is to define the models associated with domain objects, represented in the Blockchain. These models consists of the following: Transaction: A transaction represents a transfer of value. This can be money, merchandise, medical records etc. Block: A block is mined by a miner which is later filled with transactions and added to the blockchain. Blockchain: A blockchain represents the linked list of blocks. A blockchain is immutable, which means once the block is added to the blockchain it cannot be altered. Once, our basic models have been created we can move on to implementing the core functionality of the Blockchain. We will start by allowing our blocks to add transactions. This is done by adding a addTransaction function to the Block class as shown below: A block is mined based on its key which comprises of the following properties: index: The current index of the block in the blockchain. previousHash: The hash of the previous block in the blockchain. nonce: The magic number which is incremented to find the secret hash which is used to sign the block. transactions: A list of transactions added to the block. The key property is a getter property on the Block class as shown below: Next, we will move to the Blockchain class. Below you can find the complete implementation of the Blockchain class. To generate a SHA256 hash we will use help from a node package js-sha256 . You can install the package by running the following command: Lets go ahead and test out our Blockchain by adding few transaction 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 >>

More in ethereum