Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [contract-development]

Questions regarding the development of smart contracts

4
votes
1answer
444 views

How to reference coin contract already onchain?

In this tutorial: https://dappsforbeginners.wordpress.com/tutorials/interactions-between-contracts/ they talk about interactions between contracts. However, the metacoin contract appears to be in the ...
2
votes
0answers
137 views

Using External API in a Contract? [duplicate]

Is it possible (and feasible) to have a solidity contract connect to an external api and execute a contract based on what is found? For example betting on sports games by agreeing to a credible API ...
3
votes
2answers
375 views

Mix IDE Tutorial error: index.html - line 15 - Uncaught TypeError: Cannot read property 'contract' of undefined

I got the following JS error: JavaScript error: index.html - line 15 - Uncaught TypeError: Cannot read property 'contract' of undefined whenever I tried to enter a name and a rating in store ...
7
votes
1answer
94 views

Is Coin a reserved word?

If I try to compile the following example code in Mix it doesn't work. As soon as I change the name from Coin to Coins it starts working as supposed? Is this a bug or a feature? contract Coin { //...
5
votes
2answers
961 views

Using a contract multiple times with multiple people

Just a question for my understanding. Let's say I have a contract that has two people involved (for example, a buyer and a seller). Through ethereum, is it possible to re-use this contract and use an ...
7
votes
1answer
405 views

How do I plan for an upgrade on my contract? [duplicate]

Absolute beginner question: If I assume that my contract is complex and will need future features or bugfixes, and that it holds assets and records privileged addresses, how should I prepare for an ...
3
votes
1answer
430 views

How do I make a Dapp that orders pizza?

So I recently purchased ether.pizza with the intention of setting it up so people can order pizza with ether just to use as an experiment in Dapp and contract development. Initially I plan on just ...
23
votes
1answer
8k views

Cannot perform write functions in smart contract - invalid address?

