---
tags: sidechains
---
# Deku smart contracts with factori
Understand the smart contracts that are using in Deku.
And the generated smart contract from [factori](https://gitlab.com/functori/dev/factori)
This is the branch with using factori to export the dummy ticket in Deku.
https://github.com/lykimq/dummy_ticket
This branch using factori to export discovery contract without the crawlori feature:
https://github.com/lykimq/discovery_without_crawlori
This branch using factori to export discovery contract with crawlori:
https://github.com/lykimq/discovery
# Discovery
This contract has a single entrypoint, it is the `uri_update`
```
type uri_update =
{
key: key;
uri: uri;
nonce: nonce;
signature: signature
}
type storage = (key_hash, (nonce * uri)) big_map
val main (uri_update, storage)
```
Imagine, when calling this contract:
- We input the information, for instance we want to add new key to a Deku node, or to check if this key already existed in the validator (node)) or not
- The input is the `uri_update`, then smart contract will check our input: the key (the public key started with `tz1xxx`, it is the Tezos address generated by `tezos-client` ), uri (the uri to the node, for instance: `http://localhost:4000`), nonce, and the signature are correct or not. If it is all correct (in case new key), the smart contract will update the storage with the information that we input. The key information is the identity of this contract when it is originated. If not it does not change the current storage.
When using factori, it will generate the interface for this smart contract, it provides the functions to:
- `call_default`: when it is a single entrypoint. We give the information of a node, an account, smart contract's address, contract's entrypoint. It then will return us the information of the entrypoint of this contract.
- `deploy`: originate this contract, it means that we want to add some amount of tez, to a node (for example: the blockchain uri `https://tz.functori.com`, running on the ithaca-net provided by factori), from the account (key), with the information of the `storage`. When it success, it will register this contract on the blockchain.
- `test_storage_download`: it will get the information of the storage of the contract.
# Consensus
# Dummy_ticket