Skip to content

Commit

Permalink
Merge pull request #180 from KomodoPlatform/dev
Browse files Browse the repository at this point in the history
sync
  • Loading branch information
gcharang committed Dec 19, 2023
2 parents 1e24c8c + e02d04d commit be1b857
Show file tree
Hide file tree
Showing 63 changed files with 14,167 additions and 3,267 deletions.
2,119 changes: 2,116 additions & 3 deletions data-for-gpts/all-content.txt

Large diffs are not rendered by default.

129 changes: 129 additions & 0 deletions data-for-gpts/antara-content.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17311,6 +17311,37 @@ export const description = "This section contains information required to Setup
# Antara Setup

This section of the documentation contains information required to Setup Antara based Smart Chains.
export const title = "Activate Custom Consensus modules on a Komodo Smartchain";
export const description =
"If you have an existing assetchain based on Komodo platform without Custom Consensus modules enabled, you can activate it at any time.";

# How to Activate Custom Consensus modules on an Existing Komodo Smartchain

If you have an existing assetchain based on Komodo platform without Custom Consensus modules enabled, you can activate it at any time. Komodo daemon now supports the command-line parameter `-ac_ccactivate=height` , using which you can activate CC on a non-CC enabled chain in a future block height.

## Example

The first existing chain which doesn't have CC enabled, whose startup command looks like this

```bash
./komodod -ac_name=EXAMPLE -ac_supply=72000000 -addnode=24.54.206.138 &
```

It was a very easy way to start a chain using Komodo technology, with very few parameters. In order to activate CC in this chain, all we have to do is the following:

```bash
./komodod -ac_name=EXAMPLE -ac_supply=72000000 -ac_ccactivate=140 -addnode=24.54.206.138 &
```

`-ac_ccactivate=140` means, Custom Consensus modules are activated at block 140. You can set this parameter to any block height you want the CC to be activated.

As this is a hardforking change, all nodes must update. If the chain is being notarized, Notary Nodes need to update to the new parameters as well for the notarization to continue without disruption past the activation block.

Once CC is activated on a chain, do not change the startup script. If you do, that will create a new fork.

By default, `-ac_ccactivate=height` uses `-ac_cc=2` (If you [recall](/antara/setup/antara-customizations/), `-ac_cc` is the parameter that defines the cluster of chains which can have cross chain Custom Consensus modules). But, you cant add -ac\_cc=2 to the command line, as this will create a new fork. `-ac_ccactivate=height` will take care of those things automagically.

