Skip to content
forked from xxuejie/felix

A telegram bot for interacting with CKB, hopefully with luck

License

Notifications You must be signed in to change notification settings

zengbing15/felix

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

felix

Felix is a telegram bot demo for interacting with CKB, hopefully with luck.We can use felix to send and grab CKB red envelopes.For now, felix is only used on the CKB Testnet, will be migrated to the CKB Mainnet for actual usage later.

For a sender, you need

  • Set up a telegram bot
  • Run a CKB Testnet node
  • Run the felix bot
  • Use ckb-cli(recommended tool) to sign the messages required by the transaction
  • Use generate-message-tool to double confirm the messages.

For a grabber, you just need

  • Set a receiving CKB Testnet address
  • Grab the red envelopes

As grabbers’ operation is very simple, we will introduce the user guide in detail for senders below.

User Guide for Senders

Set up a telegram bot

start - start
help - help
set_receiving_address - Set receiving address
receiving_address - Get receiving address
pending_envelopes - List of pending envelopes sent by me
pay - Pay an envelope
send - send envelopes
  • export the bot token
export BOT_TOKEN=<BOT_TOKEN>

Run a CKB Testnet node

Please refer the tutorial for more details.

Run the felix bot

  • Install dependencies
$ npm install
  • Set up the proxy server
export https_proxy=http://127.0.0.1:10080;export http_proxy=http://127.0.0.1:10080;export all_proxy=socks5://127.0.0.1:10081
  • Start the felix bot
$ npm start

Then you can interact with felix to send and pay red envelopes and don't forget to prepare a CKB Testnet address with enough tokens, you can use Nervos Aggron Faucet to claim CKB Testnet tokens.

Use ckb-cli to sign the messages

Felix will provide messages required by the transaction for signing.It's recommended to use ckb-cli.

$ ckb-cli

$ util sign-message --recoverable --from-account `the args of the address used to pay for the red envelope` --message `the message required by the transaction`

After signing the messages you will get the signatures, please send it to felix then the whole transaction will be generated and committed to CKB Testnet, the red envelope is successfully paid. The bot will reply a JSON file called UnsignedTx.json, which is used for confirming message by the generate-message-tool.

Use generate-message-tool to validate the messages

There is a tool to generate the message from UnsignedTx.json file,so you can confirm the message generated from felix.For more details,see github repo.

About

A telegram bot for interacting with CKB, hopefully with luck

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%