Viction
  • Getting Started
  • General
    • Overview
    • Viction Blockchain
      • PoSV Consensus
      • Comparison
    • Staking
      • Staking Requirements
      • Staking Rewards
      • How to stake on Viction Wallet
    • Network Information
      • Viction Mainnet
      • Viction Testnet
    • Viction RPC API
  • Smart Contract Development
    • Solidity
      • A Simple Smart Contract
      • Solidity by Example
    • Standards & Specification
      • VRC25 Specification
      • VRC725 Specification
    • IDEs and Tools
      • Remix
      • Ethers.js
      • web3.js
      • thirdweb CLI
    • Deployment & Verification
      • Hardhat
      • Foundry
  • DApp Development
    • Integration
      • Exchange/Wallet integration
      • VRC25 Exchange/Wallet integration
      • Viction Staking Governance
      • VIC ZeroGas
      • VRRF
    • Data and analytics
    • Embedded Wallet (MPC)
    • Walkthrough: Build a Dapp on Viction
      • Setup Environment
      • Write the Smart Contract
      • Interacting with the Dapp in a browser
  • Masternode
    • Requirements
    • Run a Full Node
      • Binary
      • Create a Viction Masternode
      • Tmn
      • Docker
    • Apply Your Node
    • Slashing Mechanism
    • Chain Data Snapshots
    • Troubleshooting
  • Viction Wallet
    • User Guide
      • Authentication
      • How to create a new wallet
      • How to restore a wallet?
      • Wallet settings
      • Send & Receive Tokens
      • Add custom token
      • Manage Tokens
      • Send NFT
      • General settings
    • Developer Guide
    • Privacy Policy
    • Term and Services
  • Viction Bridge
    • Spacegate
    • Arken Bridge
    • Hyperlane
  • Viction Data Availability
    • Viction DA RPC API
    • DA Integration Use cases
      • Simple Guide for Integrating OP Stack Rollup with Viction DA Layer
  • How to
    • How to Connect to Viction Blockchain
      • Coin98 Super Wallet
      • Metamask
      • Ledger
    • How to troubleshoot when the node is up but couldn't begin to sync block
    • How to Vote for Viction Saigon Network Upgrade Proposal
    • How to issue a token via VICIssuer
    • How to verify if a contract has been issued via VICIssuer
    • How to deploy the VRC725 contract
    • How to apply ZeroGas for VRC725 contract
    • How to Migrate Dapps from Ethereum
    • How to register Token or NFT logo on Vicscan
    • How to verify a contract on Vicscan
    • How to confirm a project on Vicscan
    • How to check if a token is gas sponsored on Viction
    • How to verify gas sponsored transactions
    • How to create Telegram Mini Apps
    • How to use VictionSafe (Multisig)
  • FAQ
    • APIs
    • General
      • Viction
      • Ecosystem
      • VIC - Economics
      • Contact & Support
    • Masternodes and Voting
      • Masternodes
      • Voter
    • Products
      • VicScan (Explorer)
      • VicMaster
      • VicStats
      • VicIssuer
        • How to Verify & Publish Contract Source Code on VicScan
      • Viction Wallet
      • Viction Data Availability Network
  • Legal
    • Terms of Use
    • Privacy Policy
  • Whitepaper and Research
  • Archive
    • TOMOE
    • How to Deploy a VRC25 Token on Viction
    • How to deploy an ICO smart contract on Viction
    • How to deploy an NFT token
    • An Example of Building a Dapp on Viction
    • Migrate Ethereum Dapp to Viction
    • TomoMasterDAO
      • Introduction
      • Governance model
        • On-Chain vs Off-Chain Voting
        • Board
        • Proposals
        • Voting and Outcome
      • Tokenomics
      • How to utilize and trade tDAO
      • Proposal guidelines for TomoMasterDAO
    • Old Viction Testnet
    • Deploy on Viction
      • CLI Commands
      • Viction Private Testnet Setup
Powered by GitBook
On this page
  • Connect to Viction's public RPC endpoint
  • Create a wallet
  • Check wallet balances
  • Create transaction
  • Sign data
  • Check transaction status
  • Irreversible blocks
  • How does Viction smart contract work?
  • Does Viction support multi-signature wallets?
  • Run Viction node
  1. DApp Development
  2. Integration

