thor-jsonrpc-server
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

thor-jsonrpc-server

A local server that implements ETH JSON-RPC APIs for interacting with the VeChain Thor protocol.

Installation

npm i thor-jsonrpc-server

Usage

import { ThorJsonRPCServer } from 'thor-jsonrpc-server';
import { SimpleWallet } from '@vechain/connex-driver';

const wallet = new SimpleWallet();
// Add private key
wallet.import(key);

const srv = new ThorJsonRPCServer(
  url, // Node url, e.g., 
       // Solo node: 	http://127.0.0.1:8669
       // Main net: 	https://sync-mainnet.veblocks.net/	
       // Test net: 	https://sync-testnet.veblocks.net/
  wallet
);

// start the server with a given port
srv.start(port);

Example

  • Request:
{
  "id":1,
  "jsonrpc": "2.0",
  "method":"eth_blockNumber"
}
  • Response
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "0x23"
}

License

This software is licensed under the GNU Lesser General Public License v3.0, also included in LICENSE file in repository.

Readme

Keywords

none

Package Sidebar

Install

npm i thor-jsonrpc-server

Weekly Downloads

2

Version

0.1.0

License

LGPL-3.0

Unpacked Size

71 kB

Total Files

13

Last publish

Collaborators

  • pzzh