Jimmy Guo
  • Member for 3 years, 8 months
  • Last seen more than a month ago
How to convert public key string to char[34] inside contract?
3 votes

void test::test(std::string data, signature sig, public_key pub ) { checksum256 hash; sha256(&data[0], data.size(), &hash); assert_recover_key(&hash, (const char*)&...

View answer
Is it possible to create new account in SmartContract?
Accepted answer
3 votes

Yes, you can refer smart_account_creator Relevant bit: // create account INLINE_ACTION_SENDER(call::eosio, newaccount) (N(eosio), {{_self, N(active)}}, {_self, account_to_create, owner_auth, ...

View answer
How to delete record on EOS if I forget table structure
2 votes

If you forgot that, checkout your history setabi action from block explorer, e.g. eosq.app, and you will get the binanry abi. You can either parse the abi binary to readable json, or just construct ...

View answer
What is a fork database?
2 votes

Fork database is all the valid reversible blocks your node received, once the longest branch has the irreversible block, the branches from the irreversible block will be removed.

View answer
How to retrieve historical EOS supply?
Accepted answer
2 votes

I think you can listen to the block with the issue event of eosio.token, only the issue action can update the supply.

View answer
generate eos keys from Mnemonic/Seed
1 votes

Mnemonic is a standard of bip39 for you to manage all chain private keys with a single master seed, so it's just a method to generate the private key, you can specify any private key you'd like if you ...

View answer
Different actions count returned in every request
1 votes

It depends on your computer, the get_actions method will be finished when max time arrived, in default, it is 100ms, so if your computer is not in performance, it will only return few actions than you ...

View answer
How to get BP votes in EOS using cleos?
1 votes

The votes is not the EOS amount, each EOS has a weight with time change, the half-decayed time is one year, the weight of one EOS is 2^(current year(2018)+(days since the year/365) - 2000), and you ...

View answer
Multi index can access data in contract but (RPC) cleos get table is empty
1 votes

typedef multi_index<N(demos), d> demo_table the first parameter is table name, please keep same with your abi description

View answer
Are there 21 different CPU costs for your transaction because of subjective billing?
Accepted answer
1 votes

You're right, you can wait for the fastest BP, and also, you can vote out the BP which has slow CPU.

View answer
Clearing RAM tables of eosio.token contract
1 votes

Maybe no simple way, because it may cause transaction timeout, you must delete the record one by one, and control the delete number. I think you could have one action on chain, and an execution batch ...

View answer
multi_index query [WHERE]
1 votes

You can use primary key or index to query the data. For the query where, the index provide find and lower_bound and upper_bound method, which returns the iterator, if you have more than one rows, ...

View answer
How do you inherit an eosio contract?
1 votes

Because now the EOS only support to build one cpp file, so you can include the eosio.token.cpp in your cpp file.

View answer
How to get current RAM price inside a contract in C++?
1 votes

You can go to eosio.system and find the exchange_state.hpp, there's a table rammarket for the information, but I can't give you the formula now, you can investigate into it.

View answer
Is there a way to create offline transaction with cleos (or any other safe tool)?
1 votes

I write it myself with java, cleos only support to sign from keosd, if you'd like, try to reuse the wallet-sign method.

View answer
recover_key in contract
0 votes

void assert_recover_key2(const checksum256* digest, const signature* sig, const eosio::public_key* pub) { public_key pub2; pub2.data[0] = char(pub->type.value); memcpy(&pub2.data[...

View answer
How does EOS prevent one contract from accessing another contract's tables without authorization?
Accepted answer
0 votes

You can see the apply_context.cpp, there's three main db operations: db_store_i64, db_update_i64, db_remove_i64, you can't update other tables even if you changed the multi_index definition.

View answer
What is the equivalent of geth's networkid in EOS?
0 votes

Yes, call cleos get info. You will get the block chain id, which is unique to each instance, but shared for all nodes. When you first start the node, you must use the same genesis.json.

View answer
The given contract doesn't exist in the blockchain
0 votes

cleos set contract eosio, should not be eosio, but deneme, and you must create an account for deneme

View answer
what is the difference between wallets and accounts in eos?
0 votes

Wallet is not on the chain, but in your localhost computer, the wallet just stores all your private keys, that's it. The wallet also has a private key that just used to protect your wallet not to be ...

View answer