Creating Indexchain Smart Chains
Introduction
Requirements for Creating a New Chain
2 nodes with the ability to open ports (a node can be either a computer or a VPS)
At least 4GB RAM each
At least 2 CPU cores each
64-bit Operating System (Ubuntu 18.04 recommended)
Indexchain Smart Chain software installed on each
(when the goal is only to build a new Smart Chain, there is no need to sync the DIC main chain)
::: tip When you are building and testing a Indexchain Smart Chain, please do not hesitate to reach out to us when you are stuck. We wish to make this as easy as possible. Our support agents are available in our #support channel in Discord for many hours each day. :::
Basic Info for Connecting At Least Two Nodes
Basic knowledge about how to connect two nodes is recommended for the initial setup.
As per the original blockchain designs of Satoshi Nakamoto, a Indexchain Smart Chain does not exist on a single node. Rather, it exists via a connection between two or more nodes. This is the nature of decentralization: it is on the network we rely, rather than a single authority. Therefore, the design of the technology encourages the developer to have two separate nodes which are able to connect over a network.
In the most ideal circumstance, the new Indexchain developer will already have two virtual private servers (VPS's) available for testing. VPS's can be cheap and easy to manage. A typical VPS will either have a static external IP or can be assigned one.
If the new developer does not have two VPS's available, setting up a test Smart Chain on two local machines in a home or office-type setting is still achievable, but it may require more troubleshooting.
When using a home or office-type setup, the challenge lies in the way the network is created, and there are myriad network setups.
For example, if the developers are operating on a local router, where the two machines are connected via wifi, the local ip addresses of the machines are harder to find. This is because the router assigns new local ip addresses to the machines each time they re-connect to the router. It is not possible to see the ip addresses from the Internet. In this situation, the developer must log into the router's software interface and search for the currently assigned local ip addresses.
A home or office-type setup can suffice, if you're just looking to test an Smart Chain quickly and don't want to spend money on a VPS. However, don't be surprised if you need to ask for help. Please reach out to us, and we'll help the best we can.
To test the creation of a Smart Chain using only a single node, see these linked instructions.
To prepare for the next step, execute the following command in the terminal on both machines:
From the response, record the ip address
value for additional use.
With the ip addresses available, we are now prepared to test the connection between the machines.
This command will generate a response every second, indicating the ping
speed with which your machines are able to connect.
If you do not see a similar response in the shell, your machines are not able to connect. Please reach out to our team and we will do our best to assist you.
Part I: Creating a New Indexchain Smart Chain
With your machines successfully able to ping
each other, you are ready to create your first Smart Chain.
The following instructions use the simplest possible set of parameters in creating a new Smart Chain: a coin with the ticker symbol HELLOWORLD
, 777777
pre-mined coins, and a block reward of .0001
.
On your first node, change into the directory where Indexchain's Indexchain and komodo-cli
are installed and execute the following commands in the terminal:
Mac & GNU/Linux
Windows
Verify the Response
After issuing this command in the terminal on both machines, you will find the p2p port in the terminal window.
In the above string, take note of the p2p and RPC ports, as well as the magic number. These values must match on both nodes for the chains to be identical. If they are not the same, verify that the launch command is the same on both the nodes.
In the example above, the p2p port is 8096
. Make sure that the p2p port is open to the internet or any other network from which the second node connects.
This completes the first half of the Smart Chain creation process. Scroll down to Part II.
::: tip Please refer to Antara Customization parameters for a full list of parameters to customize the characteristics of your blockchain. :::
::: tip Please note the requirements for ac_supply, and instructions for using addnode under various network conditions, including firewalls and LANs. :::
Part II: Connecting the Second Node
On the second node you issue the same command, but with a key difference. This time, use the first node's IP address.
Once the daemon loads, compare the string that starts with >>>>>>>>>>
in the second node to the one from the first node to make sure they are identical.
Mining can be started on a node using the following command:
$(nproc)
in the above command makes the daemon mine using all the available CPU threads, which might be necessary in a low end VPS.
On a Indexchain-based blockchain, all of the pre-mined coins are mined in the first block. Therefore, whichever machine executes the mining command will receive the entirety of the blockchain's pre-mined coin supply, as set in the ac_supply parameter. Upon mining the first block, these coins are available in the default wallet.dat
file.
To collect all the mining rewards from the node to a single address, execute the following commands before issuing the setgenerate
command:
After issuing the mining command is issued, can check that the two nodes are connected by using the following command:
If the nodes are properly connected, both nodes will respond with: "connections": 1
These are the coins you will later distribute to your community, using either our native DEX, AtomicDEX, or our decentralized-ICO software (coming soon), or on any other third-party exchange.
You can check the contents of the wallet by executing the following command in the terminal:
To verify that everything is properly initiated, send a few coins from the second node to the first node:
<collapse-text hidden title="Commands">
Node1
Node2
Node1
</collapse-text>
More info can be found in the debug.log of the chain found at:
MacOS:
~/.komodo/HELLOWORLD/debug.log
Windows:
%appdata%\komodo\HELLOWORLD\debug.log
GNU/Linux:
~/.komodo/HELLOWORLD/debug.log
Querying the Smart Chain
Using the komodo-cli
software, which is included in any default installation of komodod
, you can now execute many commands on your new Smart Chain. This enables you to perform transactions, create and execute smart contracts, store data in KV storage, etc.
Since the Indexchain software began as a fork of Zcash and BTC, essentially all commands that are available on these two upstream blockchains are also available on your new Smart Chain.
Furthermore, a key purpose of the Indexchain blockchain is to create features and functions that facilitate and enhance your development experience. Information regarding these enhancements is available throughout this documentation.
In addition, since you are building on a Indexchain-based blockchain, you have easy access to our multi-coin wallet and atomic-swap powered decentralized exchange, AtomicDEX, the Antara development framework and modules, our decentralized-ICO software, and our future upgrades.
Example commands
To see general information about your new Smart Chain, execute this command:
./komodo-cli -ac_name=HELLOWORLD getinfo
The following command returns information about all available RPC and API commands:
./komodo-cli -ac_name=HELLOWORLD help
Secure this Smart Chain with Delayed Proof of Work
Your new Smart Chain can receive the same security of the Bitcoin hash rate through our security mechanism, called "delayed Proof of Work" (dPoW).
There are two aspects to the cost for dPoW services. The first comes from the cost of making records in your Smart Chain's database, and in the records of the DIC main chain. These records are called "notarizations."
Notarizations are performed as transactions on your blockchain and on the main DIC blockchain. The transactions have messages included inside that indicate the most recent and secure state of your Smart Chain. Your Indexchain Smart Chain will know how to recognize and rely on notarizations automatically.
Every ten to twenty minutes, our notary nodes will hash the history of your Smart Chain and insert it as a record into the DIC main chain. This provides an initial layer of security, but it is not the final layer.
In another ten to twenty minutes, all of the information in the DIC chain (including your Smart Chain's hashed data) is hashed and inserted into the BTC blockchain. Once your information is pushed into BTC, your Smart Chain will consider all notarized information effectively settled and immutable; only the recent, un-notarized transactions are still relying on your Smart Chain's raw consensus mechanism.
Thus, your Smart Chain will have all the power of Bitcoin securing your blockchain's history, with the zero-knowledge privacy of the Zcash parameters pre-installed, and all of the interoperability, scalability, and more that Indexchain adds to your development experience.
As the notarizations are transactions, they naturally have a cost, and this cost is covered by you, the Smart Chain developer. Over the course of a year, assuming consistent activity, the cost for performing these transactions is 365 DIC , and also 365 of your Smart Chain's coins.
There are extra costs involved that are aimed to compensate the Notary Nodes for the setup and maintainance of the dPOW service. You may reach out to our third-party service providers to receive a quote. They can provide various services related to Smart Chain creation, electrum-server (SPV) setup and maintenance, explorer setup, and other blockchain services.
Click Here for the List of Third-Party Service Providers
Several teams have already signed up for our services and are developing on our platform. From our experience with them we can confidently say that our pricing is competitive compared to other blockchain services. Furthermore, when considering that a Indexchain-based Smart Chain does not require DIC for gas and transaction fees, the cost to your end-users can be exponentially cheaper. All things considered, creating a fully independent blockchain on Indexchain can cost but a small fraction of what it would cost to deploy a single smart contract on the platforms of some of our competitors.
A Note About Low-Activity Blockchains
Blockchain technology relies on a network of users using the blockchain and sharing data to function.
Smart Chains that are built for low-activity networks require extra steps from the developer to ensure proper syncing between nodes.
If you are building a Smart Chain and would like more information on maintaining constant syncing across nodes, our third-party service providers can provide dedicated support for this topic. Please also reach out to our support team and community on Discord.
Last updated
Was this helpful?