【Tutorial】LBTC Onchain Asset issue
By: Lightning Bitcoin, Lbtc
Tags: Lightningbitcoin, Blockchain, Lbtc

LBTC Onchain Asset issue Tutorial

The function of LBTC ochain asset issue has basically completed that has been deployed in LBTC testnet.Welcome developer to test and use it!

Blockchain Explore：http://47.96.169.139:9699/

Full-node wallet download：https://pan.baidu.com/s/1j9DJ-K4OAAnx8o7jt6nhfQ

Tutorial video:https://youtu.be/Paiidic7khw

1. Registername(It will take 1LBTC to register before issuing asset)

Arguments:

1. “address” (string, required) The lbtc address.

2. “name” (string, required) The address name.

Result:

“txid:” (string) The transaction id.

Examples:

> bitcoin-cli registername “1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd” “testname”

> curl — user myusername — data-binary ‘{“jsonrpc”: “1.0”, “id”:”curltest”, “method”: “registername”, “params”: [“1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd”, “testname”] }’ -H ‘content-type: text/plain;’ http://127.0.0.1:8332/

cli cmd：

./bitcoin-cli registername mi5HWG19ocB81cqFqLeD6NRqM6nqYk2Rug owner

2. Createtoken(It will take 10LBTC to creat tokens.)

Arguments:

{

1. “tokenSymbol” (string, required) The token symbol. (8 numbers+8 alphabet)

2. “tokenName” (string, required) The token name. (32 numbers+alphabet)

3. “ownerAddress” (string, required) Creater’s address.

4. “tokenAddress” (string, required) Token contract address.

5. “totalSupply” (numeric, required) Total amount of the token. (100 million to billion )（It will rounded up if input decimal.）

6. “decimal” (numeric, required) The token fund amount decimal. (Integer number from 1 to 8)

}

Result:

“result” (string) The result description.

Examples:

> bitcoin-cli createtoken “tokenSymbol” “tokenName” “1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd” “1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP” “100000000” “2”

> curl — user myusername — data-binary ‘{“jsonrpc”: “1.0”, “id”:”curltest”, “method”: “createtoken”, “params”: [“tokenSymbol”, “tokenName”, “1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd”, “1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP”, “100000000”, “2”] }’ -H ‘content-type: text/plain;’ http://127.0.0.1:8332/

cli cmd：

./bitcoin-cli createtoken BTC BTCtoken mi5HWG19ocB81cqFqLeD6NRqM6nqYk2Rug mvycp4LXckLZ98atxj6SvMFSCoijG4d6yB 10000 8

note：

Creat a token marked as BTC,named as BTC token

Owneraddress is mi5HWG19ocB81cqFqLeD6NRqM6nqYk2Rug

Tokenaddress is mvycp4LXckLZ98atxj6SvMFSCoijG4d6yB

3. Sendtoken (It will take 0.01LBTC to make transaction.)

sendtoken tokenAddress fromAddress toAddress amount changeAddress commnet

Sent an amount from an address to another address.

Arguments:

1. “tokenAddress” (string, required) The token contract address.

2. “fromAddress” (string, required) The address to send funds from.

3. “toAddress” (string, required) The address to send funds to.

4. “amount” (numeric or string, required) The amount to send (transaction fee is added on top).

5. “changeAddress” (string, optional) The change address. (目前不支持)

6. “comment” (string, optional) A comment used to store what the transaction is for.

This is not part of the transaction, just kept in your wallet.

Result:

“txid” (string) The transaction id.

Examples:

> bitcoin-cli sendtoken “1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP” “1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd” “1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP” 0.01 “1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd” “Comment”

cli cmd：

./bitcoin-cli sendtoken

mvycp4LXckLZ98atxj6SvMFSCoijG4d6yB mvycp4LXckLZ98atxj6SvMFSCoijG4d6yB mi5HWG19ocB81cqFqLeD6NRqM6nqYk2Rug 10.999

Note：

Send 10.999 BTCtoken to the address of mi5HWG19ocB81cqFqLeD6NRqM6nqYk2Rug

4. Locktoken(It will take 0.01LBTC to lock token)

locktoken tokenAddress fromAddress toAddress amount changeAddress commnet

lock an amount from an address to another address.

Arguments:

1. “tokenAddress” (string, required) The token contract address.

2. “fromAddress” (string, required) The address to lock funds from.

3. “toAddress” (string, required) The address to lock funds to.

4. “amount” (string, required) The amount to lock (transaction fee is added on top).

5. “heights” (string, required) Lock heights.

6. “changeAddress” (string, optional) The change address. (It dose not support now)

7. “comment” (string, optional) A comment used to store what the transaction is for.

This is not part of the transaction, just kept in your wallet.

Result:

“txid” (string) The transaction id.

Examples:

> bitcoin-cli locktoken “1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP” “1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd” “1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP” 0.01 100 “1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd” “Comment

clicmd：

./bitcoin-cli locktoken mvycp4LXckLZ98atxj6SvMFSCoijG4d6yB mvycp4LXckLZ98atxj6SvMFSCoijG4d6yB n212T8EGcoRGSAD31aSfBWiKtnGptXsjL6 999 100

note：

Lock 999 token in the address of n212T8EGcoRGSAD31aSfBWiKtnGptXsjL6,and then unlock behind 100 block height.

5. Gettokeninfo (Inquire detail information of token.)

gettokeninfo “tokenAddress” )

Get token info.

Arguments:

1. “tokenAddress” (string, optional) The token address.

Result:

[ (json array) Token info array.

{

“tokenSymbol” (string) The token symbol.

“tokenName” (string) The token name.

“ownerAddress” (string) Creater’s address.

“tokenAddress” (string) Token address.

“decimal” (numeric) The token fund amount decimal.

“totalSupply” (numeric) Total amount of the token.

}

]

Examples:

> bitcoin-cli gettokeninfo “1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd”

cli cmd：

./bitcoin-cli gettokeninfo mvycp4LXckLZ98atxj6SvMFSCoijG4d6yB

6. Gettokenbalance (Inquire balance of token adress)

gettokenbalance “useraddress” )

Get token balance.

Arguments:

1. “userAddress” (string, required) The target address.

2. “tokenAddress” (string, optional) The token contract address.

Result:

[ (json array) Token balance array.

{

“tokenSymbol” (string) The token symbol.

“availableBalance” (numeric) Available balance.

“lockBalance:” (json array) Lock balance array.

[

{

“expiryHeight” (numeric) Expiry height.

“lockAmount” (numeric) Lock token amount.

}

]

}

]

Examples:

> bitcoin-cli gettokenbalance “1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd”

> bitcoin-cli gettokenbalance “1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP” “1M72Sfpbz1BPpXFHz9m3CdqATR44Jvaydd”

cli cmd：

./bitcoin-cli gettokenbalance n212T8EGcoRGSAD31aSfBWiKtnGptXsjL6 mvycp4LXckLZ98atxj6SvMFSCoijG4d6yB