New Tool "Arkinos": Create and deploy Koinos contracts FAST

in #koinos7 months ago

Koinos-Dev_News-Contracts-TW.png

Today I’m introducing a new tool that dramatically simplifies contract development on Koinos. With this tool you can create a new contract and have a website to interact with it in less than 5 minutes!

The tool has three contract templates; Token, NFT, and Generic. All you need is NodeJS installed in your PC and passion to learn about Koinos.

The tool is already available on NPM: https://www.npmjs.com/package/arkinos

Templates

You can select between 3 different templates:

  1. Token Contract: This contract includes allowances and also the new security features implemented after the governance proposal.
  2. NFT Contract: This NFT contract not only has allowances and the security feature after the governance proposal, but also new features like storing metadata on chain and more functions to query the existing data (more info in KCS-5 proposal).
  3. Generic Contract: Very simple contract to understand the basic concepts when developing contracts on Koinos, like writing data in the storage.

Frontend - Next.js

The tool comes with a frontend in Next.js (React) to interact with the contract. If you are already familiar with ReactJS you will have no problem.

The frontend has the principal koinos code in a folder called koinos with simplified documentation to save you time when learning this topic.

Arkinos supports all Koinos wallets: Kondor Wallet, Wallet Connect (to connect with Konio or Portal), and My Koinos Wallet.

image.png

How to use it

To begin you must have NodeJS installed on your PC. Open your terminal and run npx arkinos. Now follow the instructions in the terminal to give your dApp a name and select your preferred contract. For this example we will use the Token contract.

image.png

Once it is downloaded open the folder and run:

yarn install
yarn build

Now you need an address and private key for your new Token. If you already have it then copy it. If not then run yarn keys to generate a seed with some private keys. They will be displayed in the terminal.

Open .env file and fill the private key for the contract in harbinger:

HARBINGER_CONTRACT_PRIVATE_KEY=

Now we are ready to deploy the contract. Run:

yarn deploy

Congratulations 🎉 you have just deployed a contract in testnet!

Go to https://harbinger.koinosblock.com to check address of your token. You can also use this explorer to interact with the contract.

Now, let's bootstrap a front end for the token. Go back to the terminal and run:

yarn updateFrontend

This command will copy the address and the ABI to the frontend. Finally, launch the frontend:

yarn dev

Open http://localhost:3000 to access the front end.

image.png

You can connect your wallet and start testing your contract.

Open the README.md file in the folder of your project to get more info about how to update the constants, mint tokens, or deploy in mainnet.

The setup is ready. Now you can extend this contract to meet the specific functionalities you want for your dApp. You just have to run yarn build after you update it, yarn deploy to deploy it again in the same address, and then yarn updateFrontend to update the ABI in the frontend with the new functions.

With Arkinos contract Koinos development is easier than ever! Let's build amazing dApps in the ecosystem!

If you’d like to begin using the tool, download the NPM package here: https://www.npmjs.com/package/arkinos

Sort:  

Interesting and probably useful in many cases. I will bookmark and revisit. Thanks!

Curated by @arc7icwolf.byte for the #LearnToCode community.