14 votes
Accepted

Can someone explain the transaction struct?

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 ...
user avatar
  • 1,414
12 votes
Accepted

What is the purpose of `require_recipient`?

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 ...
user avatar
  • 1,985
9 votes
Accepted

How to embed eosio nonce action in transaction to get over Error 3030011: duplicate transaction?

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 ...
user avatar
  • 106
8 votes
Accepted

What block hash function and transaction signature method does EOS use?

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). ...
user avatar
  • 1,985
8 votes

How to sign raw transaction with eosjs?

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....
user avatar
  • 453
8 votes
Accepted

Can a transaction be posted to the blockchain without an associated account?

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 ...
user avatar
  • 1,165
5 votes

Can a transaction be posted to the blockchain without an associated account?

No. You can send it but it will be rejected by nodeos due to invalid signature.
user avatar
5 votes
Accepted

Is there any method to know whether a transaction has been confirmed or not?

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-...
user avatar
  • 3,023
5 votes
Accepted

Is it advisable to use global variable in smart contract?

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 ...
user avatar
  • 2,104
5 votes
Accepted

Is it really the case that transacting on EOS is cheaper than Ethereum?

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-...
user avatar
  • 3,405
5 votes

Why the first time I execute an action I get "Error 3080006: transaction took too long"?

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-...
user avatar
  • 174
5 votes
Accepted

Accessing current transaction ID within a smart contract

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 ...
user avatar
4 votes
Accepted

transaction with actions across two contracts

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 ...
user avatar
  • 1,824
4 votes

how to know if a transaction was include in block?

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, ...
user avatar
  • 1,686
4 votes
Accepted

Size limit for transaction data?

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 ...
user avatar
  • 5,524
4 votes

Is it really the case that transacting on EOS is cheaper than Ethereum?

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 ...
user avatar
  • 5,524
4 votes

Meaning of N() function in multi_index

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.
user avatar
4 votes

How can I get an accounts currency balance using eosjs

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 } = ...
user avatar
4 votes
Accepted

New version of eosjs does not use chainId, How does it work?

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 ...
user avatar
  • 1,165
4 votes
Accepted

How to transfer EOS Token with eosjs?

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: ...
user avatar
  • 175
3 votes

ICO/Payment contact

Look at this example: https://gist.github.com/MikkySnow/feac6fd5a9d49da207b9bd59d3c672c4 Hope it will help you #include <eosiolib/eosio.hpp> #include <eosiolib/currency.hpp> using ...
user avatar
3 votes
Accepted

Example of smart contract action that itself executes a transaction

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/...
user avatar
  • 3,023
3 votes

How to sign raw transaction with eosjs?

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. ...
user avatar
  • 833
3 votes

Can we get all the actions from all blocks?

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-...
user avatar
  • 3,023
3 votes

Sending transaction from a Windows application

I see 3 main options: Option 1 Bundle the cleos and keosd binaries with your application, so you can run them as children processes of your application and issue commands to them to manage the ...
user avatar
3 votes
Accepted

Transaction id is a hash of what?

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 ...
user avatar
  • 5,524
3 votes

How to send EOS based tokens from one account to another?

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( ...
user avatar
  • 3,405
3 votes

Why do failed transactions not consume CPU?

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. ...
user avatar
3 votes

Accessing current transaction ID within a smart contract

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 ); ...
user avatar
3 votes
Accepted

Order transactions get mined in

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 ...
user avatar

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