# Building a DApp on Venom !

By [Venom Ecosystem](https://paragraph.com/@venomecosystem) · 2023-09-06

---

In today’s fast-paced world, speed is everything. This is especially true in the blockchain space. One of the biggest challenges of blockchain technology is its slow transaction speed. This is caused by the decentralised nature of the technology, which requires consensus among all nodes on the network. Slow transaction speed can be a major hindrance for blockchain applications, particularly for decentralised applications (Dapps). This is where Venom comes in. Venom is a blockchain protocol designed to increase transaction speed while maintaining the decentralised nature of the blockchain.

In this post, we’ll explore how Venom can be used to build Dapps that are faster, more efficient, and more scalable.

### Venom Blockchain: TVM-based Sharding Supported Blockchain

The Venom blockchain offers many benefits, making it an attractive choice for users and developers. It is a safe place for everyone to build their blockchain-based solutions and conduct transactions securely and efficiently. Let’s dive deep into the details of what Venom has to offer a developer to build!

**1- TVM** — Threaded Virtual Machine By design, TVM has an asynchronous communication model between accounts. Each account can only affect the state of another account only by sending a message. It enables concurrent processing of multiple smart contracts, resulting in significant performance improvements compared to traditional virtual machines. [Learn More](https://docs.venom.foundation/learn/tvm/)

[![]({{DOMAIN}}/editor/youtube/play.png)](https://www.youtube.com/watch?v=TS13rwFMSL4)

**2-** **Masterchain**: The master blockchain holds the necessary information to achieve [Consensus](https://docs.venom.foundation/learn/glossary/#consensus) among validators.

**3-** **Workchain**: A type of blockchain in the Venom network under the Masterchain, which has its own state transition functions, cryptographic primitives, transaction or block structures, and native cryptocurrency while leveraging the security of the Masterchain.

4- **Shardchain**: It follows the same rules and block format as the work-chain, but is responsible for only a subset of accounts, based on several initial (most significant) bits of the account address. Since all these shard-chains share a common block format and rules, the Venom Blockchain is homogeneous in this aspect, similar to what has been proposed in one of the Ethereum scaling proposals.

You can learn more about the architecture of the venom Blockchain: [https://docs.venom.foundation/learn/architecture](https://docs.venom.foundation/learn/architecture)

### The Importance of Wallets in Web3

Wallets play a critical role in the world of blockchain and decentralised applications (Dapps). Unlike traditional applications, where users create usernames and passwords to access their accounts, blockchain applications require users to have a digital wallet.

### The Venom Wallet:

Creating a wallet with Venom is easy. Here’s a quick guide on how to set up a Venom Wallet: [https://docs.venom.foundation/general/wallet/create-a-new-wallet-account](https://docs.venom.foundation/general/wallet/create-a-new-wallet-account)

Once the wallet is set up, it’s time to move on the dropping some test tokens from the faucets.

You need some tokens to deploy your wallet or any other smart contract or for any interaction with any other smart contracts. You can get them from [Venom Faucet](https://faucet.venom.foundation/). Use smartly ;)

### Building a Fungible Token on Venom:

we will implement the fungible token type. This type of asset is divisible, non-unique, and interchangeable, i.e. one unit is equivalent to any other unit of this asset.

Venom uses TIP-3 as a protocol standard. Let’s learn more about what TIP-3 is.

Just as ERC-20 is the most popular standard in the Ethereum network, TIP-3 assumes the same role in the Venom network. TIP-3 was designed to match the distributed system design of the Venom network and is cost-effective for its fee-paying model.

TIP-3 provides the following functionalities

\*-transfer tokens from one account to another  
\-get the current token balance of an account  
\-\*get the total supply of the token available on the network  
\-_mint and burn tokens Difference between ERC-20 and TIP-3:_

### Difference Between ERC-20 and TIP-3

![Difference Between ERC-20 and TIP-3](https://storage.googleapis.com/papyrus_images/3d3492744066545df3034ac1bfe2cd70bb0a43877410e918f93309e09460c036.webp)

Difference Between ERC-20 and TIP-3

As you may know, the main value of the ERC20 contract is the balance mapping. Users have records of their balances and only interact with this contract. The TIP-3 working flow is different due to the asynchronous nature of TVM. Each user has their own wallet and operates it themselves. The wallet interacts with another wallet for transfers (see scheme).

![Venom Wallet Interaction](https://storage.googleapis.com/papyrus_images/3043a5cef6c5978e01602ce048ead1f396d36d7c4f2e95c37961e0a42a70b794.webp)

Venom Wallet Interaction

Each contract on Venom Blockchain can efficiently store contract code and calculate an address using state variables. Once the address has been computed, it can be compared to the msg.sender address. If they match, we can rest assured that the call is both secure and accurate.

### Setting up the Venom Development Environment:

Venom, a blockchain platform, enables developers to build decentralized applications (dApps) through the use of smart contracts. These smart contracts are created using locklift, which is similar to Hardhat and Truffle. Locklift provides a development environment that simplifies the process of building, testing, and deploying smart contracts, allowing developers to focus on the logic and functionality of the dApps they are building.

If you’re new to locklift, don’t worry — setting it up is very easy. You can refer to the guide provided by Venom Foundation [https://docs.venom.foundation/build/development-guides/setting-up-the-venom-smart-contract-development-environment/](https://docs.venom.foundation/build/development-guides/setting-up-the-venom-smart-contract-development-environment/) for step-by-step instructions on how to set up the Venom smart contract development environment. Once you have it set up, you’ll be able to start building your own dApps on the Venom platform. Happy coding!

### Deploying your first token to Venom Testnet

1.  Initiate the codebase using locklift:  
    `npx locklift init --path my-first-token`
    
2.  Install TIP-3 Dependencies:  
    Add this line in package.json
    

`{`  
`"devDependencies": {`  
`"tip3": "git://github.com/broxus/tip3#v5",`  
`...`  
`},`  
`}`  
  
Specify installed contracts to the external contracts section of locklift config, by providing a path to contracts artifacts (.abi.json files, .tvc files, etc., most commonly placed in a build folder of smart contracts projects) and contract names array.

`compiler: {`  
`...`  
`externalContracts: {`  
`"node_modules/tip3/build": ["TokenRoot", "TokenWallet"],`  
`},`  
`}`  
  
Now we can compile our contracts and make sure that artifacts were created

`npx locklift build`  
  
Create a file named — “contract.ts”

![File — Contract.ts ](https://storage.googleapis.com/papyrus_images/3686b7a0be871be5e10026d6de07dc98014653d1372e8f410fa927202e62cacb.webp)

File — Contract.ts

Let’s move to deploy action. Firstly, we make a new deploy script in scripts directory for the TokenRoot contract.

`import { Address, getRandomNonce, toNano, zeroAddress } from "locklift"`  
`import BigNumber from "bignumber.js"`

* * *

  
`async function main() {`  
`const signer = (await locklift.keystore.getSigner("0"))!`  
`// Address of initial token supply recipient (write your own) const initialSupplyTo = new Address("0:7542...")`  
`// Address of token owner (write your own) const rootOwner = new Address("0:7542...")`  
`// Name of the tokenconst name = "Venom India Token"`  
`// Symbol of the token const symbol = "VIT"`  
`// How many token will be issued instantly after deployconst initialSupply = 0`  
`// The number of decimals the token usesconst decimals = 18`  
`// If` `true`, `disables token minting const disableMint = false`  
`// If` `true`, `disables token burning by rootconst disableBurnByRoot = false`  
`// If` `true`, `pauses token burningconst pauseBurn = false`

`/* Returns compilation artifacts based on the .sol file name or name from value config.externalContracts[pathToLib].`  
  
`/* const TokenWallet = locklift.factory.getContractArtifacts("TokenWallet")`

`/* Deploy the TIP-3 Token Root contract. @params deployWalletValue: Along with the deployment of the root token, the wallet will be automatically deployed to the owner. This is the amount of EVERs that will be sent to the wallet.`  
  
`*/ const { contract: tokenRoot } = await`  
`locklift.factory.deployContract({`  
`contract: "TokenRoot",`  
`publicKey: signer.publicKey,`  
`initParams: {`  
`deployer_: zeroAddress, // this field should be zero address if deploying with public key (see source code)`  
`randomNonce_: getRandomNonce(),`  
`rootOwner_: rootOwner,`  
`name_: name,`  
`symbol_: symbol,`  
`decimals_: decimals,`  
`walletCode_: TokenWallet.code,`  
`},`  
`constructorParams: {`  
`initialSupplyTo: initialSupplyTo,`  
`initialSupply: new`  
`BigNumber(initialSupply).shiftedBy(decimals).toFixed(),`  
`deployWalletValue: toNano(1),`  
`mintDisabled: disableMint,`  
`burnByRootDisabled: disableBurnByRoot,`  
`burnPaused: pauseBurn,`  
`remainingGasTo: zeroAddress,`  
`},`  
`value: toNano(5),`  
`})`  
`console.log`(`${name}: ${tokenRoot.address}`)  
`}`  
`main()`  
`.then(() => process.exit(0))`  
`.catch(e => {`  
`console.log(e)`  
`process.exit(1)`  
`})`  
  
**Finally, we can deploy a new token to local network. For this, make sure the local node is running, if not follow the next command**

Make sure you have Docker installed locally in your system.  
`docker run -d --name local-node -e USER_AGREEMENT=yes -p80:80 tonlabs/local-node`

and run the deploy script

`npx locklift run -s ./scripts/01-deploy-token.ts -n local`

`>Found 1 sources`  
`>factorySource generated`  
`>Built`  
`>First Venom Token: 0:69f2407386ca20390878565da97124be717f65496cb03e14aaa676709a6ccb2b`  
  
That’s it! Currently, we have LockLift as a library that supports T-SOL compilation and deploying it to the localnet. In the next series, we will explore deploying contracts on testnet.

If you have any questions or queries, feel free to reach out. Join our community on Twitter and Telegram and get access to daily updates, details on upcoming Venom releases, technical guides, ecosystem updates, educational content, bounties, grants, hackathons & more!

Let’s BUIDL great things together!  
  
**To learn more about Venom, check out the following links:**

Website: [https://venom.foundation/](https://venom.foundation/)

Testnet: [https://venom.network/](https://venom.network/)

Whitepaper: [https://venom.foundation/Venom\_Whitepaper.pdf](https://venom.foundation/Venom_Whitepaper.pdf)

Documentation: [https://docs.venom.foundation/](https://docs.venom.foundation/)

Twitter: [https://twitter.com/venomfoundation](https://twitter.com/venomfoundation)

---

*Originally published on [Venom Ecosystem](https://paragraph.com/@venomecosystem/building-a-dapp-on-venom)*