I have the following simple smart contract... contract SimpleStorage { uint storedData; function set(uint x) { storedData = x; } function get() constant returns (uint retVal) ...
13
votes
1answer
3k views

How to make external contract function calls from one contract to another?

I'm having a hard time understanding the documentation for making an external function call from one contract to another. In this tutorial there is an example: contract InfoFeed { function info() ...
28
votes
8answers
13k views

What are the development tools for Ethereum?

Could someone make a list with development tools for Ethereum together with a short description what they are good for?
10
votes
2answers
3k views

Is it possible to call Ethereum API from a Software Application without running an ETH node?

I was wondering if it's possible to make a call to Ethereum blockchain from a software application on my computer without having to run an ethereum node ? for example, I want to make calls from a ...
2
votes
1answer
420 views

Pass an array along when a contract creates a new contract

Can an array be passed along as a contract creates a new contract ? Specifically, an array of addresses. address[] verifiedUsers; new generatePOItokens(verifiedUsers);
5
votes
1answer
131 views

Using strings in a Serpent contract

In the limited documentation on Serpent, it mentions the ability to use a str type as both input and output to a contract function. Short strings are converted to numbers and longer text uses the ...
2
votes
1answer
77 views

Contracts with custom fee and limited numbers of transactions

Is there a valid way to set custom re-sell fee for "custom currency", e.g. https://blog.ethereum.org/2015/12/03/how-to-build-your-own-cryptocurrency/ and limit this re-sells somehow? For example: 0. ...
8
votes
1answer
835 views

Can a contract access the code of another contract?

Using web3.js, the EVM (bytecode) of a contract can be obtained by web3.eth.getCode(addressOfContract). Can this be performed by a contract using the address of another contract? If so, how? ...
13
votes
2answers
3k views

Can a contract listen to events of another contract?

I read that to listen to events you need to use web3.js. Are there other ways of doing it? Can a contract even somehow listen to events of another contract? Thanks!
1
vote
1answer
96 views

Contract functions not triggered

My contract deployed on address 0x63788a3eace0d77c5573787e3f9c9515c246d0e6 Is not getting executed via Mist browser. I have tried execute NewPoll function that requires 4 fields text 32 bytes I ...
8
votes
2answers
814 views

Is there a comprehensive reference list of all Solidity commands?

Is there a comprehensive reference list of all Solidity commands?
3
votes
1answer
491 views

Does a contract message call require a signature from the sender?

Say for example you have this simple contract: contract Example { function sayHello() constant returns (string msg) { return "hello"; } And I make a message call: exampleContract.sayHello....
3
votes
0answers
130 views

How to use an accessor for imbricated data types?

I'm looking at information about accessors in solidity/js for more complex data structures than just a public array/mapping. How can i access the array in that code for: struct AnotherStruct {....} ...
8
votes
1answer
4k views

Basic example of interaction between 2 contracts?

What is a basic example of one contract invoking a method in another (non-calling) contract? Would the address of the contract having that method always need to be hardcoded?
2
votes
3answers
193 views

Is it possible to chain mulitiple individual transactions into a single “all or nothing” transaction?

Lets say I have a contract with a bunch of individual properties. For example, a person with a firstName and lastName field. A user of a dapp wants to change both fields, which would take two ...
36
votes
5answers
24k views

How to delete an element at a certain index in an array?

Anyone know how to delete an element in a array? Is there any built in method to do that? If not, does anyone know of how to implement such a method?
11
votes
4answers
4k views

Sorting an Array of integer with Ethereum

I'm trying to have a simple array of integer sorted in Solidity but i couldn't find any real ressources so instead i'm trying to do it "the hard way" but so far with very little success. Is anyone ...
29
votes
1answer
23k views

How to Initialize a Struct?

I have a struct like so : struct fooStruct { uint foo; uint figther; } I would like to initialize that struct but it won't be stored in a mapping but inside an array. Is there a way to ...
6
votes
1answer
1k views

How does a fallback function rejecting ether work?

A contract in Solidity can have a fallback function like: // This contract rejects any Ether sent to it. It is good // practise to include such a function for every contract // in order not to loose ...
7
votes
1answer
1k views

Who pays gas when a contract function that creates/calls another contract is called?

If I call a function of Contract1, that creates/calls another Contract2. Who pays the gas used to call Contract2 ? I think it's Contract1 - the second msg.sender. In that case, how can I make the ...
6
votes
1answer
177 views

Why do some functions from my contract end up in the ABI while others don't?

Using the greeter example, The original contracts is written with 4 methods: mortal(), kill(), greeter(), and greet(). Why then when I look at the mined contract does it show me an ABI of: { ...
13
votes
1answer
9k views

Mapping with array as Key Or Value data type

Is it possible to do a mapping with an Array as key/value ? Where an array would exist for each value ? I'm actually looking to store structs in a mapping but can't seem to have it work. Struct Foo{...
5
votes
1answer
733 views

Can you input decimals number in smart contract?

I'm having an issue where send 0.1 or 1.1 is saved as 0 and 1 in my contract's storage. Does anyone knows how to properly pass decimals ?
30
votes
2answers
19k views

Solidity, create contract from contract

Based on documentation it should be possible to create new contract from contract contractAddress = new OwnedToken(name); When I invoke this method from contract, the address I receive seems to be ...
12
votes
4answers
2k views

How can I get a list of of transaction data which are sent to a specific contract?

I'd like to get a list of all transactions which are sent to specific contract or method of contract. What kind of way do we have to implement it?
13
votes
2answers
2k views

Can a contract access another contract's storage?

I have a contract with numerous complex structs. Is it possible for a second contract to iterate over this data directly? I can't really use public accessor/getter methods as it's not possible to use ...
4
votes
0answers
608 views

Why are underscores used in front of parameters, instead of contract member variables? [duplicate]

In Solidity, for example, why: function Greeter(string _greeting) public { greeting = _greeting; } instead of: function Greeter(string greeting) public { _greeting = greeting; } The latter ...
3
votes
2answers
416 views

Can I use my own coin in 3rd party contracts?

I know you can create your own coins in ethereum but can they be used in 3rd party contracts that normally use ether?
15
votes
2answers
4k views

What is the purpose of underscores in front of parameters?

I see contracts that use underscores in front of parameter names, like so: function Greeter(string _greeting) public { greeting = _greeting; } What's the purpose of these underscores? Do they ...
3
votes
2answers
258 views

From the solidity SubCurrency example: return statements

Obviously this is rookie question, however I do not believe Solidity docs, nor W3Schools explicitly state this. In the return statement, is the second line in the block equivalent to a second Then ...
3
votes
1answer
127 views

How can the global registrar be called from a contract?

I want to call what i would do in geth with registrar.owner(namevar) from a solidity contract. Is this possible - and how?
4
votes
2answers
684 views

Is it safe and effective to use 128 bit integers to track wei in a contract in order to save gas?

The default type for Wei in Solidity is the 256 bit unsigned integer. (e.g. msg.value) However, to track 1.7e38 wei (1.7e20 ether) you only need a 127 bit integer. That's a gigantic number not ...
5
votes
1answer
847 views

What is BlockApps and how can it be used with Ethereum?

BlockApps says: Customized, permissioned private Blockchain ledger to your specifications. Based on Turing-complete Ethereum standards, your Blockchain has full Smart Contract support built-in. ...
7
votes
2answers
3k views

How can ethereum be used to send messages between connected machines?

I want to know how I can send messages between accounts and contracts. The idea is that I have three Raspberry Pi devices. Each one is connected to an object (the first to a temperature sensor, the ...
14
votes
5answers
3k views

How do I know when I've run out of gas programmatically?

This keeps coming up on the gitter forums so I thought I'd ask and answer this question: How do you know when you've run out of gas?
5
votes
4answers
788 views

What is Etherparty?

Etherparty is a platform that removes the complexity and management of creating and executing smart contracts. What exactly does that mean, and how does that work?
4
votes
1answer
143 views

What is the C-Like Language CLL?

There are some older projects, dated back to 2014 which develop contracts in CLL, C-Like Language. What is this and is this still being developed/used?
9
votes
2answers
5k views

How to concatenate a bytes32[] array to a string?

I am passing an array of bytes32 to my function. This array can contain numbers or hashes etc. to identify an object. In a new use case I want to pass a URL to this function by splitting the URL into ...
3
votes
3answers
2k views

What is the best language to start programming in Ethereum?

I have an introduction to C++ under my belt (very simple stuff), and other skills like an occasional R script, that's about it. Where should I go from here?
14
votes
3answers
2k views

Accessing past values of Smart Contract variables

I would like to know if is possible to inquiry variable values using older blocks. For example I have contract Simple { string32 message public; function Simple() { message = msg....
5
votes
3answers
2k views

How to compare msg.data (calldata) data type to an integer data type uint256?

As per my question here: I need to compare msg.data (specifically, numbers that are sent with the sendTransaction data object) to a data type of uint256 within my contract. How is this possible?
4
votes
1answer
854 views

If statement doesn't hit certain conditions

I'm currently working on a very simple(first project) market in solidity and i'm having an issue with a piece of code : contract smallMarket{ struct transaction { uint timeStamp; ...
9
votes
2answers
1k views

How to pass struct mappings to solidity functions?

I have two mappings (uint => customStruct) called listA and listB. I want to run both through a single function to perform operations on the contents. How do I pass this type into a function so ...