Linked Questions

2
votes
1answer
967 views

Understanding data payload on contract call [duplicate]

I'm running truffle's default example Metacoin: import "ConvertLib.sol"; contract MetaCoin { mapping (address => uint) balances; function MetaCoin() { balances[tx.origin] = 10000; } ...
3
votes
0answers
38 views

How to make sense of the “data” sent to execute a contract? [duplicate]

I'm trying to understand the technical details of Ethereum and one thing I can't find any info about is the data to be sent to a contract. For example, I have a very simple coin flip betting ...
2
votes
0answers
13 views

Why is it required to know the function selector in a smart contract to call the function? [duplicate]

I understand what a function selector is and how it is computed: The first four bytes of the call data for a function call specifies the function to be called. It is the first (left, high-order ...
48
votes
8answers
22k views

How to get contract internal transactions

I'd like to get the contract internal transactions like: https://etherscan.io/address/0xd654bdd32fc99471455e86c2e7f7d7b6437e9179#internaltx I'm using web3 API. Is there any way to do it? Where do ...
39
votes
8answers
20k views

How to quickly test a Solidity function?

There are snippets and functions of Solidity code provided on this Ethereum Stack Exchange and other sites. What are ways to quickly test them, possibly debug a little, and play around?
48
votes
7answers
7k views

How can I verify that a contract on the blockchain matches the source code?

Given the (Solidity) source code of a smart contract, is there a way to deterministically compile the code and compare it with the code on the blockchain? I want to verify that the contract does what ...
41
votes
3answers
34k views

How to call a contract method using the eth_call JSON-RPC API

Ok, so I'm trying to call a contract method using the methods provided by the Ethereum JSON RPC interface. The JSON RPC is running on an Ubuntu machine. Unfortunately, I can't really get a result back ...
38
votes
6answers
34k views

How do you get a json file (ABI) from a known contract address?

I want to watch a Solidity contract using the Mist browser. I know how to do that and it needs the address and the json. I have the address, but I don't have the json. I do have the source code. Can ...
17
votes
4answers
11k views

Convert address to string

In Solidity, how can I convert the sender address to a string? The comments in How to convert an address to bytes in Solidity? did not provide a working solution
20
votes
3answers
4k views

Pass a function as a parameter in Solidity

Can you pass a function as a parameter in Solidity? My guess: There is the concept of address in Solidity, but they represent contracts. Contracts can have fallback functions, but I don't think you ...
21
votes
2answers
6k views

Do I need a compiled contract just to get the ABI definition?

Why do I need a compiled version of the contract just to get the ABI definition? Seems like the contract address should be enough. Im very confused because I am simply trying to run a contract ...
10
votes
3answers
4k views

How does the EVM find the entry of a called function?

I read the source code of go-ethereum and confused about how does the EVM find the entry of a called function. As the specification said, the data field in a transaction specifies the function and the ...
7
votes
1answer
11k views

What does Solidity's “call” function mean?

address nameReg = 0x72ba7d8e73fe8eb666ea66babc8116a41bfb10e2; nameReg.call("register", "MyName"); //1 nameReg.call(bytes4(sha3("fun(uint256)")), a); //2 if(!nameReg.call.value(10)){throw;} //3 Here ...
7
votes
2answers
3k views

Clarification of “256 bit word” semantics

EVM has "256bit words". Some cases treat strings shorter than 32 bytes (256 bits) as left-justified ascii (packed into the most significant bytes of the word). Does this mean that the word value of ...
3
votes
5answers
3k views

Is there a way to extract ABI from a deployed contract?

I am building a web UI for testing smart contracts and currently I have to supply the ABI for a contract I test. Is there a way to extract the ABI from a deployed contract (preferably programmatically)...
8
votes
1answer
2k views

Documentation On Multisig Wallet in Mist?

Is there documentation related to the built-in multisig wallet contract in the Mist Wallet? I see there are many additional functions in this contract like changing / adding / removing owners etc. ...
6
votes
1answer
2k views

How is an ABI stored in bytecode?

I'm trying to understand how a simple hex string like 0x25d8dcf2 is enough information to execute a function in a contract. I've read up on the ABI and understand that the hex string is basically just ...
5
votes
2answers
3k views

Understanding nameReg.call(“register”, “MyName”) style call between contracts

Here's an example from solidity docs on Address type methods(call method specifically): address nameReg = 0x72ba7d8e73fe8eb666ea66babc8116a41bfb10e2; nameReg.call("register", "MyName"); ...
8
votes
2answers
5k views

Get smartcontract token balance via JSON RPC

Via Geth commandline I can get my smartcontract token balance with: var mytest = eth.contract([{interface}]).at(contract address); mytest.balanceOf(eth.accounts[0]) >998 I want to present the ...
8
votes
1answer
4k views

How to pass arbitrary bytes to a function (2016)

I'm trying to implement a contract which will store bytes blob, a dynamic bytes array. For example I have following struct: Sign { address signer; bytes16 signType; bytes sign; } plus ...
6
votes
2answers
796 views

Why does an empty message still invoke the code of the contract?

An empty message still invokes the code of the contract and is the mechanism that allows Solidity to implement a feature of a fallback function per contract. But when msg.data is empty, why does ...
4
votes
2answers
3k views

What is “data” param of rawTx? How to send ETH by using web3

I want to send eth by using web3 on testnet. Source address is 0xbddf0bf3ac858d7fb8a2bdda55884d61779ba5a9. The destination is 0x8005ceb675d2ff8c989cc95354438b9fab568681. I found the example on web3 ...
4
votes
2answers
2k views

Solidity return string not hex?

Currently I'm using ether.camp to create a contract. At this stage it simply gets and stores some values. However when I try and get the values they are in bytes/hex even though the return type is ...
7
votes
1answer
1k views

When does the fallback function get called?

Is it true to say that if the first four bytes of an Ethereum's transaction does not contain one of the contract's encoded function calls, then the fallback function will be called? In other words if ...
8
votes
2answers
781 views

Can msg.data be used as an identifier?

I'm looking at the multisig wallet implementation here and I see the usage of sha3(msg.data,block.number) being used as an identifier. What exactly is inside the msg.data and why is it unique enough ...
6
votes
2answers
529 views

Is sending some datas in the data field safe?

An airdrop ask to send it 0ETH with 150000 GAS and some datas in DATA field. Is it safe? What could be the aim of this transaction? Thanks.
2
votes
1answer
2k views

How to know the hex code to use in data to call a specific contract function?

For instance, on the BAT ico site, you can see the crowdsale contract address, the ABI and also a string to use in the data part of your transaction if you don't want to call the contract function ...
5
votes
1answer
1k views

How do you get a string value from msg.data in the fallback function?

Im trying to do what The DAO did and do something when a sender sent money to my contract address. But im not sure how to. The something I want to do is to just create a new user in a mapping with the ...
2
votes
1answer
746 views

Where does ABI decoding take place?

I'm trying to understand the winning contract from the Underhanded Solidity Contest. That contract apparently caused an overflow in the ABI decoder, but I'm having a hard time understanding where in ...
5
votes
1answer
655 views

Accessing the last function parameter from msg.data

I have a fallback (unnamed) function in my contract and I know that the last parameter (or first, does not matter) passed is always an uint. Is it possible to somehow access it though the msg.data?

15 30 50 per page