Contrast with web3.js
js-conflux-sdk is Conflux network's javascript SDK, if you are familiar with Ethereum's web3.js, this guide can help you quickly know how to use js-conflux-sdk.
Install
web3:
npm:
npm install web3pure js: link the
dist/web3.min.js
js-conflux-sdk:
npm:
npm install js-conflux-sdkpure js: link the
dist/js-conflux-sdk.umd.min.js
Import & initialize
web3:
// In Node.js use: const Web3 = require('web3');
const web3 = new Web3(Web3.givenProvider || "ws://localhost:8545");js-conflux-sdk:
const { Conflux } = require('js-conflux-sdk');
// In browser: const Conflux = window.TreeGraph.Conflux;
const conflux = new Conflux({
url: "https://test.confluxrpc.com",
networkId: 1
});Invoke client's RPC method
web3:
js-conflux-sdk:
Account manage
web3:
js-conflux-sdk:
Sending Transactions
web3:
js-conflux-sdk:
Tx state checker
web3:
js-conflux-sdk:
Interact with contract
To interact with contract, you must know it's abi, bytecode, address
Deploy contract
web3:
js-conflux-sdk:
Call methods
web3:
js-conflux-sdk
Update contract state
web3:
js-conflux-sdk:
Utilities
Unit convert
web3:
js-conflux-sdk:
hex encoding
web3:
js-conflux-sdk:
keccak
web3:
js-conflux-sdk:
Last updated
Was this helpful?