All Projects → vechain → Thorify

vechain / Thorify

Licence: mit
A web3 adaptor for VeChain Thor RESTful HTTP API.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Thorify

Ethvtx
🌀🛰 ethereum-ready & framework-agnostic redux store configuration
Stars: ✭ 125 (+101.61%)
Mutual labels:  blockchain, web3, smart
framework
Lightweight, open source and magic-free framework for testing solidity smart contracts.
Stars: ✭ 36 (-41.94%)
Mutual labels:  smart, web3
Trust Web3 Provider
Web3 javascript wrapper provider for iOS and Android platforms.
Stars: ✭ 210 (+238.71%)
Mutual labels:  blockchain, web3
Eth Crypto
Cryptographic javascript-functions for ethereum and tutorials to use them with web3js and solidity
Stars: ✭ 420 (+577.42%)
Mutual labels:  blockchain, web3
Eth Vue
Featured in Awesome Vue [https://github.com/vuejs/awesome-vue], a curated list maintained by vuejs of awesome things related to the Vue.js framework, and Awesome List [https://awesomelists.net/150-Vue.js/3863-Open+Source/18749-DOkwufulueze-eth-vue], this Truffle Box provides everything you need to quickly build Ethereum dApps that have authentication features with vue, including configuration for easy deployment to the Ropsten Network. It's also Gravatar-enabled. Connecting to a running Ganache blockchain network from Truffle is also possible -- for fast development and testing purposes. Built on Truffle 5 and Vue 3, eth-vue uses vuex for state management, vuex-persist for local storage of app state, and vue-router for routing. Authentication functionalities are handled by Smart Contracts running on the Ethereum blockchain.
Stars: ✭ 171 (+175.81%)
Mutual labels:  blockchain, web3
Congress
Helping humanity evolve
Stars: ✭ 191 (+208.06%)
Mutual labels:  blockchain, web3
React Ethereum Dapp Example
A starter boilerplate for an Ethereum dapp using web3.js v1.0, truffle, react, and parity
Stars: ✭ 384 (+519.35%)
Mutual labels:  blockchain, web3
Cyb Archeology
🌎 Personal immortal robot for the The Great Web
Stars: ✭ 117 (+88.71%)
Mutual labels:  blockchain, web3
Maskbook
The portal to the new, open internet. ([I:b])
Stars: ✭ 691 (+1014.52%)
Mutual labels:  blockchain, web3
Typechain
🔌 TypeScript bindings for Ethereum smart contracts
Stars: ✭ 769 (+1140.32%)
Mutual labels:  blockchain, web3
Docuhash
Simple PoC that shows you how to use IPFS and Ethereum blockchain to store files and their information.
Stars: ✭ 17 (-72.58%)
Mutual labels:  blockchain, web3
Blockchainbooks.github.io
Blockchain Books
Stars: ✭ 139 (+124.19%)
Mutual labels:  blockchain, web3
Trace
Supply chain transparency platform proof-of-concept based on the Ethereum blockchain ✍️
Stars: ✭ 52 (-16.13%)
Mutual labels:  blockchain, web3
Golden Wallet React Native
Golden - Best Wallet Ever
Stars: ✭ 201 (+224.19%)
Mutual labels:  blockchain, web3
Go Web3
Ethereum Go Client [obsolete]
Stars: ✭ 120 (+93.55%)
Mutual labels:  blockchain, web3
Go Cyber
Your 🔵 Superintelligence
Stars: ✭ 270 (+335.48%)
Mutual labels:  blockchain, web3
Dapp
Censorship resistant democracies.
Stars: ✭ 1,326 (+2038.71%)
Mutual labels:  blockchain, web3
Taquito
A library for building dApps on the Tezos Blockchain - JavaScript / TypeScript
Stars: ✭ 113 (+82.26%)
Mutual labels:  blockchain, web3
Eattheblocks
Source code for Eat The Blocks, a screencast for Ethereum Dapp Developers
Stars: ✭ 431 (+595.16%)
Mutual labels:  blockchain, web3
Web3studio Sojourn
A React Native DevKit with code for a Web3 Decentralized Data Storage Pattern.
Stars: ✭ 29 (-53.23%)
Mutual labels:  blockchain, web3

Thorify    Gitter

NPM Version Build Status Coverage Status

A web3 adaptor for VeChain Thor RESTful API.

Table of contents

Install

npm install --save thorify
npm install --save [email protected]*  # Web3 is needed as dependency.

Usage

// ES6 style
import { thorify } from "thorify";
const Web3 = require("web3");		// Recommend using require() instead of import here

const web3 = thorify(new Web3(), "http://localhost:8669");

web3.eth.getBlock("latest").then(res => console.log(res));
// Best block info will be displayed

If you would like to write code in ES5, check below for the initialization code.

// ES5 style
const thorify = require("thorify").thorify;
const Web3 = require("web3");

const web3 = thorify(new Web3(), "http://localhost:8669");

web3.eth.getBlock("latest").then(res => console.log(res));
// Best block info will be displayed

Web3 method supported

web3 instance
├── eth
│   ├── getBlockNumber
│   ├── getBalance
│   ├── getStorageAt
│   ├── getCode
│   ├── getBlock
│   ├── getTransaction
│   ├── getTransactionReceipt
│   ├── sendTransaction
│   ├── sendSignedTransaction
│   ├── call
│   ├── estimateGas
│   ├── getPastLogs
│   ├── subscribe
│   ├── clearSubscriptions
│   ├── getEnergy
│   ├── getChainTag
│   ├── getBlockRef
│   ├── accounts
│   └── Contract
│       ├── Constructor(new Contract())
│       ├── clone
│       ├── deploy
│       ├── methods
│       ├── methods.myMethod.call
│       ├── methods.myMethod.send
│       ├── methods.myMethod.estimateGas
│       ├── methods.myMethod.encodeABI
│       ├── events
│       ├── once
│       ├── events.myEvent
│       ├── events.allEvents
│       └── getPastEvents
└── utils

Send Transaction

In Thor official implementation , the client DOES NOT neither manage user's private-key/keyStore nor use private key to sign a Transaction. Unfortunately, thorify can not directly perform eth_sendTransaction but there is another way to sign a transaction.

In web3.js accounts, it gives the opportunity to add your private-key, stored in your runtime context (In Node.js context, it's stored in memory while in Browser context, it's stored in memory/local storage), to accounts module. When you are trying to send a transaction, the module will check the private key associated with from field. Once the private key and from have been matched, the module will sign the transaction. The APIs that follows the mechanism are:

  • web3.eth.sendTransaction()
  • contract.deploy.send()
  • contract.methods.myMethod.send()

Documentation

API Reference

Play with multi-clause

  1. thor-devkit.js supports multi-clause and sign transaction
  2. send signed transaction using sendSignedTransaction

Which Stack Should I Choose Regarding Connex,Thorify And Web3-Gear

  • Connex: The standard interface to connect VeChain apps with VeChain blockchain and user.
  • Web3-Gear: Proxy Thor's RESTful API to Eth's JSON-RPC, to support Remix, Truffle and more.

Below is an reference when you are planning your technical stack:

tech-stack

Here are some most common scenarios:

  1. Develop a web application: Connex + Connex powered VeChain wallets
  2. Backend service in Node.js: Thorify + Web3
  3. Contract development in Truffle: Web3 + Web3-Gear
  4. Contract development in Remix-IDE: Web3 + Web3-Gear

FAQ

How do I send VTHO token

VTHO is a token that compatible with VIP180(ERC-20), you can build a contract instance using web3 and do what ever you want.

Multi party payment protocol or sponsored contract

It's done by calling the functions of prototype contract, check wiki page for detailed info about prototype contract.

Method not supported

The RESTful API of Thor is different with Ethereum's JSON-RPC, therefore, there are some methods in web3 are not supported by thorify, feel free to open an issue discuss the features.

Notes

  • There are three special block number in Ethereum: earliest,latest,pending. In VeChain Thor, we introduced best block and there is no pending block, so they will be replaced with 0 (aka genesis), best, best

Compatibility

Currently, Thorify is compatible with [email protected]*.

Debugging

DEBUG=thor:* ts-node index.ts 

ts-node index.ts can be replaced with command to run your code, this example is only for Node.js environment. For more detailed info, please refer to debug.

License

This project is licensed under the MIT license, Copyright (c) 2017 VeChain Foundation. For more information see LICENSE.md.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].