Skip to content
Browse files

add wallet/exchange integration page

  • Loading branch information...
thanhson1085 committed May 28, 2019
1 parent 7c355a1 commit 949246cd0f73353a1188d1afc8cdb35a444e6d12
Showing with 142 additions and 0 deletions.
  1. +141 −0 docs/developers/
  2. +1 −0 mkdocs.yml
@@ -0,0 +1,141 @@
TomoChain is an EVM-compatible public blockchain, using [TomoChain JSON-RPC APIs]( same as Ethereum.

It means that you can use [Web3 library]( to create a wallet, check the balance or send the transaction. You just need to change RPC endpoint to TomoChain fullnode or TomoChain public RPC endpoint.
You can take a look to [TomoChain Networks]( page to know our network information.

## Connect to TomoChain nodes
import Web3 from 'web3';
const web3 = new Web3('');

## Create wallet
Generates an account object with private key and public key.
#### Example
> {
address: "0xb8CE9ab6943e0eCED004cDe8e3bBed6568B2Fa01",
privateKey: "0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709",
signTransaction: function(tx){...},
sign: function(data){...},
encrypt: function(password){...}
> {
address: "0xF2CD2AA0c7926743B1D4310b2BC984a0a453c3d4",
privateKey: "0xd7325de5c2c1cf0009fac77d3d04a9c004b038883446b065871bc3e831dcd098",
signTransaction: function(tx){...},
sign: function(data){...},
encrypt: function(password){...}
> {
address: "0xe78150FaCD36E8EB00291e251424a0515AA1FF05",
privateKey: "0xcc505ee6067fba3f6fc2050643379e190e087aeffe5d958ab9f2f3ed3800fa4e",
signTransaction: function(tx){...},
sign: function(data){...},
encrypt: function(password){...}

## Wallet balances
Get account balance.
web3.eth.getBalance(address [, defaultBlock] [, callback])

#### Example
> "1000000000000"

## Create transaction
Sends transction to the network. You need to unlock wallet before using this function.
web3.eth.sendTransaction(transactionObject [, callback])

#### Parameters
1. Object - The transaction object to send:
- `from` - `String|Number`: The address for the sending account. Uses the web3.eth.defaultAccount property, if not specified. Or an address or index of a local wallet in web3.eth.accounts.wallet.
- `to` - `String`: (optional) The destination address of the message, left undefined for a contract-creation transaction.
- `value` - `Number|String|BN|BigNumber`: (optional) The value transferred for the transaction in wei, also the endowment if it’s a contract-creation transaction.
- `gas` - `Number`: (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded).
- `gasPrice` - `Number|String|BN|BigNumber`: (optional) The price of gas for this transaction in wei, defaults to web3.eth.gasPrice.
- `data` - `String`: (optional) Either a ABI byte string containing the data of the function call on a contract, or in the case of a contract-creation transaction the initialisation code.
- nonce - `Number`: (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.
2. `callback` - `Function`: (optional) Optional callback, returns an error object as first parameter and the result as second.

#### Example
const Web3 = require('web3')
// Connect to TomoChain nodes
const provider = new Web3.providers.HttpProvider('')
const web3 = new Web3(provider)
// Unlock wallet by private key
const account = web3.eth.accounts.privateKeyToAccount(pkey)
let coinbase = account.address
web.eth.defaultAccount = coinbase
// Make a transaction using the promise
from: coinbase,
to: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe',
value: '1000000000000000'

## Check transaction status
web3.eth.getTransactionReceipt(hash [, callback])
> The receipt is not available for pending transactions and returns null.
#### Parameters
1. String - The transaction hash.
2. Function - (optional) Optional callback, returns an error object as first parameter and the result as second.
#### Returns
Promise returns Object - A transaction receipt object, or null when no receipt was found:

- `status` - `Boolean`: `TRUE` if the transaction was successful, `FALSE`, if the EVM reverted the transaction.
- `blockHash` 32 Bytes - `String`: Hash of the block where this transaction was in.
- `blockNumber` - `Number`: Block number where this transaction was in.
- `transactionHash` 32 Bytes - `String`: Hash of the transaction.
- `transactionIndex` - `Number`: Integer of the transactions index position in the block.
- `from` - `String`: Address of the sender.
- `to` - `String`: Address of the receiver. null when its a contract creation transaction.
- `contractAddress` - `String`: The contract address created, if the transaction was a contract creation, otherwise null.
- `cumulativeGasUsed` - `Number`: The total amount of gas used when this transaction was executed in the block.
- `gasUsed` - `Number`: The amount of gas used by this specific transaction alone.
- `logs` - `Array`: Array of log objects, which this transaction generated.

## Irreversible blocks
In normal case, you can wait for 60 confirmations, then checking block finality via `eth_getBlockFinalityByNumber` or `eth_getBlockFinalityByHash` API (

If `result` > 75, it means block finality and Irreversible.

## How does TomoChain smart contract work?
Same as Ethereum, supports Solidity compiler version < 0.5.0

## Possible to create muti-signature wallet?
Yes. Same as Ethereum. You can use Gnosis MultiSigWallet.

## Run TomoChain node
Refer to [Run TomoChain Fullnode](

@@ -100,6 +100,7 @@ nav:
- Standard & Specification:
- TRC21 Specification: wp-and-research/specs/
- Developers guide:
- Exchange/Wallet integrations: developers/
- Working with TomoChain:
- TomoChain private testnet setup: developers/
- Useful manual CLI commands: developers/

0 comments on commit 949246c

Please sign in to comment.
You can’t perform that action at this time.