基于区块链的毕业设计Ethereum NodeJS SDK – 以太坊节点SDK

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计Ethereum NodeJS SDK – 以太坊节点SDK 是一篇很好的国外资料

Ethereum NodeJS SDK

Prerequisites

This project requires NodeJS (version 8 or later) and NPM. Node and NPM are really easy to install. To make sure you have them available on your machine, try running the following command.

$ npm -v && node -v 6.4.1 v8.16.0

Table of contents

  • Project Name
    • Prerequisites
    • Table of contents
    • Getting Started
    • Installation
    • API
      • Create Wallet
      • Import Wallet
        • Keystore
        • Private Key
      • Balance
        • Ether Balance
        • ERC20 Token Balance
      • Send
        • Send Ether
        • Send ERC20 Token
    • Demo

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Installation

BEFORE YOU INSTALL: please read the prerequisites

Start with cloning this repo on your local machine:

$ git clone https://github.com/centerprime/Node-Ethereum-SDK.git

To install and set up the library, run:

$ npm install node-ethereum-sdk

API

Create Wallet

import EthManager from "../src/centerprime.js";  var ethManager = new EthManager("Infura Url"); ethManager.createAccount("12345")   .then(res => {      console.log(res);   });

Import Wallet by Keystore

import EthManager from "../src/centerprime.js";  var ethManager = new EthManager("Infura Url"); let keystore = {}; let password = ''; ethManager.importWalletByKeystore(keystore,password)   .then(res => {       console.log(res);     });

Import Wallet by Private key

import EthManager from "../src/centerprimeSDK.js";  var ethManager = new EthManager("Infura Url"); let privateKey = ''; ethManager.importWalletByPrivateKey(privateKey)   .then(res => {         console.log(res);       });

Get Ether balance

import EthManager from "../src/centerprimeSDK.js";  var ethManager = new EthManager("Infura Url"); let address = ''; ethManager.getEtherBalance(address)   .then(res => {           console.log(res);         });

Get ERC20 token balance

import EthManager from "../src/centerprimeSDK.js";  var ethManager = new EthManager("Infura Url"); let tokenContractAddress = ''; let address = ''; ethManager.getERCTokenBalance(tokenContractAddress, address)   .then(res => {             console.log(res);         });

Send ERC20 token

import EthManager from "../src/centerprimeSDK.js";  var ethManager = new EthManager("Infura Url"); let keystore = {}; let password = ''; let tokenContractAddress = ''; let toAddress = ''; let amount = ''; let chainId = ''; // 1 : Mainnet 3 : Ropsten ethManager.sendToken(keystore, password, tokenContractAddress , toAddress , amount , chainId)   .then(res => {             console.log(res);         });

Send Ether

import EthManager from "../src/centerprimeSDK.js";  var ethManager = new EthManager("Infura Url"); let keystore = {}; let password = ''; let toAddress = ''; let amount = ''; let chainId = ''; // 1 : Mainnet 3 : Ropsten ethManager.sendEther(keystore, password , toAddress , amount , chainId)   .then(res => {             console.log(res);         });

Demo

First run backend

   npm install    npm start

Second run frontend /frontend/

   npm install    npm start

以太坊ethNodeJS SDK

先决条件

这个项目需要NodeJS(版本8或更高版本)和NPM。Node和NPM非常容易安装。要确保您的计算机上有可用的,请尝试运行以下命令。

$ npm -v && node -v 6.4.1 v8.16.0

目录

  • 项目名称先决条件目录开始安装API创建钱包导入钱包密钥库私钥平衡以太平衡ERC20令牌平衡发送以太发送ERC20令牌演示

入门

这些说明将为您提供一份项目副本,并在本地计算机上运行,以供开发和测试之用。有关如何在活动系统上部署项目的说明,请参见部署。

安装

安装前:请阅读先决条件

从在本地计算机上克隆此repo开始:

$ git clone https://github.com/centerprime/Node-Ethereum-SDK.git

要安装和设置库,运行:

$ npm install node-ethereum-sdk

创建钱包

按私钥导入钱包

import EthManager from "../src/centerprime.js";  var ethManager = new EthManager("Infura Url"); ethManager.createAccount("12345")   .then(res => {      console.log(res);   });

获取以太平衡

import EthManager from "../src/centerprime.js";  var ethManager = new EthManager("Infura Url"); let keystore = {}; let password = ''; ethManager.importWalletByKeystore(keystore,password)   .then(res => {       console.log(res);     });

获取ERC20令牌平衡

import EthManager from "../src/centerprimeSDK.js";  var ethManager = new EthManager("Infura Url"); let privateKey = ''; ethManager.importWalletByPrivateKey(privateKey)   .then(res => {         console.log(res);       });

发送ERC20令牌

import EthManager from "../src/centerprimeSDK.js";  var ethManager = new EthManager("Infura Url"); let address = ''; ethManager.getEtherBalance(address)   .then(res => {           console.log(res);         });

发送以太

import EthManager from "../src/centerprimeSDK.js";  var ethManager = new EthManager("Infura Url"); let tokenContractAddress = ''; let address = ''; ethManager.getERCTokenBalance(tokenContractAddress, address)   .then(res => {             console.log(res);         });

演示

import EthManager from "../src/centerprimeSDK.js";  var ethManager = new EthManager("Infura Url"); let keystore = {}; let password = ''; let tokenContractAddress = ''; let toAddress = ''; let amount = ''; let chainId = ''; // 1 : Mainnet 3 : Ropsten ethManager.sendToken(keystore, password, tokenContractAddress , toAddress , amount , chainId)   .then(res => {             console.log(res);         });

Send Ether

import EthManager from "../src/centerprimeSDK.js";  var ethManager = new EthManager("Infura Url"); let keystore = {}; let password = ''; let toAddress = ''; let amount = ''; let chainId = ''; // 1 : Mainnet 3 : Ropsten ethManager.sendEther(keystore, password , toAddress , amount , chainId)   .then(res => {             console.log(res);         });

Demo

第一次运行后端

   npm install    npm start

第二次运行前端/前端

   npm install    npm start

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/19652.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 ! QQ3039046426
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计Ethereum NodeJS SDK – 以太坊节点SDK

提供最优质的资源集合

立即查看 了解详情