Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including truffle-privatekey-provider with all npm packages installed. Try it out:

var trufflePrivatekeyProvider = require("truffle-privatekey-provider")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

truffle-privatekey-provider v1.3.0

Private Key Web3 provider

NPM

truffle-privatekey-provider

Private Key provider for Web3. Used to sign transactions by provider private key

Install

$ npm install truffle-privatekey-provider

Usage

Provider can be used either with Web3 only or in Truffle infrastructure

Web3 Usage

var PrivateKeyProvider = require("truffle-privatekey-provider");
var privateKey = "62537136911bca3a7e2b....";
var provider = new PrivateKeyProvider(privateKey, "http://localhost:8545");

Parameters:

  • privateKey: string. private key for account that would be used to sign transactions.
  • providerUri: string. URI of Ethereum client to send Web3 requests.

Truffle Usage

truffle.js

var PrivateKeyProvider = require("truffle-privatekey-provider");

var privateKey = "62537136911bca3a7e2b....";

module.exports = {
  networks: {
    rinkeby: {
      provider: new PrivateKeyProvider(privateKey, "https://rinkeby.infura.io/"),
      network_id: 4
    },
    ....
  }
};
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free