Exchange/Wallet integration

PreviousIntegrationNextVRC25 Exchange/Wallet integration

Last updated 1 year ago

Viction is an EVM-compatible public blockchain. So you can use similar as in Ethereum.

EVM compatible libraries such as or library can be fully reused in integration to create a wallet, check wallet balances, or create/send transactions. All you need is to connect to Viction's RPC public endpoint. will guide you the steps to connect to Viction Testnet/Mainnet using Web3.js.

Connect to Viction's public RPC endpoint

import Web3 from 'web3';

const web3 = new Web3('https://rpc.viction.xyz');

Create a wallet

Generate an account object with private key and public key.

web3.eth.accounts.create([entropy]);

Example

web3.eth.accounts.create();
> {
    address: "0xb8CE9ab6943e0eCED004cDe8e3bBed6568B2Fa01",
    privateKey: "0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709",
    signTransaction: function(tx){...},
    sign: function(data){...},
    encrypt: function(password){...}
}

web3.eth.accounts.create('2435@#@#@±±±±!!!!678543213456764321§34567543213456785432134567');
> {
    address: "0xF2CD2AA0c7926743B1D4310b2BC984a0a453c3d4",
    privateKey: "0xd7325de5c2c1cf0009fac77d3d04a9c004b038883446b065871bc3e831dcd098",
    signTransaction: function(tx){...},
    sign: function(data){...},
    encrypt: function(password){...}
}

web3.eth.accounts.create(web3.utils.randomHex(32));
> {
    address: "0xe78150FaCD36E8EB00291e251424a0515AA1FF05",
    privateKey: "0xcc505ee6067fba3f6fc2050643379e190e087aeffe5d958ab9f2f3ed3800fa4e",
    signTransaction: function(tx){...},
    sign: function(data){...},
    encrypt: function(password){...}
}

Check wallet balances

Get account balance.

web3.eth.getBalance(address [, defaultBlock] [, callback])

Example

web3.eth.getBalance("0x407d73d8a49eeb85d32cf465507dd71d507100c1").then(console.log);
> "1000000000000"

Create transaction

Send transaction 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 Viction nodes
const provider = new Web3.providers.HttpProvider('https://rpc.viction.xyz')
const web3 = new Web3(provider)

// Unlock wallet by private key
const account = web3.eth.accounts.privateKeyToAccount(pkey)
let coinbase = account.address
web3.eth.accounts.wallet.add(account)
web3.eth.defaultAccount = coinbase

// Make a transaction using the promise
web3.eth.sendTransaction({
    from: coinbase,
    to: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe',
    value: '1000000000000000'
})
.then(function(receipt){
    ...
});

Sign data

After unlock a wallet, you can sign some data

web3.eth.sign(dataToSign, address [, callback])

Parameters

  1. String - Data to sign. If String it will be converted using web3.utils.utf8ToHex.

  2. String|Number - Address to sign data with. Or an address or index of a local wallet in web3.eth.accounts.wallet.

  3. Function - (optional) Optional callback, returns an error object as first parameter and the result as second.

Example

const Web3 = require('web3')

// Connect to Viction nodes
const provider = new Web3.providers.HttpProvider('https://rpc.viction.xyz')
const web3 = new Web3(provider)

// Unlock wallet by private key
const account = web3.eth.accounts.privateKeyToAccount(pkey)
let coinbase = account.address
web3.eth.accounts.wallet.add(account)
web3.eth.defaultAccount = coinbase

// Make a transaction using the promise
web3.eth.sign('testdata').then(function(result){
    console.log(result)
});

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 the block with the input hash is finalized, thus irreversible.

How does Viction smart contract work?

Viction supports Solidity compiler version <= 0.8.17

Does Viction support multi-signature wallets?

Yes. Similar to Ethereum, you can use Gnosis MultiSigWallet.

Run Viction node

Please check for details how to run a Viction full node.

Viction JSON-RPC APIs
Web3.js
Ethers.js
This tutorial
eth_getBlockFinalityByNumber
eth_getBlockFinalityByHash
Run Viction Fullnode