Also, addressindex=1 and spentindex=1 need to be in the configuration file, but the daemon will take care of setting this up when `-ac_ccactivate=height` is included as a command-line parameter.
export const title = "Advanced Tutorials: Creating Antara Modules for Komodo";
export const description =
"This tutorial series is intended for advanced Komodo developers who intend to manipulate the default software setup.";
Expand Down Expand Up @@ -26476,6 +26507,104 @@ A character that survived a game is also a non-fungible asset and can be traded
The `tokentxid` can be found by using the [playerinfo](/antara/api/rogue/#playerinfo) method and submitting the known `playertxid` as an argument. For more information, see the `playerinfo` method.

The `tokentxid` is created at the character's initial creation and does not change throughout the character's life. When the character dies, the `tokentxid` is sent to a burn address, making the character permanently unplayable.
export const title = "Using Custom Consensus modules on a Komodo Smartchain";
export const description = "";

# Using the Contracts on a Komodo based Blockchain

A high level overview of the Komodo Custom Consensus Framework: [How to write UTXO based CryptoConditions contracts for KMD chains - by jl777](/historical/cc-jl/)

To use the contracts on the blockchain, the start command of the chain should contain the parameter `-ac-cc` .

A brief overview of the `-ac-cc` parameter:

<Note>
* A chain with -ac\_cc=N with N 0, will have CC active
* If N is 1, then it just enables CC
* if N is `>= 2` and `<= 100`, it allows for non-fungible cross chain contracts within all the chains with the same N value
* if N >= 101, then it forms a cluster of all the chains with the same N value where the base tokens in all the chains in that cluster are fungible via the burn protocol
</Note>

## To test the contracts

* Compile Komodo

* Navigate to `src` directory, start the test chain with your `pubkey` and issue the SmartContract RPC commands. All the instructions to get you started are below. For a more elaborate explanation on creating a new blockchain using Komodo see: [Creating Komodo Smart Chains](/smart-chains/setup/installing-from-source/)

```bash
#Install dependencies

cd ~
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libboost-all-dev libssl-dev libprotobuf-dev protobuf-compiler libgtest-dev libqt4-dev libqrencode-dev libdb++-dev ntp ntpdate nano software-properties-common curl libcurl4-gnutls-dev cmake clang
```

# Build Komodo

```bash
cd ~
git clone https://github.com/jl777/komodo
cd komodo
git checkout jl777
./zcutil/fetch-params.sh
./zcutil/build.sh -j\$(nproc)
```

# Start the Test Chain

```bash
cd ~/komodo/src
./komodod -ac_cc=1 -ac_name=<CHAIN_NAME-addressindex=1 -spentindex=1 -ac_supply=1000 -ac_reward=10000000000000 -pubkey=<your_pub_key-addnode=195.201.20.230 -addnode=195.201.137.5 -addnode=195.201.20.230 -addnode=94.130.224.11 &
```

## Relevant info:

* Source repo: [jl777/komodo](https://github.com/jl777/komodo) (Latest code on cc and new contracts are being added to the `FSM` branch.)

* Source directory: [jl777/komodo:src/cc@FSM](https://github.com/jl777/komodo/tree/FSM/src/cc)

### Useful Links:

(Going through the comments in the following files gives a pretty good overview)

* [jl777/komodo:src/cc/assets.cpp@FSM (raw)](https://raw.githubusercontent.com/jl777/komodo/FSM/src/cc/assets.cpp)

* [jl777/komodo:src/cc/dice.cpp@FSM (raw)](https://raw.githubusercontent.com/jl777/komodo/FSM/src/cc/dice.cpp)

* [jl777/komodo:src/cc/rewards.cpp@FSM (raw)](https://raw.githubusercontent.com/jl777/komodo/FSM/src/cc/rewards.cpp)

* [jl777/komodo:src/cc/CCtokens.cpp@FSM (raw)](https://raw.githubusercontent.com/jl777/komodo/FSM/src/cc/CCtokens.cpp)

## To add a new contract

1. Add EVAL\_CODE to eval.h

2. Initialize the variables in the CCinit function below

3. Write a Validate function to reject any unsanctioned usage of vin/vout

4. Make helper functions to create rawtx for RPC functions

5. Add rpc calls to rpcserver.cpp and rpcserver.h and in one of the rpc.cpp files

6. Add the new .cpp files to src/Makefile.am

1, 2 and 6 are not even coding tasks. 4 and 5 are non-consensus time, mostly dealing with JSON. 3 is the main work needed, which makes sense as a different 3 is what makes it a different contract. A lot of a contracts can use slightly modified functions from the other CC contracts. So the best way to do a new one would be to pick the one that is closest to what you want and start morphing it.

## General guidance on reporting issues on discord (Regarding CryptoConditions and SmartContract development)

* the specific chain parameters so anyone can connect to it

* the **EXACT** rpc call and parameters you used

* **the most important!** : the raw tx generated

* clear description of why you think it is a bug. for now you need to look at the raw tx details to make sure all vins are valid, signed and all vouts are sane.

* Please don't post things like "I tried X and it didnt work" as that does not help at all at this stage. These are raw transaction level things and until everything works, things won't work at the higher level.

[Discord Invite](https://komodoplatform.com/discord)
export const title = "Understanding Antara Addresses";
export const description = "In this guide learn about the different types of addresses used in Antara transactions, including the CC Addresses.";

Expand Down
2 changes: 1 addition & 1 deletion data-for-gpts/historical-content.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1656,7 +1656,7 @@ in the Komodo blockchain since inception). The notary nodes process this specifi
the content of the notarized data.

(All examples herein are estimated based off this actual KMD notarization to the BTC network:
[https://www.blocktrail.com/BTC/tx/313031a1ed2dbe12a20706dff48d3dffb0e39d15e3e4ff936d01f091fb3b8556#tx\_messages](https://blocktrail.com/))
[https://blockstream.info/tx/313031a1ed2dbe12a20706dff48d3dffb0e39d15e3e4ff936d01f091fb3b8556?expand](https://blockstream.info/))

The pieces going into the notarization process could look like this:

Expand Down
Loading

0 comments on commit be1b857

Please sign in to comment.