There are two ways to initialize a node: by command line and by code.
If you are using the CLI or code it is recommended that you configure your network using an Interbit configuration file. This file enables you to configure apps, peers, covenants, and chain joins all in one place.
To develop Interbit applications, your development environment will need the following software:
Once you have setup your configuration file to your liking you can use
the start or
build and
deploy commands to start your
node.
First, install the CLI in your project if you have not already. If you
have followed the Getting Started guide
and used the template this package and the following scripts are already
configured with a corresponding interbit.config.js file.
npm i --save interbit-cliThis adds interbit-cli to your npm project's package.json file.
Once you have added the dependency, you need to setup the start, or
build and deploy scripts in your package.json scripts.
Inside of package.json:
{
"scripts": {
"start": "interbit start --config interbit.config.js",
"build": "interbit build --config interbit.config.js --manifest interbit.manifest.json",
"deploy": "interbit deploy --manifest interbit.manifest.json"\
}
}You can also run a node using the interbit package, which the cli uses
under the hood to make everything run. The interbit package contains
more granular functionality and can be more customized.
You will need to install interbit in your dependencies list. If you
have forked and are using the template it is already included as a
dependency of interbit-cli
npm i --save interbitThe package comes with a set of granular functions for starting a node as well as a handy dandy deploy function that does all of the work of applying covenants, starting and loading chains, and creating an interbit instance and cli to interact with.
const {
startInterbit,
createChains: {
createChainsFromConfig,
createChainsFromManifest
}
} = require('interbit')
const { cli, hypervisor } = startInterbit()
// You can use the cli to create chains, deploy covenants, and configure them from here
// ... or, you can create a set of chains using a config or manifest file
const config = require('interbit.config.js')
const { chainManifest, covenantHashes } = await createChainsFromConfig(cli, config)
const manifest = require('interbit.manifest.json')
await createChainsFromManifest(process.cwd(), cli, manifest)Please check out the
web-auth-endpoint
package for an example of deploying a node in code. Please note that
this package has used an
interbit.config.js
configuration file to build a
manifest file prior to
deploying the Interbit node.
Further Documentation: