Upgrading the KOIN and VHP Tokens

Michael Vandeberg
Koinos Network
Published in
5 min readSep 26, 2024

I am excited to announce that testing of the updated KOIN and VHP contracts has begun on the Harbinger Testnet! This announcement is primarily for Koinos developers, but all community members are welcome and encouraged to help test this update.

The proposal

This governance proposal updates the KOIN and VHP contracts to be compliant with the new KCS-4 standard. This standard extends the allowance feature of the KCS-3 standard to respect smart contract wallets and adds optional memo fields to transfer, mint, and burn operations. For the KOIN contract this is also a conversion from C++ to Assembly Script.

What does this mean for existing dApps?

The biggest change for existing dApps is the addition of allowances for KOIN and VHP. If your smart contract interacts with KOIN, you will need to approve an allowance transfer beforehand. For most contracts, you can create the allowance in the same transaction as an earlier operation or in an earlier transaction prior to calling your smart contract. It is best practice to request the smallest allowance required for the transaction to succeed. Almost all dApps that interact with KOIN are affected by this change.

The requirement of allowances also impacts block production. As you know, in order to produce blocks you require VHP. In order to acquire VHP, you can burn KOIN using the Proof of Burn contract. This interaction is the exact kind of interaction that allowances are designed to secure. As such, in order to burn KOIN for VHP, you will either need to set an allowance for the PoB contract prior to burning KOIN, or you will need to burn KOIN using a smart wallet that explicitly approves the operation. Burning VHP during block production will remain unaffected as it was decided that this particular circumstance is unique and secure via governance.

We have confirmed with Julian that Fogata will continue to operate without any updates. However, BurnKoin’s current contracts are not compatible with this change and as a result will no longer be able to operate without a new smart contract. BurnKoin will be announcing more information on how to navigate the planned KCS-4 update. Additionally, anyone operating a node manually will need to add this step when burning KOIN for VHP.

The contract addresses for KOIN and VHP will also be changing. This is a good time to remember to retrieve the addresses of these contracts using the built in system name service (‘koin’ and ‘vhp’ respectively) or nicknames (‘@koin’ and ‘@vhp’ respectively).

For anyone needing the contract addresses for testing, they are:

KOIN: 1HnCM6v2bLg8Qhw6BKCVhGPeoTamJbkbFi
VHP: 1CrLSiK8aJVEg7L94TapoGTmAqnZW9qNzA

How do I test?

The new contracts will go live on testnet shortly. If you use any dApps regularly, please reach out to those developers for information on using their dApps on testnet.

Additionally, we have created two contracts that have been helpful in our testing of the update. They are here: https://github.com/koinos/koinos-contracts-as/tree/koin-wrapper

The first contract, KOIN Wrapper, does exactly what it says. It is a thin wrapper around the KOIN contract that allows you to easily call any of the KOIN functions from another contract. This is useful in testing scenarios where a token is being called from another contract. With the update, transferring KOIN using the KOIN Wrapper contract should be forbidden unless you grant the KOIN Wrapper contract an allowance or explicitly allow the behavior from a smart wallet.

KOIN Wrapper: 1Bq58wf8mMSZQF3Rk7UUe1ziY8NjsaGAQx

The second contract is the Mock Smart Wallet. This contract creates a mock smart wallet for interacting with contracts. By default, it authorizes all calls, but you can set authorizations using the set_authorization function. With this function you can specify a contract, entry point, and boolean expressing authorization or not. When authorization is requested for the contract and entry point, the desired authorization will be returned. You can also pass in an entry point of 0 to set authorization for all entry points in a contract. You can also call the clear_authorization function to clear authorizations set for a contract and/or entry point, resetting them to the default. Using this contract, you can test the smart wallet aspects of this update and ensure KOIN and VHP are correctly defaulting to the smart wallet when it exists.

You will need to build and upload the Mock Smart Wallet yourself.

If you need tKOIN for testing, you can always request some automatically using the Faucet in Discord. Or, if you require more, you can request tKOIN from @vandeberg in the #testnet channel or via a direct message in Discord.

Next steps

This update affects many aspects of the Koinos ecosystem. We want to be sure the upgrade goes smoothly, so we will be waiting for the go ahead from major stakeholders of the ecosystem such as, but not limited to, KoinDX, Kollection, KoinCity, Fogata, Kondor, BurnKoin, and others. When we have certainty that the upgrade will proceed smoothly, we will propose it on mainnet. After a week for review, the proposal will be voted on by block producers.

If you are operating a burn pool, please inform your users of how you will be voting.

If you are participating in a Fogata pool or BurnKoin, please engage with your pool operator about whether they will approve the proposal or not so that you can move your VHP accordingly to align with your desired outcome. Whether you approve of this proposal or not, it is crucial that you understand how your VHP will be counted, either in favor or against the proposal, so that you can participate in Koinos’ governance process.

Resources

The operations in the proposal do the following:

  1. Set the new Koin contract as a system contract
  2. Set the get_accout_rc system call to the new Koin contract
  3. Set the consume_account_rc system call to the new Koin contract
  4. Set the Name Service record ‘koin’ to the new Koin contract
  5. Transfer the ‘@koin’ nickname to the new Koin contract
  6. Remove system contract permissions from the old Koin contract
  7. Set the new VHP contract as a system contract
  8. Set the Name Service record ‘vhp’ to the new VHP contract
  9. Transfer the ‘@vhp’ nickname to the new VHP contract
  10. Remove system contract permissions from the old VHP contract

Here is the proposal operation JSON for inspection:

{
"call_contract": {
"contract_id": "17MjUXDCuTX1p9Kyqy48SQkkPfKScoggo",
"entry_point": "submit_proposal",
"args": {
"operations": [
{
"set_system_contract": {
"contract_id": "1HnCM6v2bLg8Qhw6BKCVhGPeoTamJbkbFi",
"system_contract": true
}
},
{
"set_system_call": {
"call_id": 201,
"target": {
"system_call_bundle": {
"contract_id": "1HnCM6v2bLg8Qhw6BKCVhGPeoTamJbkbFi",
"entry_point": 759581355
}
}
}
},
{
"set_system_call": {
"call_id": 202,
"target": {
"system_call_bundle": {
"contract_id": "1HnCM6v2bLg8Qhw6BKCVhGPeoTamJbkbFi",
"entry_point": 2162423241
}
}
}
},
{
"call_contract": {
"contract_id": "13NQnca5chwpKm4ebHbvgvJmXrsSCTayDJ",
"entry_point": 3796420410,
"args": "CgRrb2luEhkAuA4z1VEWTTde23Vcj6yVbdFtaF-McboV"
}
},
{
"call_contract": {
"contract_id": "1KXsC2bSnKAMAZ51gq3xxKBo74a7cDJjkR",
"entry_point": 1560272691,
"args": "CgRrb2luEhkAuA4z1VEWTTde23Vcj6yVbdFtaF-McboVGAE="
}
},
{
"set_system_contract": {
"contract_id": "1FaSvLjQJsCJKq5ybmGsMMQs8RQYyVv8ju"
}
},
{
"set_system_contract": {
"contract_id": "1CrLSiK8aJVEg7L94TapoGTmAqnZW9qNzA",
"system_contract": true
}
},
{
"call_contract": {
"contract_id": "13NQnca5chwpKm4ebHbvgvJmXrsSCTayDJ",
"entry_point": 3796420410,
"args": "CgN2aHASGQCB_f8HtuFLrw_ICPpn442FeW7frX9u7oc="
}
},
{
"call_contract": {
"contract_id": "1KXsC2bSnKAMAZ51gq3xxKBo74a7cDJjkR",
"entry_point": 1560272691,
"args": "CgN2aHASGQCB_f8HtuFLrw_ICPpn442FeW7frX9u7ocYAQ=="
}
},
{
"set_system_contract": {
"contract_id": "17n12ktwN79sR6ia9DDgCfmw77EgpbTyBi"
}
}
],
"operation_merkle_root": "EiCgKrK7aQ5XTDRs85o8bpKq4_PMGRcEQCLSpTzvQt0hww==",
"fee": "6000000000"
}
}
}

--

--