api-v1-client-node:区块链比特币开发人员API-NodeJS

  • f0_417771
    了解作者
  • 22.2KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-07 04:12
    上传日期
区块链API库(Node,v1) 一个官方的Node模块,用于与Blockchain.info API进行交互。 入门 通过安装: $ npm install --save blockchain.info 输入: var blockchain = require ( 'blockchain.info' ) 回应 该模块中的所有函数均返回用于处理异步操作JavaScript。 子模块 此模块包含以下子模块: 与区块链钱包互动或创建 查看地址,区块,交易等数据 获取实时比特币汇率 推送自定义交易 -接收付款通知 -交易和冻结的实时通知 -获取历史区块链数据和统计数据 您可以从导入的主模块的属性访问子模块,也可以通过单独导入子模块来访问它们。 单独导入: var MyWallet = require ( 'blockchain.info/MyWallet' ) 财产进口:
api-v1-client-node-master.zip
  • api-v1-client-node-master
  • .gitignore
    45B
  • statistics
  • spec.js
    2.3KB
  • README.md
    2.7KB
  • index.js
    1.2KB
  • README.md
    1.4KB
  • Receive
  • README.md
    1.8KB
  • index.js
    1.1KB
  • Socket
  • README.md
    1.5KB
  • index.js
    2.4KB
  • exchange
  • spec.js
    2.7KB
  • README.md
    1.4KB
  • index.js
    1.1KB
  • package.json
    1.1KB
  • CONTRIBUTING.md
    286B
  • pushtx
  • README.md
    599B
  • index.js
    561B
  • blockexplorer
  • spec.js
    1KB
  • README.md
    4.6KB
  • endpoints.js
    921B
  • index.js
    2.6KB
  • blocks.json
    1.4KB
  • index.js
    269B
  • LICENSE.md
    1KB
  • .editorconfig
    168B
  • MyWallet
  • README.md
    7.9KB
  • endpoints.js
    1.3KB
  • index.js
    4.5KB
  • api.js
    1.3KB
