EOS研究系列【ram买卖实战】

chaimyu(58)
Published in
#eos
Words
541
Reading
3 min
8y
Listen to this post
~4 min

这次自己开始研究EOS本就是因为ram的大涨才开始的,还是觉得自己落后了,EOS不管什么原因至少已经火了这么久了,早就应该更深入的了解一下,只是因为工作太忙(又在给自己找理由)一直没有腾出时间来,今天来看看怎么从cleos来买卖ram吧!

买卖命令

买入ram

(env3) Chaim:cleos Chaim$ ./cleos -u https://api.cypherglass.com system buyram steemchaimyu steemchaimyu "0.1 EOS"

卖出ram

(env3) Chaim:cleos Chaim$ ./cleos -u https://api.cypherglass.com system sellram steemchaimyu 10000

实际操作

自己都觉得自己是韭菜...

转帐

想办法(因为大部分交易所不让提EOS)从交易所转了一笔EOS,记录如下:

(env3) Chaim:cleos Chaim$ ./cleos -u https://api.cypherglass.com get block 4145591
{
  "timestamp": "2018-07-04T16:15:02.500",
  "producer": "eos42freedom",
  "confirmed": 0,
  "previous": "003f41b6ef7162f778ea2c4329f4866a43eea2694457eae4b613f7bf08db89be",
  "transaction_mroot": "4b27e860639535ba43ffbb7725aa36add8cd3a62e27316511ab06d2352e1eec2",
  "action_mroot": "ff7d76e48af191d450eb0c059007f3374e17423044d1a66944353a442a771167",
  "schedule_version": 105,
  "new_producers": null,
  "header_extensions": [],
  "producer_signature": "SIG_K1_KdMK6mWeK3FtVpXBSreXE8wuhkthH46mutTez1EWxcRSWAP4j5gNJnRBw99NnJqaVsZKEHfrksWavz5scaSRaFZSaoacaj",
  "transactions": [{
      "status": "executed",
      "cpu_usage_us": 1026,
      "net_usage_words": 16,
      "trx": {
        "id": "f6a0c4f8b85b76ece03416777dd1a83b521412caedb34b404ea38d46775af30d",
        "signatures": [
          "SIG_K1_K8iwhrAzQb1SpH2usuhbc5KG5YdKqWCaFuDS9YJQ4VUt8EEoGuuyqqXpUBAxWt9SAJ4buUJqi23xAAZvMQweoVEPmiKHvg"
        ],
        "compression": "none",
        "packed_context_free_data": "",
        "context_free_data": [],
        "packed_trx": "fef23c5b6d40f70ce796000000000100a6823403ea3055000000572d3ccdcd012029ca34a17c50a600000000a8ed3232212029ca34a17c50a6a0bd74a621a954c6ec4702000000000004454f53000000000000",
        "transaction": {
          "expiration": "2018-07-04T16:17:02",
          "ref_block_num": 16493,
          "ref_block_prefix": 2531724535,
          "max_net_usage_words": 0,
          "max_cpu_usage_ms": 0,
          "delay_sec": 0,
          "context_free_actions": [],
          "actions": [{
              "account": "eosio.token",
              "name": "transfer",
              "authorization": [{
                  "actor": "otcbtcdotcom",
                  "permission": "active"
                }
              ],
              "data": {
                "from": "otcbtcdotcom",
                "to": "steemchaimyu",
                "quantity": "14.9484 EOS",
                "memo": ""
              },
              "hex_data": "2029ca34a17c50a6a0bd74a621a954c6ec4702000000000004454f530000000000"
            }
          ],
          "transaction_extensions": []
        }
      }
    }
  ],
  "block_extensions": [],
  "id": "003f41b71616aed6877bd42f5a1a7b849948fead6d6954b35e5dcc0b7b51effa",
  "block_num": 4145591,
  "ref_block_prefix": 802454407
}

EOS到帐速度倒是很快,我从ETH转交易所花了1个小时,这又是对比了...

