14

expiration -> after this time the transaction can never be included in a block. ref_block_num / ref_block_prefix -> this transaction can only in blockchains where the highest block_num%0xff has a blockid that contains ref_block_prefix. Stated another way, this says the transaction can only be included in forks that build off of the reference block. Taken ...


11

Think of it as sending a carbon copy of the action. Since eosio.token does it with transfer, contracts can monitor and respond to deposits. e.g. if user a transfers EOS to contract b, then b could automatically transfer another token type back to a, creating a simple exchange.


8

Block producers use SHA-256 to generate the digest and ECDSA to sign the block. Producers may sign using a K1 key (secp256k1 curve, used by Bitcoin) or an R1 key (P-256 curve, a NIST standard). Likewise, users may use K1 or R1 keys to sign transactions.


8

You can use eosjs-ecc for signing easily. If you want to sign a hash: ecc.Signature.signHash(sha256hash, privateKey).toString() If you want to sign something that isn't a hash: ecc.sign(Buffer.from(someData, 'utf8'), privateKey) Edit: The transaction itself will have to be serialized based on the ABI, packed and then signed. eosjs uses fcbuffer for that....


8

According to the current documentation on GitHub, no. Accounts An account is a human-readable name that is stored on the blockchain. It can be owned by an individual or group of individuals depending on permissions configuration. An account is required to transfer or otherwise push a transaction to the blockchain. documentation


7

Use the -f option in cleos This option will instruct cleos to include a nonce action in the transaction you are creating, that will make the tx unique. -f,--force-unique force the transaction to be unique. this will consume extra bandwidth and remove any protections against accidently issuing the same transaction multiple times


5

No. You can send it but it will be rejected by nodeos due to invalid signature.


5

You need to check the irreversible block: an action is irreversible (final) if "block_num" < "last_irreversible_block" Check this out: https://github.com/EOSIO/eos/wiki/Tutorial-Exchange-Deposit-Withdraw#machine-readable-account-history-json If you are inside the contract and have a reference of a transaction/action/receiving-action you can assume ...


5

Global variables are more or less a design thing. I personally do not like them because of object-orientation for languages like c++. They are good for script languages, but if your application or contract gets complex, things get complicated and they are hard to maintain. However you do not have to worry about access of our global variable because of the ...


5

Updated 4/2019 In addition to the points below. With vAccounts, account creation will become significantly less expensive. Read more here: https://medium.com/@liquidapps/all-aboard-the-eos-train-its-free-dbc00d9b21f https://cointelegraph.com/press-releases/liquidapps-introduces-vaccounts-free-access-to-blockchain-applications Previous Answer Your ...


5

