You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ah interesting, I could fetch the gas cost but I need to know where to look for it
In the deserialized create/call transaction params you can get the gas price and gas limit
Funds transferred to contract
It's the amount of the output with the OP_CREATE or OP_CALL opcode in the scriptpubkey
balance of the contract
The account state keeps track of current contract balances. There's an API call on the smart contracts controller that you can look at for an example. Each contract with a balance has a single unspent output stored in the account state. When a contract spends funds it uses a special opcode in the input scriptpubkey OP_SPEND.
Funds transferred from a contract
Contracts spending funds use an input with the scriptpubkey beginning with OP_SPEND (important to note: so do gas refunds)
Gas refunds
Input's scriptpubkey begins with OP_SPEND and they are all in the last transaction in the block (condensing transaction)
Funds transferred between contracts
Output's scriptpubkey begins with OP_INTERNALCONTRACTTRANSFER + the contract address who can spend the output.
The text was updated successfully, but these errors were encountered:
I will use this issue to dump valuable info on logs:
Quick rundown on logs:
A log contains 3 things, the address of the contract, the "topics" and the data. The receipts in a block are put into a merkle tree and its root forms part of consensus in the block header as the "receipt root"
All logs have fields, some are indexed and some are not.
The whole serialized log is the "data" field.
The fields marked with [Index] are "topics". Topics have their bytes added to a bloom filter, which is included in the block header as the "logs bloom". The first topic is always the contract address. The reason for having [Index] and using the bloom filter is that it is very fast to search through blocks for specific topics
how would I fetch this values form the State? For example the StandardToken constructor has no logs but I would like to get the values of params sent to it
To get the values of the params sent to the constructor, you'd need to look at the transaction that created the contract
ah interesting, I could fetch the gas cost but I need to know where to look for it
In the deserialized create/call transaction params you can get the gas price and gas limit
Funds transferred to contract
It's the amount of the output with the OP_CREATE or OP_CALL opcode in the scriptpubkey
balance of the contract
The account state keeps track of current contract balances. There's an API call on the smart contracts controller that you can look at for an example. Each contract with a balance has a single unspent output stored in the account state. When a contract spends funds it uses a special opcode in the input scriptpubkey OP_SPEND.
Funds transferred from a contract
Contracts spending funds use an input with the scriptpubkey beginning with OP_SPEND (important to note: so do gas refunds)
Gas refunds
Input's scriptpubkey begins with OP_SPEND and they are all in the last transaction in the block (condensing transaction)
Funds transferred between contracts
Output's scriptpubkey begins with OP_INTERNALCONTRACTTRANSFER + the contract address who can spend the output.
The text was updated successfully, but these errors were encountered: