Skip to content
scripts for fibos
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
node_modules
.gitignore
Dockerfile
README.md
config.js
fibos_client.js
package.json

README.md

FIBOS Registration Scripts

Run with Docker

Docker is required before running following command, please refer to https://docs.docker.com/install/ to install docker.

One line installation:

git clone https://github.com/adshao/fibos-scripts && cd fibos-scripts && alias fibos="docker run -it --rm -v `pwd`:/usr/src/app -w /usr/src/app adshao/fibos fibos"

or just set alias if you have already cloned this repo:

alias fibos="docker run -it --rm -v `pwd`:/usr/src/app -w /usr/src/app adshao/fibos fibos"

Goto Usage section to continue the journey.

Pre-installation

Install fibos

curl -s https://fibos.io/download/installer.sh | sh

Init fibos

fibos --init

Install fibos.js

fibos --install fibos.js

for more information, please refer to https://fibos.io/docs/guide/basic/install.md.html

Usage

Put the following javascript code into a file named main.js, run with fibos once the code is ready:

fibos main.js

Init Client

Init fibos client

var FibosClient = require("./fibos_client.js");

config = {
    eosPriKey: process.env.EOS_PRIKEY,
    eosAccount: "your eos account",
    fibosAccount: "your fibos account",
    fibosPubKey: process.env.FIBOS_PUBKEY,
    fibosPriKey: process.env.FIBOS_PRIKEY
}

var client = new FibosClient(config);

Generate Pub/Pri Keys

var res = client.generateKeys();
console.log("export FIBOS_PRIKEY=" + res.prikey);
console.log("export FIBOS_PUBKEY=" + res.pubkey);

Save it into a secure key named fibos.key, and append your EOS private key:

export FIBOS_PRIKEY=xxx
export FIBOS_PUBKEY=xxx
export EOS_PRIKEY=xxx
source fibos.key

Create Account

var res = client.createAccount();
console.log(res);

Transfer EOS to FIBOS

var res = client.transferEOS("1.0000 EOS");
console.log(res);

Check Balance

var res = client.getBalance(config.fibosAccount);
console.log(res);

Exchange EOS to FO

var res = client.exchangeFO("1.0000 EOS");
console.log(res);

Buy Ram

var res = client.buyram(config.fibosAccount, config.fibosAccount, "1.0000 FO");
console.log(res);

Sell Ram

Sell ram in bytes:

var res = client.sellram(config.fibosAccount, 1048576)
console.log(res);

Show Ram Price

console.log("ram price: " + client.getRamPrice());

Get Account

Check your ram info from account:

console.log(client.getAccount(config.fibosAccount));

Exchange FO to EOS

In case you want to exchange FO to EOS:

var res = client.exchangeEOS("1.0000 FO");
console.log(res);

Withdraw EOS

Transfer EOS@fibos to EOS mainnet:

var res = client.withdrawEOS("0.0012 EOS")
console.log(res);

Please test with a small amount to make sure everything is OK before transferring your EOS.

Donate

If this script is helpful to you, you can donate me with a cup of coffee:

  • EOS Address: adshaoadshao
  • FO Address: adshaoadshao

Thanks, good luck!

You can’t perform that action at this time.