(env3) Chaim:cleos Chaim$ ./cleos -u https://api.cypherglass.com get currency balance eosio.token steemchaimyu EOS
14.9484 EOS

买入RAM

下跌三浪、上涨区间50%反弹位置,虽然我现在都快不信这些指标了,但有指标总比没指标好,那就进!

(env3) Chaim:cleos Chaim$ ./cleos -u https://api.cypherglass.com system buyram steemchaimyu steemchaimyu "1 EOS"
1990046ms thread-0   main.cpp:429                  create_action        ] result: {"binargs":"a0bd74a621a954c6a0bd74a621a954c6102700000000000004454f5300000000"} arg: {"code":"eosio","action":"buyram","args":{"payer":"steemchaimyu","receiver":"steemchaimyu","quant":"1.0000 EOS"}} 
executed transaction: e3c89137369e08004569a006c4961ec51a725f5854b10f5850882522e11fa9f0  128 bytes  2162 us
#         eosio <= eosio::buyram                {"payer":"steemchaimyu","receiver":"steemchaimyu","quant":"1.0000 EOS"}
#   eosio.token <= eosio.token::transfer        {"from":"steemchaimyu","to":"eosio.ram","quantity":"0.9950 EOS","memo":"buy ram"}
#  steemchaimyu <= eosio.token::transfer        {"from":"steemchaimyu","to":"eosio.ram","quantity":"0.9950 EOS","memo":"buy ram"}
#     eosio.ram <= eosio.token::transfer        {"from":"steemchaimyu","to":"eosio.ram","quantity":"0.9950 EOS","memo":"buy ram"}
#   eosio.token <= eosio.token::transfer        {"from":"steemchaimyu","to":"eosio.ramfee","quantity":"0.0050 EOS","memo":"ram fee"}
#  steemchaimyu <= eosio.token::transfer        {"from":"steemchaimyu","to":"eosio.ramfee","quantity":"0.0050 EOS","memo":"ram fee"}
#  eosio.ramfee <= eosio.token::transfer        {"from":"steemchaimyu","to":"eosio.ramfee","quantity":"0.0050 EOS","memo":"ram fee"}
warning: transaction executed locally, but may not be confirmed by the network yet

再看看买入的交易数据:

(env3) Chaim:cleos Chaim$ ./cleos -u https://api.cypherglass.com get block 4147776
{
  "timestamp": "2018-07-04T16:33:15.000",
  "producer": "jedaaaaaaaaa",
  "confirmed": 0,
  "previous": "003f4a3fc6168dbd9bceb5c14a701ea38c47c12954f130db420f44829294b279",
  "transaction_mroot": "1794bdafb47c4efa5b802eb97bf7a0acaa440d131ac298a5e36846697eefd23f",
  "action_mroot": "9d7aadd8343de0653a8e0973ebe0af30b2414905fc12090a550a24395adbcf67",
  "schedule_version": 105,
  "new_producers": null,
  "header_extensions": [],
  "producer_signature": "SIG_K1_JzrjFTYGHHBDa12CBQ75M1wae4QUu3E4wuZNiGUnS5fm1GergQpiV7UiNPNYHWaEiLfKeuyVzgDTC1FoddAsjftQ2juCFN",
  "transactions": [{
      "status": "executed",
      "cpu_usage_us": 3103,
      "net_usage_words": 16,
      "trx": {
        "id": "e3c89137369e08004569a006c4961ec51a725f5854b10f5850882522e11fa9f0",
        "signatures": [
          "SIG_K1_KeiMPhLtmYSjPSQ7Tuu5EghYPg1RJtbzbejFP1S1nUz76ktodEucJd6xX5aycrECVw2Jcd19XbGvPvPUkTdqG2X8UYoaf6"
        ],
        "compression": "none",
        "packed_context_free_data": "",
        "context_free_data": [],
        "packed_trx": "e5f63c5be94856cccf4a00000000010000000000ea3055000000004873bd3e01a0bd74a621a954c600000000a8ed323220a0bd74a621a954c6a0bd74a621a954c6102700000000000004454f530000000000",
        "transaction": {
          "expiration": "2018-07-04T16:33:41",
          "ref_block_num": 18665,
          "ref_block_prefix": 1255132246,
          "max_net_usage_words": 0,
          "max_cpu_usage_ms": 0,
          "delay_sec": 0,
          "context_free_actions": [],
          "actions": [{
              "account": "eosio",
              "name": "buyram",
              "authorization": [{
                  "actor": "steemchaimyu",
                  "permission": "active"
                }
              ],
              "data": {
                "payer": "steemchaimyu",
                "receiver": "steemchaimyu",
                "quant": "1.0000 EOS"
              },
              "hex_data": "a0bd74a621a954c6a0bd74a621a954c6102700000000000004454f5300000000"
            }
          ],
          "transaction_extensions": []
        }
      }
    }
  ],
  "block_extensions": [],
  "id": "003f4a40a4e7991b4148ba68af62559cef0a8a4d41cae90ae3f031f4d994d891",
  "block_num": 4147776,
  "ref_block_prefix": 1757038657
}

