latest contributor to this doc

Last Edit: @gcharang ,

Faucet

The Faucet Antara Module enables anyone to fund an on-chain faucet on any chain where modules are enabled. A Smart Chain may have only one on-chain faucet.

To receive funds from a faucet, the faucetget method can be executed by anyone on the Smart 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 [pubkey]

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

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

NameTypeDescription
FaucetCCaddress(string)taking the faucet module's EVAL code as a modifier, this is the public address that corresponds to the faucet module'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 module
CCaddress(string)taking the faucet module's EVAL code as a modifier, this is the Antara address from the pubkey of the user
myCCaddress(string)taking the faucet module's EVAL code as a modifier, this is the Antara address from the pubkey of the user
myaddress(string)the unmodified public address of the pubkey used to launch the chain

Command:

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

You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.

Command:

curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"faucetaddress", "params":["03336ca9db27cb6e882830e20dc525884e27dc94d557a5e68b972a5cbf9e8c62a8"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/

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.

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

NameTypeDescription
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

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

./komodo-cli -ac_name=HELLOWORLD faucetfund 100

You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.

Command:

curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"faucetfund", "params":["100"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/

Step 2: Broadcast/send raw transaction

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

You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.

Command:

curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["01000000013c34d14c6a32219f4b633a1fe01f5826b3bd7b4cbe01c20cfc0c29138d9c99720100000049483045022100b265993f541d580f10e8820f9986bdd479859fdcb2e636dd1ee1b23506eebeac02202234a6e5141345459c4b4959e921aa85b9fa616f4c44ea15e53d08bf4885259501ffffffff0200e40b5402000000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cce06d66fa15090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/

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

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

You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.

Command:

curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["01000000013c34d14c6a32219f4b633a1fe01f5826b3bd7b4cbe01c20cfc0c29138d9c99720100000049483045022100b265993f541d580f10e8820f9986bdd479859fdcb2e636dd1ee1b23506eebeac02202234a6e5141345459c4b4959e921aa85b9fa616f4c44ea15e53d08bf4885259501ffffffff0200e40b5402000000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cce06d66fa15090000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/

faucetget

The faucetget method requests the faucet module 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.

NameTypeDescription
(none)

NameTypeDescription
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

Step 1: Use faucetget and get the raw HEX value

./komodo-cli -ac_name=HELLOWORLD faucetget

You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.

Command:

curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"faucetget", "params":[]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/

Step 2: Broadcast/send the raw transaction

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

You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.

Command:

curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"sendrawtransaction", "params":["01000000010941cea65a560aeae02f0d49770965490bd99eeac4185f25075685da58e99d40000000007b4c79a276a072a26ba067a565802103682b255c40d0cde8faee381a1a50bbb89980ff24539cb8518e294d3a63cefe128140150ad95012ad8fae990096787d75d563977cef914e812e9dc8b6236243ac5f0050b3af4f2675ad433dcff4be16d113fb9a46357ee60682ed5d76c60f9ccffe8ea100af038001e4a10001ffffffff02b077a43018090000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cc00e1f50500000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/

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

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

You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.

Command:

curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"decoderawtransaction", "params":["01000000010941cea65a560aeae02f0d49770965490bd99eeac4185f25075685da58e99d40000000007b4c79a276a072a26ba067a565802103682b255c40d0cde8faee381a1a50bbb89980ff24539cb8518e294d3a63cefe128140150ad95012ad8fae990096787d75d563977cef914e812e9dc8b6236243ac5f0050b3af4f2675ad433dcff4be16d113fb9a46357ee60682ed5d76c60f9ccffe8ea100af038001e4a10001ffffffff02b077a43018090000302ea22c8020e029c511da55523565835887e412e5a0c9b920801b007000df45e545f25028248103120c008203000401cc00e1f50500000000232103fe754763c176e1339a3f62ee6b9484720e17ee4646b65a119e9f6370c7004abcac00000000"]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/

faucetinfo

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

NameTypeDescription
(none)

NameTypeDescription
result(string)whether the command executed successfully
name(string)the name of the faucet module
funding(number)the amount of funds available in the faucet

Command:

./komodo-cli -ac_name=HELLOWORLD faucetinfo

You can find your rpcuser, rpcpassword, and rpcport in the coin's .conf file.

Command:

curl --user $rpcuser:$rpcpassword --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method":"faucetinfo", "params":[]}' -H 'content-type: text/plain;' http://127.0.0.1:$rpcport/