ZENIQ SMART CHAIN
Introduction
Take care that this instructions are mainly focused on smart contracts using Solidity as programming language.
The environment used here for the examples is Truffle → See here for installation instructions
Other common options to compile and deploy smart contracts would be Hardhat, Waffle, Brownie or Remix IDE just to name a few. It should be possible to guess the right parameters to be used for that environments by reading the following instructions.
Wallet
To be able to transfer values in an easy way and to interact with dApps Metamask is used here. It is a browser extension creating a bridge between web3 dApps and the BlockChain in the background.
Configure Metamask by going to Settings
→ Networks
and click the Add a network
button. Input following values and confirm with Save
.
RPC URL:
https://smart1.zeniq.network:9545
https://smart2.zeniq.network:9545
https://smart3.zeniq.network:9545
http://smart1.zeniq.network:8545
http://smart2.zeniq.network:8545
http://smart3.zeniq.network:8545
Chain ID:
383414847825
Block chain explorer:
smart.zeniq.net (smart chain)
core.zeniq.net (main chain)

Initialization I
Create a new directory and change into that directory.
Run following commands in that new (and empty) directory:
npm init
truffle init
Initialization II
Adapt the dependencies within the project in package.json
to be able to also deploy the compiled smart contract:
...
"dependencies": {
"@truffle/hdwallet-provider": "^1.7.0",
"truffle": "^5.4.30"
},
...
You will also need to install the dependencies using following command in the directory which will hold the smart contract:
npm i
Configuration
Once you have your preferred development framework installed you need to configure it to work with the Zeniq Smart Chain.
Use the following parameters (as example for Truffles truffle-config.js
) to connect to the right network:
const HDWalletProvider = require('@truffle/hdwallet-provider');
const MNEMONIC = "12 word phrase"
...
module.exports = {
...
networks: {
...
zeniq: {
provider: () => new HDWalletProvider(MNEMONIC, 'http://85.209.55.34:8545'),
network_id: "*"
}
},
};
1) Edit - Compile - Deploy
Edit the contract in the contracts
directory. As example you can take the following example which increment and decrement a counter (using Counter.sol
as filename here):
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
contract Counter {
uint public count;
constructor() {
count = 0;
}
// rather doing a transaction than a call -- https://github.com/trufflesuite/truffle/issues/3105#issuecomment-644311706
function get() public /*view*/ returns (uint) {
return count;
}
function inc() public {
count += 1;
}
function dec() public {
require(count > 0, "Can not decrement further");
count -= 1;
}
}
2)
It is also possible to launch unit test with truffle – to be able to do that you need some test within the test
directory (using TestCounter.js
as filename here):
const counter = artifacts.require("Counter");
contract("Testing Counter test contract for test purposes", async accounts => {
it("we have something there", async () => {
const instance = await counter.deployed();
const start_value = await instance.get.call();
assert.equal(start_value, 0, 'Increment failed');
await instance.inc();
var current_value = await instance.get.call();
assert.equal(current_value, 1, 'Increment failed');
await instance.dec();
current_value = await instance.get.call();
assert.equal(current_value, 0, 'Decrement failed');
});
});
3)
To deploy (or migrate) the smart contract to the BlockChain truffle uses some sourcecode to control the order and functionality. As first step add following content to a file called 2_deploy_contracts.js
in the directory migrations
:
var Counter = artifacts.require("Counter");
module.exports = function(deployer) {
deployer.deploy(Counter);
};
4)
Set up all the files in the right location you can compile the smart contract by following command:
truffle compile
5)
When the smart contract compiled successful you can “upload” it to the BlockChain:
truffle migrate --network zeniq
6)
migrate
and deploy
are the same mechanism – you can also force the upload with:
truffle deploy --network zeniq --reset
7)
When the smart contract is deployed to the BlockChain running the unit tests is possible with:
truffle test --network zeniq
8)
You can follow the transactions and calls with the BlockExplorer
9)
Testing single aspects of the smart contracts can be done with truffle too – for example try:
truffle console --network zeniq
[wait for the prompt]
let contract = await Counter.deployed()
contract.get.call()
contract.inc()
contract.dec()
contract.dec()
As starting point for further experiments with smart contracts you can take a look at the OpenZeppelin framework, specially the Contracts Wizard
Frameworks
Trufflesuite (Javascript)
https://trufflesuite.com/
Brownie (Python)
https://eth-brownie.readthedocs.io/en/stable/
Libraries
OpenZeppelin Contract Standards (Check out tools )
https://github.com/zeniqsmart
Web3.js Documentation
https://web3js.readthedocs.io/en/v1.7.3/
Web3.py Documentation
https://pypi.org/project/web3/
ethers.js Documentation
https://docs.ethers.io/v5/
Brownie Mixes
https://github.com/brownie-mix
Truffle Boxes
https://trufflesuite.com/boxes/
IDE Extensions
VIM:
Syntax highlighting for Solidity
https://github.com/tomlion/vim-solidity
Syntax highlighting for Vyper
https://github.com/vyperlang/vim-vyper
Visual Studio Code:
Solidity Extension
https://marketplace.visualstudio.com/items?itemName=JuanBlanco.solidity
Truffle Extension
https://marketplace.visualstudio.com/items?itemName=trufflesuite-csi.truffle-vscode
JetBrains IDEs:
Solidity Extension
https://plugins.jetbrains.com/plugin/9475-solidity
Truffle Extension
https://plugins.jetbrains.com/plugin/18559-truffle
Languages
Learn Solidity in Y Minutes
https://learnxinyminutes.com/docs/solidity/
Solidity By Example
https://solidity-by-example.org/
JavaScript By Example
https://javascriptbyexample.com/
Learn Vyper in Y Minutes
https://learnxinyminutes.com/docs/vyper/
Vyper By Example
https://vyper.readthedocs.io/en/stable/vyper-by-example.html
Python By Example
https://www.learnbyexample.org/python/