### Install and Start Frontend Application Source: https://docs.viction.xyz/developer-guide/build-a-dapp-on-viction/interacting-with-the-dapp-in-a-browser Navigate to the frontend directory, install its dependencies, and start the development server to view your Dapp in the browser. ```bash cd frontend npm install npm start ``` -------------------------------- ### Hardhat Initialization Prompt Source: https://docs.viction.xyz/developer-guide/build-a-dapp-on-viction/setup-environment Example of the interactive prompt when running 'npx hardhat init', showing project setup options. ```bash $ npx hardhat init 888 888 888 888 888 888 888 888 888 888 888 888 888 888 888 8888888888 8888b. 888d888 .d88888 88888b. 8888b. 888888 888 888 "88b 888P" d88" 888 888 "88b "88b 888 888 888 .d888888 888 888 888 888 888 .d888888 888 888 888 888 888 888 Y88b 888 888 888 888 888 Y88b. 888 888 "Y888888 888 "Y88888 888 888 "Y888888 "Y888 👷 Welcome to Hardhat v2.18.1 👷‍ ? What do you want to do? … Create a JavaScript project Create a TypeScript project ❯ Create an empty hardhat.config.js Quit ``` -------------------------------- ### Dynamic Documentation Query Example Source: https://docs.viction.xyz/general/staking/staking-rewards Demonstrates how to make an HTTP GET request to query documentation dynamically. Append the 'ask' parameter with your question to the current page URL. ```bash GET https://docs.viction.xyz/general/staking/staking-rewards.md?ask= ``` -------------------------------- ### Full Web3.js Setup for ERC-20 Token Events Source: https://docs.viction.xyz/smart-contract-development/ides-and-tools/web3js This comprehensive example shows the complete setup for interacting with an ERC-20 token contract using Web3.js, including connecting to Infura and defining the contract's ABI. It's a foundational snippet for any Web3.js contract interaction. ```javascript const Web3 = require('web3') const web3 = new Web3('https://mainnet.infura.io/YOUR_INFURA_API_KEY') // OMG Token Contract const abi = [{"constant":true,"inputs":[],"name":"mintingFinished","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"unpause","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"mint","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"finishMinting","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_releaseTime","type":"uint256"}],"name":"mintTimelocked","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[],"name":"MintFinished","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}] ``` -------------------------------- ### Query Documentation Example Source: https://docs.viction.xyz/viction-data-availability/viction-da-rpc-api To get additional information not present on the page, perform an HTTP GET request with the 'ask' query parameter. ```http GET https://docs.viction.xyz/viction-data-availability/viction-da-rpc-api.md?ask= ``` -------------------------------- ### Install web3.js Library Source: https://docs.viction.xyz/smart-contract-development/ides-and-tools/web3js Install the web3.js library using NPM for your project. ```bash $ npm install web3 ``` -------------------------------- ### Install Setuptools on Ubuntu Source: https://docs.viction.xyz/masternode/run-a-full-node/tmn Install the 'setuptools' package for Python 3 on Ubuntu. This is necessary to fix 'pip3 install' errors related to missing setuptools. ```bash sudo apt install python3-setuptools ``` -------------------------------- ### Dynamic Documentation Query Example Source: https://docs.viction.xyz/masternode/run-a-full-node/docker Use this GET request to query the current documentation page dynamically. Replace `` with your specific, self-contained question in natural language. ```HTTP GET https://docs.viction.xyz/masternode/run-a-full-node/docker.md?ask= ``` -------------------------------- ### Install Foundryup Source: https://docs.viction.xyz/smart-contract-development/smart-contract-verification/foundry Installs Foundryup, the Foundry toolchain installer. This is a prerequisite for installing Foundry itself. ```shell curl -L https://foundry.paradigm.xyz | bash ``` -------------------------------- ### Start a Basic Viction Full Node Source: https://docs.viction.xyz/masternode/run-a-full-node/binary Use this command to start a standard Viction full node. Ensure all environment variables like $DATA_DIR, $NETWORK_ID, $PASSWORD, $IDENTITY, and $BOOTNODES are correctly set. ```bash tomo --syncmode "full" \ --announce-txs \ --datadir $DATA_DIR --networkid $NETWORK_ID --port 30303 \ --keystore $KEYSTORE_DIR --password $PASSWORD \ --identity $IDENTITY \ --mine --gasprice 250000000 \ --bootnodes $BOOTNODES \ --ethstats $IDENTITY:$WS_SECRET@$NETSTATS_HOST:$NETSTATS_PORT ``` -------------------------------- ### Install Foundry Source: https://docs.viction.xyz/smart-contract-development/smart-contract-verification/foundry Installs the Foundry framework after Foundryup has been set up. This command fetches and installs the latest stable version of Foundry. ```shell foundryup ``` -------------------------------- ### Install ethereumjs-tx Source: https://docs.viction.xyz/smart-contract-development/ides-and-tools/web3js Install the ethereumjs-tx library, which is used for signing transactions locally. This is a necessary step before you can proceed with creating and broadcasting transactions. ```bash $ npm install ethereumjs-tx ``` -------------------------------- ### Web3.js Contract Interaction Setup Source: https://docs.viction.xyz/smart-contract-development/ides-and-tools/web3js This snippet shows the basic setup for interacting with a smart contract using Web3.js, including initializing Web3 and defining the contract's ABI. ```javascript const Web3 = require('web3') const rpcURL = '' // Your RCP URL goes here const web3 = new Web3(rpcURL) const abi = [{"constant":true,"inputs":[],"name":"mintingFinished","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"mint","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"finishMinting","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_releaseTime","type":"uint256"}],"name":"mintTimelocked","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[],"name":"MintFinished","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed ``` -------------------------------- ### Example Script (Placeholder) Source: https://docs.viction.xyz/smart-contract-development/solidity This is a placeholder script indicating that no specific code example is available yet for this section. It suggests trusting the documentation's content. ```bash # Ain't no code for that yet, sorry echo 'You got to trust me on this, I saved the world' ``` -------------------------------- ### Verify Docker CE Installation Source: https://docs.viction.xyz/masternode/run-a-full-node/create-a-viction-masternode Run the 'hello-world' image to confirm Docker CE is installed and functioning correctly. ```bash docker run hello-world ``` -------------------------------- ### Install The Graph CLI Source: https://docs.viction.xyz/developer-guide/data-and-analytics Install the Graph CLI globally on your local machine using npm. ```bash npm install -g @graphprotocol/graph-cli ``` -------------------------------- ### Start a Fullnode with TMN Source: https://docs.viction.xyz/faq/masternode-and-voting/masternode Command to start a fullnode using the 'tmn' tool. Ensure 'your_private_key' is replaced with your actual private key. ```bash tmn start --name node_name --net mainnet --pkey your_private_key ``` -------------------------------- ### Install tmn Source: https://docs.viction.xyz/masternode/run-a-full-node Install the tmn command-line interface using pip. ```bash pip3 install --user tmn ``` -------------------------------- ### Start a Viction Full Node with tmn Source: https://docs.viction.xyz/masternode/run-a-full-node Start a new Viction full node using the tmn CLI. Replace placeholders with your node's name, desired network (testnet/mainnet), and your coinbase private key. Ensure you use a new account for security. ```bash tmn start --name [YOUR_NODE_NAME] \ --net testnet \ --pkey [YOUR_COINBASE_PRIVATE_KEY] ``` -------------------------------- ### Start Viction Node with RPC and WS APIs Enabled Source: https://docs.viction.xyz/masternode/run-a-full-node/binary This command starts a Viction full node and enables RPC and WebSocket APIs, which are necessary for dapp developers. It configures the node to listen on specific ports and allows connections from any origin. ```bash tomo --syncmode "full" \ --announce-txs \ --datadir $DATA_DIR --networkid $NETWORK_ID --port 30303 \ --keystore $KEYSTORE_DIR --password $PASSWORD \ --rpc --rpccorsdomain "*" --rpcaddr 0.0.0.0 --rpcport 8545 --rpcvhosts "*" \ --rpcapi "db,eth,net,web3,personal,debug" \ --ws --wsaddr 0.0.0.0 --wsport 8546 --wsorigins "*" --unlock "$YOUR_COINBASE_ADDRESS" \ --identity $IDENTITY \ --mine --gasprice 250000000 \ --bootnodes $BOOTNODES \ --ethstats $IDENTITY:$WS_SECRET@$NETSTATS_HOST:$NETSTATS_PORT ``` -------------------------------- ### Query Documentation Dynamically Source: https://docs.viction.xyz/masternode/run-a-full-node Perform an HTTP GET request to the current page URL with the 'ask' query parameter to get specific answers and relevant excerpts from the documentation. ```http GET https://docs.viction.xyz/masternode/run-a-full-node.md?ask= ``` -------------------------------- ### Query Documentation Dynamically Source: https://docs.viction.xyz/how-to To get specific information not readily available, make an HTTP GET request to the documentation URL with an 'ask' query parameter. The question should be clear and self-contained. ```bash GET https://docs.viction.xyz/how-to.md?ask= ``` -------------------------------- ### Create Project Directory for Viction Client Source: https://docs.viction.xyz/masternode/run-a-full-node/binary Prepare the workspace for downloading and building the Viction client from source code. ```bash mkdir -p $GOPATH/src/github.com/Viction/ cd $GOPATH/src/github.com/Viction/ ``` -------------------------------- ### Get List Candidates via VicMaster API Source: https://docs.viction.xyz/developer-guide/integration/viction-staking-governance Fetch the list of candidates using the VicMaster API. This example demonstrates a simple GET request to the `/api/candidates` endpoint. ```bash curl -X GET https://vicmaster.xyz/api/candidates \ -H 'Accept: application/json' ``` -------------------------------- ### Initialize Web3.js and Account Variables Source: https://docs.viction.xyz/smart-contract-development/ides-and-tools/web3js Sets up the Web3.js instance to connect to a test network and defines variables for the sender's account and private key. ```javascript var Tx = require('ethereumjs-tx') const Web3 = require('web3') const web3 = new Web3('https://ropsten.infura.io/YOUR_INFURA_API_KEY') const account1 = '' // Your account address 1 const privateKey1 = Buffer.from('YOUR_PRIVATE_KEY_1', 'hex') ``` -------------------------------- ### Get Viction Provider Source: https://docs.viction.xyz/viction-wallet/developer-guide Checks for the Viction provider and prompts the user to install it if not found. ```javascript function getProvider() { const provider = window.viction; if (!provider) { return window.open('https://chrome.google.com/webstore/detail/tomo-wallet/nopnfnlbinpfoihclomelncopjiioain?hl=vi'); } return provider; } ``` -------------------------------- ### Full Smart Contract Deployment with Web3.js Source: https://docs.viction.xyz/smart-contract-development/ides-and-tools/web3js This comprehensive example demonstrates the complete process of deploying a smart contract using Web3.js. It includes setting up Web3, defining accounts and private keys, obtaining the transaction count, constructing the transaction object, and signing it with private keys. ```javascript var Tx = require('ethereumjs-tx') const Web3 = require('web3') const web3 = new Web3('https://ropsten.infura.io/YOUR_INFURA_API_KEY') const account1 = '' // Your account address 1 const account2 = '' // Your account address 2 const privateKey1 = Buffer.from('YOUR_PRIVATE_KEY_1', 'hex') const privateKey2 = Buffer.from('YOUR_PRIVATE_KEY_2', 'hex') // Deploy the contract web3.eth.getTransactionCount(account1, (err, txCount) => { ``` -------------------------------- ### Set up Web3 Connection Source: https://docs.viction.xyz/smart-contract-development/ides-and-tools/web3js Establish a connection to the Ethereum network using Web3.js. This example connects to the Ropsten test network via Infura. ```javascript const Web3 = require('web3') const web3 = new Web3('https://ropsten.infura.io/YOUR_INFURA_API_KEY') ``` -------------------------------- ### Download and Build Viction Client from Source Source: https://docs.viction.xyz/masternode/run-a-full-node/binary Clone the Viction source code repository and build the client. This process involves downloading the code, checking out a specific version, and compiling the project. ```bash git clone https://github.com/BuildOnViction/tomochain.git Viction cd Viction git pull origin --tags git checkout v2.2.4 make all ``` -------------------------------- ### Get List Candidates via RPC Source: https://docs.viction.xyz/developer-guide/integration/viction-staking-governance Query the list of candidates using the `eth_getCandidates` RPC method. This example shows how to make a POST request to the Viction RPC endpoint. ```bash curl https://rpc.viction.xyz \ -X POST \ -H "Content-Type: application/json" \ -d '{"jsonrpc":"2.0","method":"eth_getCandidates","params": ["latest"],"id":1}' ``` -------------------------------- ### Read Total Supply of Tokens Source: https://docs.viction.xyz/smart-contract-development/ides-and-tools/web3js Call the `totalSupply()` function on a contract to get the total number of tokens in existence. This example demonstrates the basic callback pattern for Web3.js contract method calls. ```javascript contract.methods.totalSupply().call((err, result) => { console.log(result) }) // > 140245398 ``` -------------------------------- ### Initialize Web3 and Accounts Source: https://docs.viction.xyz/smart-contract-development/ides-and-tools/web3js Sets up the Web3 instance with an Infura provider and defines account addresses and private keys for transaction signing. ```javascript const Web3 = require('web3') const web3 = new Web3('https://ropsten.infura.io/YOUR_INFURA_API_KEY') const account1 = '' // Your account address 1 const account2 = '' // Your account address 2 const privateKey1 = Buffer.from('YOUR_PRIVATE_KEY_1', 'hex') const privateKey2 = Buffer.from('YOUR_PRIVATE_KEY_2', 'hex') ``` -------------------------------- ### Create and Initialize Hardhat Project Source: https://docs.viction.xyz/smart-contract-development/smart-contract-verification/hardhat Commands to create a new directory, navigate into it, initialize an npm project, install Hardhat, and run the Hardhat initialization command. ```bash mkdir hardhat-tomo-tutorial cd hardhat-tomo-tutorial npm init npm install --save-dev hardhat npx hardhat ``` -------------------------------- ### Verify Docker Compose Installation Source: https://docs.viction.xyz/masternode/run-a-full-node/create-a-viction-masternode Check the installed version of Docker Compose to confirm successful installation. ```bash docker-compose version ``` -------------------------------- ### Install Python 3 Pip Source: https://docs.viction.xyz/masternode/run-a-full-node/tmn Installs the Python 3 package installer (pip) on Debian-based systems. ```bash apt update apt install python3-pip ``` -------------------------------- ### Create and Navigate Foundry Project Source: https://docs.viction.xyz/smart-contract-development/smart-contract-verification/foundry Initializes a new Foundry project named 'hello_foundry' and changes the directory into the newly created project folder. ```shell forge init hello_foundry cd hello_foundry ``` -------------------------------- ### Install Node.js Version Manager (nvm) on MacOS Source: https://docs.viction.xyz/developer-guide/build-a-dapp-on-viction/setup-environment Installs nvm, installs Node.js version 16, sets it as the default, and upgrades npm on MacOS. ```bash curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash nvm install 16 nvm use 16 nvm alias default 16 npm install npm --global ``` -------------------------------- ### Initialize Hardhat Project Source: https://docs.viction.xyz/developer-guide/build-a-dapp-on-viction/setup-environment Initializes a new Hardhat project, installs Hardhat as a development dependency, and runs the Hardhat initialization wizard. ```bash npm init npm install --save-dev hardhat npx hardhat init ``` -------------------------------- ### Check Node.js Installation Source: https://docs.viction.xyz/smart-contract-development/ides-and-tools/web3js Verify if Node.js is installed on your system by checking its version. ```bash $ node -v ``` -------------------------------- ### Install Docker CE Source: https://docs.viction.xyz/masternode/run-a-full-node/create-a-viction-masternode Install the latest version of Docker Community Edition. ```bash sudo apt update sudo apt install docker-ce ``` -------------------------------- ### Start the Masternode Source: https://docs.viction.xyz/masternode/run-a-full-node/create-a-viction-masternode After configuration, use docker-compose to start your masternode in detached mode. ```bash docker-compose up -d ``` -------------------------------- ### Install Build Tools on Ubuntu Source: https://docs.viction.xyz/masternode/run-a-full-node/tmn Install essential build tools and Python development headers on Ubuntu systems. This is often required to resolve 'pip3 install' failures when packages need to be compiled. ```bash sudo apt install build-essential python3-dev python3-wheel ``` -------------------------------- ### List Viction Accounts in Keystore Source: https://docs.viction.xyz/masternode/run-a-full-node/binary Display all available accounts stored in the specified keystore directory. This command helps verify that accounts have been correctly initialized or imported. ```bash tomo account list --datadir $DATA_DIR --keystore $KEYSTORE_DIR ``` -------------------------------- ### Create Project Directory and Navigate Source: https://docs.viction.xyz/developer-guide/build-a-dapp-on-viction/setup-environment Creates a new directory for your Hardhat project and changes the current directory to it. ```bash mkdir hardhat-tutorial cd hardhat-tutorial ``` -------------------------------- ### Set Viction Binary Path (Alternative) Source: https://docs.viction.xyz/masternode/run-a-full-node/binary If not building from source, set an alias to the path of the downloaded Viction binary. This allows for direct execution of the client. ```bash alias tomo=path/to/tomo/binary ``` -------------------------------- ### Install Hardhat Toolbox Source: https://docs.viction.xyz/smart-contract-development/smart-contract-verification/hardhat Command to install the Hardhat Toolbox, which bundles commonly used Hardhat plugins. ```bash npm install --save-dev @nomicfoundation/hardhat-toolbox ``` -------------------------------- ### Install Docker CE Prerequisites Source: https://docs.viction.xyz/masternode/run-a-full-node/tmn Installs necessary packages for adding Docker's repository over HTTPS. ```bash sudo apt update sudo apt install apt-transport-https ca-certificates curl software-properties-common ``` -------------------------------- ### Install HTTPS Transport for Apt Source: https://docs.viction.xyz/masternode/run-a-full-node/create-a-viction-masternode Install necessary packages to allow apt to use a repository over HTTPS. ```bash sudo apt install apt-transport-https ca-certificates curl software-properties-common dirmirmngr gnupg ``` -------------------------------- ### Install Node.js and Git on Linux Source: https://docs.viction.xyz/developer-guide/build-a-dapp-on-viction/setup-environment Installs Node.js version 16.x and Git on Ubuntu-based Linux distributions. ```bash sudo apt update sudo apt install curl git curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - sudo apt-get install -y nodejs ``` -------------------------------- ### Deploying a Smart Contract with Web3.js Source: https://docs.viction.xyz/smart-contract-development/ides-and-tools/web3js This snippet demonstrates the process of deploying a smart contract using Web3.js. It requires the contract's ABI and bytecode, and an instance of the Web3.js library connected to a blockchain network. ```javascript const Web3 = require('web3'); const web3 = new Web3('YOUR_INFURA_URL'); // Or your provider const abi = [...]; // Your contract's ABI const bytecode = '0x...'; // Your contract's bytecode async function deployContract() { const accounts = await web3.eth.getAccounts(); const contract = new web3.eth.Contract(abi); const deployTx = contract.deploy({ data: bytecode, arguments: [/* constructor arguments */] }); const receipt = await deployTx.send({ from: accounts[0], gas: 1500000, gasPrice: '30000000000' // Example gas price }); console.log('Contract deployed at:', receipt.contractAddress); } deployContract(); ``` -------------------------------- ### Complete Web3.js Ethereum Transaction Script Source: https://docs.viction.xyz/smart-contract-development/ides-and-tools/web3js A full example script demonstrating how to set up Web3.js, define accounts and private keys, construct, sign, and broadcast an Ethereum transaction. ```javascript var Tx = require('ethereumjs-tx') const Web3 = require('web3') const web3 = new Web3('https://ropsten.infura.io/YOUR_INFURA_API_KEY') const account1 = '' // Your account address 1 const account2 = '' // Your account address 2 const privateKey1 = Buffer.from('YOUR_PRIVATE_KEY_1', 'hex') const privateKey2 = Buffer.from('YOUR_PRIVATE_KEY_2', 'hex') web3.eth.getTransactionCount(account1, (err, txCount) => { // Build the transaction const txObject = { nonce: web3.utils.toHex(txCount), to: account2, value: web3.utils.toHex(web3.utils.toWei('0.1', 'ether')), gasLimit: web3.utils.toHex(21000), gasPrice: web3.utils.toHex(web3.utils.toWei('10', 'gwei')) } // Sign the transaction const tx = new Tx(txObject) tx.sign(privateKey1) const serializedTx = tx.serialize() const raw = '0x' + serializedTx.toString('hex') // Broadcast the transaction web3.eth.sendSignedTransaction(raw, (err, txHash) => { console.log('txHash:', txHash) // Now go check etherscan to see the transaction! }) }) ``` -------------------------------- ### Install Docker Compose Bash Completion Source: https://docs.viction.xyz/masternode/run-a-full-node/create-a-viction-masternode Optional: Install bash completion for Docker Compose to improve command-line usability. ```bash sudo curl -L https://raw.githubusercontent.com/docker/compose/1.23.2/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose ``` -------------------------------- ### Dynamic Documentation Query Example Source: https://docs.viction.xyz/how-to/how-to-create-telegram-mini-apps Use this method to ask specific questions about the documentation when the answer is not explicitly present. The question should be self-contained and in natural language. ```HTTP GET https://docs.viction.xyz/how-to/how-to-create-telegram-mini-apps.md?ask= ``` -------------------------------- ### Get Proofs Success Response Source: https://docs.viction.xyz/viction-data-availability/viction-da-rpc-api A successful response to a get proofs request, returning an array of proofs for the specified IDs. ```json { "jsonrpc": "2.0", "result": [ [ 166, 226, 152, 3, 148, 197, 142, 68, 37, 3, 30, 235, 83, 168, 156, 244, 25, 94, 85, 95, 38, 18, 205, 209, 242, 109, 0, 45, 121, 48, 13, 160, 133, 205, 96, 223, 139, 179, 76, 141, 151, 183, 74, 156, 153, 101, 48, 136 ] ], "id": 128 } ``` -------------------------------- ### Query Documentation Dynamically Source: https://docs.viction.xyz/faq/masternode-and-voting Use this GET request to ask specific questions about the documentation. The response includes direct answers and relevant excerpts. ```HTTP GET https://docs.viction.xyz/faq/masternode-and-voting.md?ask= ``` -------------------------------- ### Initialize Viction Chain from Genesis Source: https://docs.viction.xyz/masternode/run-a-full-node/binary Initialize the Viction blockchain using the downloaded genesis file and the prepared data directory. This command sets up the initial state of the blockchain. ```bash tomo init $GENESIS_PATH --datadir $DATA_DIR ``` -------------------------------- ### Get Blob Success Response Source: https://docs.viction.xyz/viction-data-availability/viction-da-rpc-api A successful response to a get blob request, returning the requested blob data as a byte array. ```json { "jsonrpc": "2.0", "result": [ [ 104, 101, 108, 108, 111 ] ], "id": 128 } ```