There are two issue on github: this which refers to this. According to these two links, you cannot access directly the transaction id, but the id is a calculated value, so you can compute it in your smart contract. From the second link, you can get this code: void test_transaction::test_read_transaction() { using namespace eosio; checksum256 h; ...


4

In EOS, you can construct Transactions that contain multiple actions. When the transaction is submitted, all of the actions must succeed, or the entire transaction will fail. An example is available in the Smart Contract tutorial on the EOS Wiki.


4

Yes, this is more involved in EOS. You need to connect to a node which implements the history_api_plugin. Then you can use cleos, the command line tool to check for the status of the transaction, response will be a JSON with info on the transaction: $ cleos get transaction eb4b94b72718a369af09eb2e7885b3f494dd1d8a20278a6634611d5edd76b703 { "transaction_id"...


4

From the documentation, only CPU limitations are specified: Transaction Limitations Every transaction must execute in 30ms or less. If a transaction contains several actions, and the sum of these actions is greater than 30ms, the entire transaction will fail. In situations without concurrency requirements for their actions this can be ...


4

In other words, the user has to pay gas in case of Ethereum but anyway user has to spend some amount of network bandwidth/RAM/CPU usage in case of EOS while transacting so in a way user is paying while transacting, then how a transaction is cheap or free? Because a user has to buy these resources in order to utilize them. You don't pay for these resources ...


4

The primary key for a multi_index table can not be a string. In general it should be an int. The N() macro converts the contents within the brackets into a uint64_t.


4

The execution time is based on many factors in each execution. It could be the cache missing or process management could blocks the nodeos process and makes the execution time exceeds the max-transaction-time. The max-transaction-time set by nodeos on startup or in the config file controls the time to throw the Error 3080006. The default value is 30ms. ...


4

eosjs does require chainId, but if it isn't provided directly it will be retrieved from the host endpoint. Api accepts chainId as an argument but if chainId isn't passed as an argument when the api is constructed, Api will fetch it from the host endpoint via JsonRpc. transact() checks to see if chainId is set. If not, it calls rpc.get_info() which returns ...


3

Look at this example: https://gist.github.com/MikkySnow/feac6fd5a9d49da207b9bd59d3c672c4 Hope it will help you #include <eosiolib/eosio.hpp> #include <eosiolib/currency.hpp> using namespace eosio; class hello : public eosio::contract { public: using contract::contract; hello(account_name self) : contract(self) {} /// @...


3

Check this example of delegate bandwith, it executes the transfer action from the eosio.token contract using the INLINE_ACTION_SENDER to buy ram: https://github.com/EOSIO/eos/blob/dacc1b09d2c10cc3ca4cea7821c04ea2a47487fe/contracts/eosio.system/delegate_bandwidth.cpp#L147 This is the code: if( payer != N(eosio) ) { INLINE_ACTION_SENDER(eosio::token, ...


3

To sign a transaction offline you can use eosjs. There is a configuration option broadcast [boolean=true] - post the transaction to the blockchain. Use false to obtain a fully signed transaction. If you want to translate it to another language you need to convert the code from eos.transaction (https://github.com/EOSIO/eosjs/blob/...


3

You can get the inline actions in get_actions RPC History API endpoint or inside the details of a transaction using also the RPC API get_transaction. So that's exactly what I'm doing in that eos-node-watcher, I filter all the transactions relevant to my dapp and call get_transaction for them. The thing is that you could just shortcut it by running ...


3

From what I can tell, it's a hash of the transaction itself and the chain id: From libraries/chain/transaction.cpp: digest_type transaction::sig_digest( const chain_id_type& chain_id, const vector<bytes>& cfd )const { digest_type::encoder enc; fc::raw::pack( enc, chain_id ); fc::raw::pack( enc, *this ); if( cfd.size() ) { fc:...


3

You would add a transfer command to your token's contract as can be seen here. There is also a simple token contract example here if you don't need all the bells and whistles. .hpp void transfer( account_name from, account_name to, asset quantity, string memo ); .cpp void token::transfer( account_name from, ...


3

If transaction fails - it will fail on first validating node. It will not reach block producing node at all. Which mean there is no way this account can be charged for broadcasting bad transaction. And AFAIK the same goes with bitcoin and ethereum. Do you have other information?


3

In eosjs v20.x, getCurrencyBalance has been renamed to get_currency_balance, and moved within the Rpc object. You can use it like this... const fetch = require('node-fetch'); const { JsonRpc } = require('eosjs'); // Instantiate a new JsonRpc object, with the Network Api Uri, and a request object const rpc = new JsonRpc('https://api.kylin.alohaeos.com', { ...


3

Here's an updated example using EOSIO CDT 1.6 code syntax checksum256 get_trx_id() { size_t size = transaction_size(); char buf[size]; size_t read = read_transaction( buf, size ); check( size == read, "read_transaction failed"); return sha256( buf, read ); } Afterwards you can include get_trx_id method into other parts of your smart ...


3

You are right, this is the case in EOS as well. The transactions are ordered First In First Out (FIFO) and this is how the block producers order the transactions by the ID's and the hashes. One possible exception to this would be if there was a microfork, such that transaction A goes to block producer 1 as his last block, and transaction B goes to block ...


3

After searching the official doc and trying different approches I finally got it to work. I've used eos.transaction instead of eos.transfer and the following example is working for those interested: var res = await eos.transaction({ actions: [ { account: "eosjackscoin", //has to be the smart contract name of the token you want to transfer - ...


3

Do I need to shift to a standard like erc-20 ? This really depends on what you're trying to achieve. The NFT and ERC-20 are fundamentally different. Do you understand the difference? Non fungible tokens are used to manage ownership of unique items which are not equal in properties and value. An example for a non fungible item is when your friend lends you ...


Only top voted, non community-wiki answers of a minimum length are eligible