GithubHelp home page GithubHelp logo

fibos-scripts's Introduction

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 transfering 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!

fibos-scripts's People

Contributors

adshao avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.