用户可以根据需要,自己或者别人帮助抵押EOS,获取NET或者CPU资源。
查看此时账户bcskillsurou
信息
root@iZj6cbx3duprxf6dasczbpZ:~# cleos -u http://167.99.91.77:8888 get account bcskillsurou
permissions:
owner 1: 1 EOS8127zAiVVtPMJoiXyX8oLiReNaj32VBsJXKuTLkJsQyubKcSt7
active 1: 1 EOS6Zfj72f6kBVZQrbkcCCGhWGnUfkmFBZ6b4Ya76GVunTanVYhtC
memory:
quota: 50.88 KiB used: 3.365 KiB
net bandwidth:
staked: 100.0000 EOS (total stake delegated from account to self)
delegated: 0.0000 EOS (total staked delegated to account from others)
used: 0 bytes
available: 18.78 MiB
limit: 18.78 MiB
cpu bandwidth:
staked: 100.0000 EOS (total stake delegated from account to self)
delegated: 0.0000 EOS (total staked delegated to account from others)
used: 0 us
available: 3.751 sec
limit: 3.751 sec
EOS balances:
liquid: 10000.0000 EOS
staked: 200.0000 EOS
unstaking: 0.0000 EOS
total: 10200.0000 EOS
producers: <not voted>
对于账户抵押分为staked
和delegated
- staked:自己给自己抵押,或者别人给你抵押时移交了币的所属(添加参数
--transfer
)
- delegated:别人帮你抵押的,币的所属权归对方。
下面演示抵押测试
先让dappplaytest
给 bcskillsurou
NET和CPU各抵押10EOS,不转移币的所有权
root@iZj6cbx3duprxf6dasczbpZ:~# cleos -u http://167.99.91.77:8888 system delegatebw dappplaytest bcskillsurou "10 EOS" "10 EOS"
3081849ms thread-0 main.cpp:438 create_action ] result: {"binargs":"90b1cadec45aab49a0e9d5384607313aa08601000000000004454f5300000000a08601000000000004454f530000000000"} arg: {"code":"eosio","action":"delegatebw","args":{"from":"dappplaytest","receiver":"bcskillsurou","stake_net_quantity":"10.0000 EOS","stake_cpu_quantity":"10.0000 EOS","transfer":false}}
executed transaction: ff8d82345bfb095bec396f258c62ee5c244577828993da26abb94e7deff5deb1 144 bytes 3307 us
# eosio <= eosio::delegatebw {"from":"dappplaytest","receiver":"bcskillsurou","stake_net_quantity":"10.0000 EOS","stake_cpu_quant...
# eosio.token <= eosio.token::transfer {"from":"dappplaytest","to":"eosio.stake","quantity":"20.0000 EOS","memo":"stake bandwidth"}
# dappplaytest <= eosio.token::transfer {"from":"dappplaytest","to":"eosio.stake","quantity":"20.0000 EOS","memo":"stake bandwidth"}
# eosio.stake <= eosio.token::transfer {"from":"dappplaytest","to":"eosio.stake","quantity":"20.0000 EOS","memo":"stake bandwidth"}
查看bcskillsurou账户信息
root@iZj6cbx3duprxf6dasczbpZ:~# cleos -u http://167.99.91.77:8888 get account bcskillsurou
permissions:
owner 1: 1 EOS8127zAiVVtPMJoiXyX8oLiReNaj32VBsJXKuTLkJsQyubKcSt7
active 1: 1 EOS6Zfj72f6kBVZQrbkcCCGhWGnUfkmFBZ6b4Ya76GVunTanVYhtC
memory:
quota: 50.88 KiB used: 3.365 KiB
net bandwidth:
staked: 100.0000 EOS (total stake delegated from account to self)
delegated: 10.0000 EOS (total staked delegated to account from others)
used: 0 bytes
available: 20.66 MiB
limit: 20.66 MiB
cpu bandwidth:
staked: 100.0000 EOS (total stake delegated from account to self)
delegated: 10.0000 EOS (total staked delegated to account from others)
used: 0 us
available: 4.126 sec
limit: 4.126 sec
EOS balances:
liquid: 10000.0000 EOS
staked: 200.0000 EOS
unstaking: 0.0000 EOS
total: 10200.0000 EOS
NET和CPU的delegated 都显示了新转的10EOS
查看EOSpark,显示的是staked + delegated总抵押,并没有区分。
下面演示取消抵押测试
对于delegated
只能抵押方撤回抵押
root@iZj6cbx3duprxf6dasczbpZ:~# cleos -u http://167.99.91.77:8888 system undelegatebw dappplaytest bcskillsurou "2 EOS" "2 EOS"
3549315ms thread-0 main.cpp:438 create_action ] result: {"binargs":"90b1cadec45aab49a0e9d5384607313a204e00000000000004454f5300000000204e00000000000004454f5300000000"} arg: {"code":"eosio","action":"undelegatebw","args":{"from":"dappplaytest","receiver":"bcskillsurou","unstake_net_quantity":"2.0000 EOS","unstake_cpu_quantity":"2.0000 EOS"}}
executed transaction: db39983263b7e81f758360d62a1e62fa605d7f14abee288def78996e160f0e28 184 bytes 2437 us
# eosio <= eosio::undelegatebw {"from":"dappplaytest","receiver":"bcskillsurou","unstake_net_quantity":"2.0000 EOS","unstake_cpu_qu...
查看bcskillsurou账户信息
root@iZj6cbx3duprxf6dasczbpZ:~# cleos -u http://167.99.91.77:8888 get account bcskillsurou
permissions:
owner 1: 1 EOS8127zAiVVtPMJoiXyX8oLiReNaj32VBsJXKuTLkJsQyubKcSt7
active 1: 1 EOS6Zfj72f6kBVZQrbkcCCGhWGnUfkmFBZ6b4Ya76GVunTanVYhtC
memory:
quota: 50.88 KiB used: 3.365 KiB
net bandwidth:
staked: 100.0000 EOS (total stake delegated from account to self)
delegated: 8.0000 EOS (total staked delegated to account from others)
used: 0 bytes
available: 20.28 MiB
limit: 20.28 MiB
cpu bandwidth:
staked: 100.0000 EOS (total stake delegated from account to self)
delegated: 8.0000 EOS (total staked delegated to account from others)
used: 0 us
available: 4.051 sec
limit: 4.051 sec
EOS balances:
liquid: 10000.0000 EOS
staked: 200.0000 EOS
unstaking: 0.0000 EOS
total: 10200.0000 EOS
producers: <not voted>
CPU和NET delegated 都减少了2EOS
对于staked
自己撤回抵押
root@iZj6cbx3duprxf6dasczbpZ:~# cleos -u http://167.99.91.77:8888 system undelegatebw bcskillsurou bcskillsurou "2 EOS" "2 EOS"
271082ms thread-0 main.cpp:438 create_action ] result: {"binargs":"a0e9d5384607313aa0e9d5384607313a204e00000000000004454f5300000000204e00000000000004454f5300000000"} arg: {"code":"eosio","action":"undelegatebw","args":{"from":"bcskillsurou","receiver":"bcskillsurou","unstake_net_quantity":"2.0000 EOS","unstake_cpu_quantity":"2.0000 EOS"}}
executed transaction: f5f05f18655f4ded25ad8f8d56b6b3b0dfc340c6fd017019e9ca05612149554a 184 bytes 2209 us
# eosio <= eosio::undelegatebw {"from":"bcskillsurou","receiver":"bcskillsurou","unstake_net_quantity":"2.0000 EOS","unstake_cpu_qu...
查看bcskillsurou账户信息
root@iZj6cbx3duprxf6dasczbpZ:~# cleos -u http://167.99.91.77:8888 get account bcskillsurou
permissions:
owner 1: 1 EOS8127zAiVVtPMJoiXyX8oLiReNaj32VBsJXKuTLkJsQyubKcSt7
active 1: 1 EOS6Zfj72f6kBVZQrbkcCCGhWGnUfkmFBZ6b4Ya76GVunTanVYhtC
memory:
quota: 50.88 KiB used: 3.951 KiB
net bandwidth:
staked: 98.0000 EOS (total stake delegated from account to self)
delegated: 8.0000 EOS (total staked delegated to account from others)
used: 185 bytes
available: 19.91 MiB
limit: 19.91 MiB
cpu bandwidth:
staked: 98.0000 EOS (total stake delegated from account to self)
delegated: 8.0000 EOS (total staked delegated to account from others)
used: 5.182 ms
available: 3.971 sec
limit: 3.976 sec
unstaking tokens:
time of unstake request: 2018-08-02T06:04:32 (funds will be available in 71.99 hr)
from net bandwidth: 2.0000 EOS
from cpu bandwidth: 2.0000 EOS
total: 4.0000 EOS
EOS balances:
liquid: 10000.0000 EOS
staked: 196.0000 EOS
unstaking: 4.0000 EOS
total: 10200.0000 EOS
producers: <not voted>
CPU和NET staked 都减少了2EOS
总结
获取当前账号下NET或CPU抵押数 分别等于staked + delegated
获取当前账号下NET或CPU赎回数和赎回时的当前时间(只显示最后一次发起时间)查看 unstaking tokens字段 (3天后完成)
RPC返回数据
{
"account_name": "bcskillsurou",
"head_block_num": 7878445,
"head_block_time": "2018-08-02T06:18:01.500",
"privileged": false,
"last_code_update": "1970-01-01T00:00:00.000",
"created": "2018-08-02T04:25:06.500",
"core_liquid_balance": "10000.0000 EOS",
"ram_quota": 52098,
"net_weight": 1060000,
"cpu_weight": 1060000,
"net_limit": {
"used": 185,
"available": 20873227,
"max": 20873412
},
"cpu_limit": {
"used": 5182,
"available": 3970991,
"max": 3976173
},
"ram_usage": 4046,
"permissions": [
{
"perm_name": "active",
"parent": "owner",
"required_auth": {
"threshold": 1,
"keys": [
{
"key": "EOS6Zfj72f6kBVZQrbkcCCGhWGnUfkmFBZ6b4Ya76GVunTanVYhtC",
"weight": 1
}
],
"accounts": [ ],
"waits": [ ]
}
},
{
"perm_name": "owner",
"parent": "",
"required_auth": {
"threshold": 1,
"keys": [
{
"key": "EOS8127zAiVVtPMJoiXyX8oLiReNaj32VBsJXKuTLkJsQyubKcSt7",
"weight": 1
}
],
"accounts": [ ],
"waits": [ ]
}
}
],
"total_resources": {
"owner": "bcskillsurou",
"net_weight": "106.0000 EOS",
"cpu_weight": "106.0000 EOS",
"ram_bytes": 52098
},
"self_delegated_bandwidth": {
"from": "bcskillsurou",
"to": "bcskillsurou",
"net_weight": "98.0000 EOS",
"cpu_weight": "98.0000 EOS"
},
"refund_request": {
"owner": "bcskillsurou",
"request_time": "2018-08-02T06:04:32",
"net_amount": "2.0000 EOS",
"cpu_amount": "2.0000 EOS"
},
"voter_info": {
"owner": "bcskillsurou",
"proxy": "",
"producers": [ ],
"staked": 1960000,
"last_vote_weight": "0.00000000000000000",
"proxied_vote_weight": "0.00000000000000000",
"is_proxy": 0
}
}
相对于cleos Rpc返回的数据要清晰一些