npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

youchainjs-tx

v1.0.10

Published

A simple module for creating, manipulating and signing YOUChain transactions

Downloads

7

Readme

youchainjs-tx

This is the personal package to be used to sign txs.

INSTALL

npm install youchainjs-tx

USAGE

####1、默认配置

const YOUTransaction = require('youchainjs-tx').YOUTransaction;
const privateKey = Buffer.from(
  'e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109',
  'hex',
);

const txParams = {
  nonce: '0x00',
  gasPrice: '0x09184e72a000',
  gasLimit: '0x2710',
  to: '0x0000000000000000000000000000000000000000',
  value: '0x00',
  data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057',
};

// The second parameter is not necessary if these values are used
// const tx = new YOUTransaction(txParams, { chain: "youchain"  });
// const tx = new YOUTransaction(txParams, { chain: 2  });
const tx = new YOUTransaction(txParams);
tx.sign(privateKey);
const serializedTx = tx.serialize();

####2、设置 networkId

const YOUTransaction = require('youchainjs-tx').YOUTransaction;
const privateKey = Buffer.from(
  'e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109',
  'hex',
);
const Common = require('youchainjs-tx').Common;
const customCommon = Common.forCustomChain(
  'youchain',
  {
    name: 'my-network',
    networkId: 2,
  }
);

const txParams = {
  nonce: '0x00',
  gasPrice: '0x09184e72a000',
  gasLimit: '0x2710',
  to: '0x0000000000000000000000000000000000000000',
  value: '0x00',
  data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057',
};

const tx = new YOUTransaction(txParams,   { common: customCommon });
tx.sign(privateKey);
const serializedTx = tx.serialize();

Chain and Hardfork Support

The Transaction and FakeTransaction constructors receives a second parameter that lets you specify the chain and hardfork to be used. By default, mainnet and petersburg will be used.

There are two ways of customizing these. The first one, as shown in the previous section, is by using an object with chain and hardfork names. You can see en example of this in ./examples/ropsten-tx.ts.

The second option is by passing the option common set to an instance of [common]' Common. This is specially useful for custom networks or chains/hardforks not yet supported by ethereumjs-common. You can see en example of this in ./examples/custom-chain-tx.ts.

API

./docs/