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. 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 templates for standard fungible and non-fungible tokens with Tokenfactory
service. Alternatively, you can deploy your own token smart contract by uploading the source file, pasting the compiled contract with metadata or importing your solidity file(s) from github. Once imported, Kaleido creates a Contract Project
from your uploaded contracts 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.
The following methods are available to import a contract:
- 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
- Upload source file - 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 compiled ABI/Bytecode - If you have already compiled your contract and have the ABI and Bytecode handy, you may use this option
- 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
Provide a name for the Project (except Kaleido Tokenfactory, which is automatically named as Kaleido Contract Templates
). The name will be used to identify the token contract in the dashboard and the Block explorer. Click Next.
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.
Deploy Contract Instance
Using the Gateway API created in the previous step, you can:
- Deploy instances of the contract - on any of the nodes
- Send transactions - Use the API to interact with existing on-chain smart contracts
If you used Kaleido Contract Template
in the previous step, you will be presented with a dialog prompting information about the Token instance to be deployed using the contract. Enter:
- Token name
- Token symbol
- Total supply
- Decimals (optional, default is 18)
and click on Deploy Token Instance
. After this step is successful, you will see the Gateway API along with the instances of the token contract that are deployed.
Alternatively, you can click on View Gateway API
to view the factory Gateway API and select a node. Note that this factory API can be used to create instances of the contract and subsequently invoke operations on the deployed instance. The gateway API is scoped to the node selected when viewing the API.