Faucet

Introduction

The Faucet Custom Consensus (CC) module enables anyone to fund an on-chain faucet on any chain where contracts are enabled. An asset chain may have only one on-chain faucet.

To receive funds from a faucet, the faucetget method can be executed by anyone on the asset chain, as long as their public address satisfies a few constraints. Their daemon's pubkey (corresponding to the address) must have no history of funds or transactions, and an address can claim faucet funds only once on a chain. The call also requires the node to perform a small PoW calculation; this deters leeching.

When faucetget is executed, the on-chain faucet sends 0.1 coins to the address that corresponds to the node's pubkey. This requires about 30 seconds of CPU time.

faucetaddress

faucetaddress [pubkey]

The faucetaddress method returns the CC address information for the specified pubkey. If no pubkey is provided, the method returns information for the pubkey used to launch the daemon.

Arguments

Name Type Description
pubkey (string, optional) the desired pubkey; the method uses the pubkey used to launch the daemon if no pubkey is provided

Response

Name Type Description
FaucetCCaddress (string) taking the faucet contract's EVAL code as a modifier, this is the public address that corresponds to the faucet contract's privkey
Faucetmarker (string) the internal address (not related to usage of faucet)
FaucetCCassets (string) the internal address (not related to usage of faucet)
GatewaysPubkey (string) the global pubkey for this Gateways contract module
CCaddress (string) taking the faucet contract's EVAL code as a modifier, this is the CC address from the pubkey of the user
myCCaddress (string) taking the faucet contract's EVAL code as a modifier, this is the CC address from the pubkey of the user
myaddress (string) the unmodified public address of the pubkey used to launch the chain

📌 Examples

Command:

./komodo-cli -ac_name=HELLOWORLD faucetaddress 03336ca9db27cb6e882830e20dc525884e27dc94d557a5e68b972a5cbf9e8c62a8

faucetfund

faucetfund amount

The faucetfund method funds the on-chain faucet.

The method returns a hex value which must then be broadcast using the sendrawtransaction method.

Arguments

Name Type Description
amount (number) the amount to add to the faucet, taken from the user's available funds

Response

Name Type Description
result (string) whether the command executed successfully
hex (string) the data in hex-encoded format; you must broadcast this hex using thesendrawtransaction RPC for the command to complete

📌 Examples

Step 1: Specify faucet amount and get the raw transaction HEX value

./komodo-cli -ac_name=HELLOWORLD faucetfund 100

Step 2: Broadcast/send raw transaction

./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 01000000013c34d14c6a32219f4b633a1fe01f5826b3bd7b4cbe01c20cfc0c29138d9c99720100000049483045022100b265993f541d580f10e8820f9986bdd479859fdcb2e636dd1ee1b23506eebeac02202234a6e5141345459c4b4959e921aa85b9fa616f4c44ea15e53d08bf4885259501ffffffff0200e40b5402000000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cce06d66fa15090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000

Step 3: Decode raw transaction (optional to check if the values are sane)

./komodo-cli -ac_name=HELLOWORLD decoderawtransaction 01000000013c34d14c6a32219f4b633a1fe01f5826b3bd7b4cbe01c20cfc0c29138d9c99720100000049483045022100b265993f541d580f10e8820f9986bdd479859fdcb2e636dd1ee1b23506eebeac02202234a6e5141345459c4b4959e921aa85b9fa616f4c44ea15e53d08bf4885259501ffffffff0200e40b5402000000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cce06d66fa15090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000

faucetget

faucetget

The faucetget method requests the faucet contract to send coins.

The method returns a hex value which must then be broadcast using the sendrawtransaction method.

The faucetget command yields 0.1 coins and requires about 30 seconds of CPU time to execute.

Arguments

Name Type Description
(none)

Response

Name Type Description
result (string) whether the command executed successfully
hex (string) the data in hex-encoded format; you must broadcast this hex using sendrawtransaction for the command to complete

📌 Examples

Step 1: Use faucetget and get the raw HEX value

./komodo-cli -ac_name=HELLOWORLD faucetget

Step 2: Broadcast/send the raw transaction

./komodo-cli -ac_name=HELLOWORLD sendrawtransaction 01000000010941cea65a560aeae02f0d49770965490bd99eeac4185f25075685da58e99d40000000007b4c79a276a072a26ba067a565802103682b255c40d0cde8faee381a1a50bbb89980ff24539cb8518e294d3a63cefe128140150ad95012ad8fae990096787d75d563977cef914e812e9dc8b6236243ac5f0050b3af4f2675ad433dcff4be16d113fb9a46357ee60682ed5d76c60f9ccffe8ea100af038001e4a10001ffffffff02b077a43018090000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cc00e1f50500000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000

Step 3: Decode the raw transaction (optional to check if the value are sane)

./komodo-cli -ac_name=HELLOWORLD decoderawtransaction 01000000010941cea65a560aeae02f0d49770965490bd99eeac4185f25075685da58e99d40000000007b4c79a276a072a26ba067a565802103682b255c40d0cde8faee381a1a50bbb89980ff24539cb8518e294d3a63cefe128140150ad95012ad8fae990096787d75d563977cef914e812e9dc8b6236243ac5f0050b3af4f2675ad433dcff4be16d113fb9a46357ee60682ed5d76c60f9ccffe8ea100af038001e4a10001ffffffff02b077a43018090000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cc00e1f50500000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000

faucetinfo

faucetinfo

The faucetinfo method displays the balance of funds in the chain's faucet.

Arguments

Name Type Description
(none)

Response

Name Type Description
result (string) whether the command executed successfully
name (string) the name of the faucet contract
funding (number) the amount of funds available in the faucet

📌 Examples

Command:

./komodo-cli -ac_name=HELLOWORLD faucetinfo