I haven’t worked on block chain for a long time. I was free a few days ago, so I made a connection between the knowledge payment community program I was writing and FIBOS, which is currently developing well (seemingly). In the development process, we received a lot of help from the FIBOS team. Here we share the payment docking process with you.

FIBOS profile

Let’s just say a few words about blockchain, just pick one line that we’re going to talk about, and you can skip it if you’re familiar with it.

Blockchain can be thought of as a fully stored ledger on a decentralized network that is layered with hash values.

Decentralized network is not the familiar distributed network in which the nodes are peer. In a publicly linked blockchain, anyone can become a node as long as they install the corresponding software.

In the early days of the network, transaction records were mainly transmitted between nodes. This led to what is now the largest digital currency, Bitcoin.

It was later discovered that executable programs could be attached to the transaction to describe and optimize the details of the transaction. The program is called a smart contract. This led to ethereum (ETH).

Early smart contracts focused on transaction-related transactions, but as they evolved, they found they needed memory and databases. So a new network, EOS, was developed.

The evolution of the mainstream blockchain platform is here for now. EOS has a number of good design considerations, but one of the most painful features is that its contracts need to be written in C, and its documentation is quite indescribable. So although EOS is very popular, not many programmers can run its demos in full.

FIBOS provides a complete JavaScript toolchain and ecosystem on top of EOS, which can be seen as an improved version of EOS. It runs its own separate public chain, of course, and now has features that EOS does not, such as cross-chain transactions. It’s these features that make FIBOS seem like a good choice for me.

FIBOS payment features and docking process

As a developer already familiar with Ethereum, I would be reluctant to switch to another platform, given the high cost of relearning a language.

But FIBOS uses JS to write contracts, so there is no learning cost. However, the decentralized cross-chain transaction realized by FIBOS makes it unnecessary to connect EOS and ETH if FIBOS is connected, because both can be exchanged across the chain through FO wallet.

Also, if you really want to build a business and not make toys, you need stablecoins. Because product costs are mostly made up of fiat currency, there is a risk of selling below cost if pricing is not locked in via stablesoin. A few months ago FIBOS launched cross-chain stablesoin, which connects USDT and DAI.

Then the frenzy of listing on all exchanges at the same time made buying FO a lot easier.

UUEX, an eco-OTC service provider that supports USDT on the FIBOS chain, and a decentralized OTC service that will be launched soon.

After inspecting the whole ecology before this year’s Spring Festival, I thought it was suitable for real commercial products, so I tried FIBOS payment.

We adopt a very light way to access, remove the previous design of contract accounts, directly only accept payment.

The process itself is shockingly simple, consisting of only three steps.

First we construct a URL in which we place the order number as a transaction note. The QR code is then generated.

The user then scans the code through the FO wallet to make the transfer. The receiver, trading volume, currency and remarks are all filled in by default as we have passed them in.

When the user confirms that the transaction has been completed, all we need to do is check the FIBOS network to see if the recipient has a new transaction that includes the order number.

Implementation of FIBOS payment docking

Of course, there are a few details, especially given the lack of FIBOS documentation. Here I from the East soil datang after all the hardships to get back the true scriptures to you.

Construct payment TWO-DIMENSIONAL code

The CORRESPONDING URL format of the QR code used in the wallet is as follows:

https://wallet.fo/Pay?params=phpisthetest,FOUSDT,eosio,0.01,order=111
Copy the code

The parameters are in order: FIBOS account number of receiver, token name, issuer, amount and remarks.

So where do we find the exact names of these tokens?

Here is a list that contains the current on FIBOS platform release all pass card api.fowallet.net/1.1/fibos_t…

But only 100 are displayed by default, and you can add the skip parameter to turn pages.

http://api.fowallet.net/1.1/fibos_tokens?skip=100
Copy the code

To view the details of a token, construct the following URL.

http://api.fowallet.net/1.1/fibos_tokens?where=%7B%22token_name%22%3A%22FOUSDT@eosio%22%7D
Copy the code

We will query the transfer status through this API later, and the query syntax can be referred to this document.

On the phone

This is the situation on the computer.

If the user is on the phone, through the TWO-DIMENSIONAL code way seems very retarded. Here we can invoke FO Wallet APP directly on the phone with the URL protocol.

The format is as follows:

Fowallet ://URLENCODE, the URL aboveCopy the code

Write the URL to the “A” tag and click on it to call up the wallet.

Query of transfer results

FIBOS query API with GraphQL, familiar students can write their own. I’ll just give you the steps.

We need to construct a post request, the URL for http://api.fowallet.net/1.1, the content-type header to: application/graphql, the body is as follows:

{
        find_fibos_tokens_action(
         order:"-id"
         where:{
                         account_to_id: "Payee FO account",
                         contract_action:{
                             in:["eosio.token/transfer"."eosio.token/extransfer"]
                         }
                     }
        ){
                     action{
                         rawData
                         transaction
                        {
                            block
                            {
                                status
                            }
                        }
                     }
         token_from{
          token_name
         }
        }
    }

Copy the code

In the returned result, we need to confirm the following:

  • action.transaction.block.statusnoreversible, which indicates that the transaction state is irreversible.
  • action.rawData.act.data.memoIs the order number we passed in earlier to distinguish transactions.
  • action.rawData.act.data.quantity.quantityIs the transfer amount.

When we find a valid result, it means that the user has successfully paid. Then we can start shipping the goods.

added

First, because the proxy server corresponding to api.fowallet.net is not reliable at present, if it does not return for a long time during debugging, then you can change the domain name to this: Elb-tracker-api-1674205173.ap-northeast-1.elb.amazonaws.com.

Second, after the wallet is confirmed to the account, API also needs to wait a little three or five minutes to confirm, don’t worry.

FIBOS payment experience

There is no contract, which means we don’t need to consume any extra memory, which means the developer doesn’t have to pledge any FO for memory or other resources.

In practice, FIBOS transfers money much faster than ETH. Best of all, the money transfer is free, free, free.

Instead of burning Gas for every ETH transaction, not spending money means frequent micropayments. Add in the stable currency brought by FOUSDT, and we truly have a fee-free, value-stable, cross-chain, global payment solution. All that remains is to prepare the goods for sale on the global network and educate users to install FO wallets.

If you don’t believe it, you can now install FO wallet, scan the following TWO-DIMENSIONAL code, transfer money to me, personally experience a 😏