Conceal API CLI

Read and communicate with the Conceal Blockchain

Conceal Network
5 min readMay 6, 2023

For most casual blockchain and/or cryptocurrency community members, they may largely come from non-technical backgrounds. This article will go into the Conceal API CLI, the Command line interface that any user can use to send requests and read information from the blockchain on. To start off, the GitHub repo for the Conceal API can be found here. The CLI or command line interface is usually a little daunting for non-technical users since there is no GUI (graphical user interface) into which they can easily click on buttons and/or have visual prompts to navigate them along the way. The CLI is the base way of sending commands via a computer — based language to communicate with the blockchain node. This is important to understand as people build applications, wallets, explorers, and so on to the blockchain, they will need some way to communicate back and forth (read/write) to the chain.

Node and Wallet

Conceal’s node is designed where there are two different daemons that communicate with each other to perform all operations, conceald and walletd.

The Conceal API CLI is designed with javascript to be able to accept commands to execute different operations on the node for both conceald and walletd. This is powerful as javascript is one of the most widely used programming languages in both web and blockchain development. People familiar with Javascript can develop basic applications or programs that will interface with the node and execute the commands programmed. In the GitHub repo, upon setup of a node locally, there is a quick test which is a mini-program to execute a transaction.

A Basic Payment Transaction

const CCX = require('conceal-api')
const ccx = new CCX({
daemonHost: 'http://localhost',
walletHost: 'http://localhost',
daemonRpcPort: 16000,
walletRpcPort: 3333
})

ccx.send([{
address: 'ccx7Xd3NBbBiQNvv7vMLXmGMHyS8AVB6EhWoHo5EbGfR2Ki9pQnRTfEBt3YxYEVqpUCyJgvPjBYHp8N2yZwA7dqb4PjaGWuvs4',
amount: 1234567
}])
.then((res) => { console.log(res) }) // display tx hash upon success
.catch((err) => { console.log(err) }) // display error message upon failure

Walking through the mini-program above, variables are created to create the requirements of where the wallet and daemon are located that will execute the commands. In this example, they are located at the localhost (or on the computer, the user is using) with the following ports, 16000 and 3333.

The following block of lines states for the wallet on the local machine to send a transaction to the address shown above and with the amount listed. This is an excellent example of how one can also just use Conceal API CLI to send a transaction directly into the CLI when connected to the node or execute the above code saved as a javascript file (.js).

The last two lines of this code are ways to receive confirmation of the transaction being completed either successfully or unsuccessfully. This is done by printing the output to the console log window.

Getting More Complex

The mini ‘send transaction’ example is a simple couple of lines of code that will send a transaction via the Conceal API, but much more complex logic and operations can be executed. In the GitHub repo, there are commands that are specific to the daemon and the wallet that can read from or execute commands to each respective device.

Below is an example of an API boilerplate template that can be used to build out more complicated commands and logic. Areas that have <text> are areas where the user can replace the holding text with the correct info detailed in the brownish-golden color text.

Commands for the wallet and/or daemon would follow this and would use the syntax highlighted in the GitHub repo.

const CCX = require('conceal-api')
const ccx = new CCX({
daemonHost: <daemonHost>,
walletHost: <walletHost>,
walletPath: <walletPath>,
daemonRpcPort: <daemonRpcPort>, // port for daemon
walletRpcPort: <walletRpcPort>, // port for walletd
walletRpcUser: <walletRpcUser>, // optional, if not set no authentication will be made
walletRpcPass: <walletRpcPass>, // optional, if not set no authentication will be made
timeout: <timeout> // timeout for RPC calls
})

Examples and Use Cases:

With the basic knowledge of how the Conceal API CLI works, the best part is that the number of use cases in which Conceal can be integrated is limitless and the Conceal API CLI will make the work involved in testing and debugging these integrations far more accessible.

Conceal Bot Payments on Social Media Apps

Although there are numerous bots that are already built on social media applications like Telegram and Discord, a payment bot can be developed where Conceal is utilized to make payments for goods and services that are conducted via these apps.

Connect Wallet Interface

Webpages can be designed to allow a user to connect a wallet and interact with a webpage. This is probably a pretty complex project but could be within the reach of a savvy developer who has experience in blockchain development.

Develop Applications and/or Websites that Use On-Chain Data

Websites can be given much richer color and information from the blockchain as long as the proper APIs are used and a node is accessible. Utilizing the Conceal API CLI, web developers will have an easy time hooking into Conceal Network’s blockchain data.

Give it a spin and see what you can create on Conceal Network!

Reach Out:

If there are additional ways and/or you want to help support and fight the cause reach out to the team in our Discord or across social media!

Come Join Us, Conceal in the Media:

--

--

Conceal Network
Conceal Network

Written by Conceal Network

Privacy-protected DeFi & Encrypted Communications

No responses yet