Creating Tokens
You can create Token Contracts by clicking on Digital Assets
->Tokens
under Manage Resources
in the lefthand navigation in your Environment dashboard. The process of creating & deploying a token involves two steps:
- Create Token Contract
- Deploy an instance of the Contract Project
Create Contract Project
In the Token dashboard, click on Create Token
.
The first step involves picking the Signing Account that will be used to deploy the token contract to the blockchain. Click on Select Signing Account
button, this will load the Ethereum accounts available to the current user in various wallets within Kaleido. From the table of addresses displayed, pick the account you would like to deploy the contract with. You may also search for an address by clicking on the search icon. Click on Create Token
in the dialog box.
NOTE: Because many actions you perform in the Tokens service require sending transactions to the blockchain in the environment, it’s critical to use the proper account of your choice and make sure it’s selected here.
The next step is to import the contract. Kaleido provides four methods for generating/importing token smart contracts:
- The
Token Factory
service which provides templated options for fungible and non-fungible standards (derived from OpenZeppelin) - Local solidity source file
- Bytecode + ABI
- Github import
Use our Token Factory - Kaleido offers a number of template contracts you can use for your own projects. Kaleido Template Contracts are stored in a public Github repo owned by Kaleido, so you can always check out the source code the template is using. Currently we are featuring the following templates to choose from:
- ERC20 Tokens - Create an ERC20 token contract. Be sure to specify if you want your contract to be mintable, burnable, or both. (Constantinople EVM only)
- ERC721 Tokens - Create an ERC721 token contract. Be sure to specify if you want your contract to be burnable. (Constantinople EVM only)
Contract projects created with Kaleido Template Contracts are named Kaleido Contract Templates
. For more info on these contracts, visit the Token Factory page
Upload File with Source Code - Upload solidity
source code as a single file or zip file with dependencies. Kaleido will automatically detect the contracts in your file and compile the one you choose. In addition, you can also provide the following:
- EVM and Compiler versions - Kaleido will attempt to auto detect the appropriate version, but you can specifiy an override here if desired.
Paste Compilation Metadata - If you have already compiled your contract and have the ABI and Bytecode handy, you may use this option to deploy to your Kaleido environment.
Import from Github - Import your solidity file(s) from Github (supports Truffle projects as well). The compiler runs directly against your Github repo; simply copy over the URL (URL must end with ".SOL". Gist's and raw formats are not currently supported) of the Solidity file you want to compile and we extract the source from the chosen branch/tag/commit, import the dependencies (including via NPM as is common in Truffle projects), auto-detect the right Solildity version to compile with, and perform the compilation. Optionally, you can provide the following:
- Name of the contract to be compiled - only required if your Solidity file declares more than one contract.
- Github personal access token - only required if your code is in a private repository.
- EVM and Compiler versions - we will attempt to auto detect the appropriate version, but you can specifiy an override here if desire
Using the contract code that was selected above, Kaleido creates a Gateway API (A dynamic swagger console and downloadable specification for RESTful interaction with smart contract methods) and installs the API on every node in the environment.
Once imported, Kaleido creates a Contract Project
from your uploaded contract and provides an easy to use API gateway with auto-generated API, event streams (if applicable) and a transaction analyzer for transactions on your token contract. Multiple compiled versions are grouped together to support multi-party governance of the code.
Deploy Contract Instance
Using the Gateway API created in the previous step, you can now deploy an instance of the smart contract.
If you used Kaleido Contract Templates
in the previous step, you will be presented with a dialog prompting information about the Token instance to be deployed using the contract. You have the choice to either:
- Enter a Token Name, Token Symbol, Token Supply and Decimal count then click Deploy Token Instance OR
- Deploy the contract instance via the Swaggar interface by selecting View Factory API and executing an initial POST with the relevant parameters passed in the body
No matter which deployment option you chose for your instance, you will then be able to see the Gateway API along with the instances of the token contract that are deployed.
To interact with the deployed instance(s), click View instance API on the menu to the right of the instance in question. Each instance is also now programmatically available via its own endpoint.