It would be great if we can have our own blockcypher.com (or chain.com) or ask them to integrate bitshares.
I managed to create and broadcast a raw transaction using the code below.
Please give me some directions:
1) Who do i track records ids of accounts that are not in the wallet db? (read only accounts)
Should i export the wallet to json and add a new account_record_type?
#include <iostream>
#include <vector>
#include <bts/blockchain/transaction.hpp>
#include <fc/crypto/elliptic.hpp>
#include <fc/io/json.hpp>
#include <fc/crypto/hex.hpp>
#include <bts/utilities/key_conversion.hpp>
using namespace bts::blockchain;
using namespace bts::utilities;
int main(int argc, char** argv)
{
const std::string tx_json = R"(
{
"expiration": "20141028T085151",
"delegate_slate_id": null,
"operations": [{
"type": "register_account_op_type",
"data": {
"name": "justtesting",
"public_data": null,
"owner_key": "BTSX6yNA6Kc1qYSUt1ppFe8oPKcnWGHCg11VLKTY36V9jfyQvswjdh",
"active_key": "BTSX6yNA6Kc1qYSUt1ppFe8oPKcnWGHCg11VLKTY36V9jfyQvswjdh",
"delegate_pay_rate": 255,
"meta_data": {
"type": "public_account",
"data": ""
}
}
},{
"type": "withdraw_op_type",
"data": {
"balance_id": "BTSX6nhkTeg1qnBbCHtJ4q8GUrBU9Sq2fTS23",
"amount": 50,
"claim_input_data": ""
}
}
]
}
)";
auto tx = fc::json::from_string(tx_json).as<signed_transaction>();
auto priv = wif_to_key("[edited]");
fc::sha256 chain_id;
fc::from_variant("75c11a81b7670bbaa721cc603eadb2313756f94a3bcbb9928e9101432701ac5f", chain_id);
auto signature = priv->sign_compact( tx.digest(chain_id) );
tx.signatures.push_back(signature);
std::cout << fc::json::to_pretty_string(tx) << std::endl;
vector<char> data;
data = fc::raw::pack(tx);
std::cout << fc::to_hex(data) << std::endl;
return 0;
}