从交易数据中可以看到付费人、接收人、数量。

用以下命令可以看到更详细交易数据:

./cleos -u https://api.cypherglass.com get transaction e3c89137369e08004569a006c4961ec51a725f5854b10f5850882522e11fa9f0

再看看ram容量:

(env3) Chaim:cleos Chaim$ ./cleos -u https://api.cypherglass.com get account steemchaimyu
permissions: 
     owner     1:    1 EOS721oMgkFUbKLHfbt3DGUSWVE4mMavHx8n6Fdw9aExg2Ls4dsVv
        active     1:    1 EOS721oMgkFUbKLHfbt3DGUSWVE4mMavHx8n6Fdw9aExg2Ls4dsVv
memory: 
     quota:     5.756 KiB    used:     3.051 KiB  

net bandwidth: 
     delegated:       0.0500 EOS           (total staked delegated to account from others)
     used:               129 bytes
     available:        26.08 KiB  
     limit:            26.21 KiB  

cpu bandwidth:
     delegated:       0.0500 EOS           (total staked delegated to account from others)
     used:             3.104 ms   
     available:        2.016 ms   
     limit:             5.12 ms   

与之前的对比:

(env3) Chaim:cleos Chaim$ ./cleos -u https://api.cypherglass.com get account steemchaimyu
permissions: 
     owner     1:    1 EOS721oMgkFUbKLHfbt3DGUSWVE4mMavHx8n6Fdw9aExg2Ls4dsVv
        active     1:    1 EOS721oMgkFUbKLHfbt3DGUSWVE4mMavHx8n6Fdw9aExg2Ls4dsVv
memory: 
     quota:     3.497 KiB    used:     2.926 KiB  

net bandwidth: 
     delegated:       0.0500 EOS           (total staked delegated to account from others)
     used:                 0 bytes
     available:        26.21 KiB  
     limit:            26.21 KiB  

cpu bandwidth:
     delegated:       0.0500 EOS           (total staked delegated to account from others)
     used:                 0 us   
     available:        5.119 ms   
     limit:            5.119 ms   

1EOS买了2.259K,合0.4427EOS/K,这个操作还用掉了0.125K,还有手续费0.005EOS,这样得0.4686EOS/K了。

网络带宽用了129bytes,CPU带宽用了3.104ms。

结论

买卖RAM整个操作起来还是很麻烦的,一般人估计也没有这个功夫来这样玩,写文章时现在EOS用户有252461人,真正买卖的又有多少人呢,这样价格也很容易被操纵,大涨大跌短期是必然的。

还有更麻烦的是,也不能指定价格,也不能挂买卖单,这方面有机会吗?我看是应该有,除了很多钱包上了RAM买卖外,不还有ZB、OTCBTC的主动上EOSRAM吗!

参考

更多数据格式参考官网,官网提供了cURL、Node、Ruby、JavaScript、Python等访问方式示例:
https://developers.eos.io/eosio-nodeos/reference


感谢您阅读 chaimyu@chaimyu 的帖子,期待您能留言交流!