内容介绍
# Blockchain MyWallet Module Programmatically interact with your Blockchain.info wallet. [View full API documentation](https://blockchain.info/api/blockchain_wallet_api). ## Opening a wallet Importing: ```js var MyWallet = require('blockchain.info/MyWallet') ``` An instance of a wallet needs to be initialized before it can be used: ```js var wallet = new MyWallet(identifier, password, options) ``` Options: * `secondPassword` - second wallet password (required only if wallet is double-encrypted) * `apiCode` - Blockchain.info api code (will be automatically included in all further requests to the wallet) * `apiHost` - set the host for the api calls (required) ## Wallet API v2 Compatibility This module requires the [Wallet API v2 service](https://github.com/blockchain/service-my-wallet-v3). To use the wallet service for api calls, set the `apiHost` option to point to where the service is running. Example: ```js var options = { apiCode: 'myAPICode', apiHost: 'http://localhost:3000' } var wallet = new MyWallet('myIdentifier', 'myPassword123', options) wallet.getBalance().then(function (response) { console.log('My balance is %d!', response.balance); }) ``` ## Response objects Payment Response Object Properties: * `to` - payment destinations (*[string|number]*) * `amounts` - payment amounts (*[number]*) * `from` - from account / address (*string|number*) * `fee` - final fee paid in satoshi (*number*) * `message` - message confirming the transaction (*string*) * `tx_hash` - the hash of the transaction (*string*) * `notice` - notice, not always returned (*string*) Address Object Properties: * `address` - the address name (*string*) * `balance` - the address balance in satoshi (*number*) * `label` - the address label (*string* or *null*) * `total_received` - the total satoshi ever received by the address (*number*) Account Object Properties: * `balance` - the account balance in satoshi (*number*) * `label` - the account label (*string*) * `index` - the account index (*number*) * `archived` - indicates if the account is archived or not (*boolean*) * `extendedPublicKey` - account xpub (*string*) * `extendedPrivateKey` - account xpriv (*string*) * `receiveIndex` - current account receive index (*number*) * `lastUsedReceiveIndex` - the last used receive index (*number*) * `receivingAddressLabels` - receive address labels (*[{number: string}]*) * `receiveAddress` - current receive address (*string*) ## Class Methods ### create Usage: ```js MyWallet.create(password, apiCode, options) ``` Create a new Blockchain Wallet. Responds with an instance of MyWallet, which will adopt the same api code used to create the wallet. If you are using the Wallet API v2 service, remember to set the `apiHost` option to wherever the service is running. Parameters: * `password` - password to set for the wallet (required, must be greater than 10 characters) * `apiCode` - Blockchain.info api code (required) Options: * `priv` - private key to use for the wallet's first bitcoin address (*string*) * `label` - label to give to the wallet's first bitcoin address (*string*) * `email` - email to associate with the new Blockchain Wallet (*string*) * `hd` - create the new wallet as an hd wallet (*boolean*, recommended) * `apiHost` - set the host for the api calls to the newly created wallet (*string*, required) ## Instance Methods The API code passed into the MyWallet constructor is automatically included in all requests to the wallet. ### Send Bitcoin Usage: ```js wallet.send(address, amount, options) ``` Sends bitcoin from the wallet to a given address. Responds with a Payment Response Object. Parameters: * `address` - bitcoin address to send to * `amount` - amount **in satoshi** to send Options (optional): * `from` - send from a specific Bitcoin address or account index (*string*|*number*, required when sending from an account) * `fee` - transaction fee value **in satoshi** (*number*, defaults to 0.0001btc) * `feePerByte` - transaction fee **in satoshi per byte** (*number*, recommended) ### Send to multiple addresses Usage: ```js wallet.sendMany(recipients, options) ``` Sends bitcoin to multiple addresses. Responds with a Payment Response Object. Parameters: * `recipients` - *object* with properties/values in the format: "receivingAddress":amount (required) Options (optional): * `from` - send from a specific Bitcoin address or account index (*string*|*number*, required when sending from an account) * `fee` - transaction fee value **in satoshi** (*number*, defaults to 0.0001btc) * `feePerByte` - transaction fee **in satoshi per byte** (*number*, recommended) ### Get wallet balance Usage: ```js wallet.getBalance() ``` Responds with the entire balance of a wallet, as a number, **in satoshi**. ### Upgrade to HD wallet Usage: ```js wallet.enableHD() ``` Upgrades a legacy wallet to an HD wallet. Responds with an account object (the first account in the new HD wallet). ### List HD accounts Usage: ```js wallet.listAccounts() ``` Lists wallet HD accounts. Responds with an *array* of account objects. ### List account xpubs Usage: ```js wallet.listXPubs() ``` Lists wallet account xpubs. Responds with an *array* of xpub strings. ### Create new HD account Usage: ```js wallet.createAccount(options) ``` Creates a new HD account at the next unused account index. Responds with an account object. Options (optional) * `label` - label to give the new account (*string*) ### Get HD account Usage: ```js wallet.getAccount(xpubOrIndex) ``` Gets a single HD account. Responds with an account object. Parameters: * `xpubOrIndex` - the account xpub or index (*string*|*number*, required) ### Get HD account receive address Usage: ```js wallet.getAccountReceiveAddress(xpubOrIndex) ``` Gets the next unused receive address for an HD account. Responds with an *object* containing an **address** property. Parameters: * `xpubOrIndex` - the account xpub or index (*string*|*number*, required) ### Get HD account balance Usage: ```js wallet.getAccountBalance(xpubOrIndex) ``` Gets the balance of an HD account. Responds with an *object* containing a **balance** property. Parameters: * `xpubOrIndex` - the account xpub or index (*string*|*number*, required) ### Archive HD account Usage: ```js wallet.archiveAccount(xpubOrIndex) ``` Archives an HD account. Responds with an account object. Parameters: * `xpubOrIndex` - the account xpub or index (*string*|*number*, required) ### Unarchive HD account Usage: ```js wallet.unarchiveAccount(xpubOrIndex) ``` Unarchives an HD account. Responds with an account object. Parameters: * `xpubOrIndex` - the account xpub or index (*string*|*number*, required) ### List wallet addresses Usage: ```js wallet.listAddresses() ``` Responds with an *object* that has an **addresses** property. This property is an **array** of Address Objects. ### Get address Usage: ``` wallet.getAddress(address, options) ``` Responds with an address object of the specified address. Parameters: * `address` - the name of the address (*string*) ### Create new address Usage: ```js wallet.newAddress(options) ``` Creates a new address. Responds with a partial Address Object (contains just the **address** property, also contains the **label** property if a label parameter was passed). Options (optional): * `label` - automatically set the label of the new address (*string*) ### Archive address Usage: ```js wallet.archiveAddress(address) ``` Archives a specific address. Responds with an object that has the property **archived**, which is set to the name of the archived address (*string*). Parameters: * `address` - the name of the address to archive (*string*) ### Unarchive address Usage: ```js wallet.unarchiveAddress(address) ``` Unarchives a specific address. Responds with an object that has the property **active**, wh
评论
    相关推荐
    • drum-demo-react:实现了simple-beats-npm包的简单音乐应用程序
      交互式监视模式下启动测试运行器。 有关更多信息,请参见关于的部分。 npm run build 构建生产到应用程序build文件夹。 它在生产模式下正确捆绑了React,并优化了构建以获得最佳性能。 生成被最小化,并且...
    • pwr:npm的(被欺骗的)交互式CLI
      :high_voltage: npm的(被欺骗的)交互式CLI :call_me_hand: 如果您喜欢此项目,请在上对我进行ping操作 因为社区建设很棒 :sparkles: 我们每天使用的东西。 但是记住他们时髦的名字(和参数)并不容易。 安装与...
    • npm-api-react-sample-project
      交互式监视模式下启动测试运行器。 有关更多信息,请参见关于的部分。 npm run build 构建生产到应用程序build文件夹。 它在生产模式下正确捆绑了React,并优化了构建以获得最佳性能。 最小化内部版本,文件名...
    • npm:GitHub与npm交互的动作
      NPM的GitHub操作 此动作可使用npm命令行客户端启用任意动作,包括测试程序包和发布到注册表。 用法 生成,测试npm程序包并将其发布到默认公共注册表的工作流程示例如下: workflow " Build, Test, and Publish " { ...
    • node-snap-ci:非官方的npm模块与snap-ci进行交互
      非常基本的非官方npm模块,用于与 API进行交互。 安装 npm install node-snap-ci ##用法 ### Authentication您可以将凭据传递到api构造函数中: var snap = require('node-snap-ci')({ apiKey: 'my-api-key', ...
    • vueasie:NPM模块,提供与easiedata功能交互的界面
      通过NPM安装vueasie npm install vueasie --save 在您的代码中导入或要求Vue和Vueasie: import Vue from 'vue' import Vueasie from 'vueasie' Vue . use ( Vueasie ) 或使用单个组件: import Vue from 'vue'...
    • 交互式注册页面
      注册页面 项目设置 npm install 编译和热重装以进行开发 npm run serve 编译并最小化生产 npm run build 整理和修复文件 npm run lint 自定义配置 请参阅。
    • curemap:临床数据的交互式地图
      固化图 临床数据的交互式地图 设置 确保安装了和 root (npm i roots@pre -g) 克隆这个 repo 并cd到文件夹中 运行npm install 运行roots watch
    • gvsig-geocode:Uso de npm gei
      交互式监视模式下启动测试运行器。 有关更多信息,请参见关于的部分。 npm run build 构建生产到应用程序build文件夹。 它在生产模式下正确捆绑了React,并优化了构建以获得最佳性能。 生成被最小化,并且...
    • npm-wrapper:API的Discord Bots Group NPM包装器
      与discordbots.group API进行交互的简单库。 入门 只需导航到您的项目目录,然后运行npm i discord-bots-group/npm-wrapper 。 文献资料 例子 const Client = require ( 'discordbots.group' ) ; const client = ...