3

From what I understand, you must provide Ether so there's an incentive for miners to run the contract, but what else is provided?

Must you sign cryptographically (to make sure an unrelated party doesn't trigger it?) Any other data or variables required?

Trying to understand from a process/business perspective rather than a technical one.

2

At a basic level, you need:

  • ether
  • signature
  • sequence ID number (technical terms called a nonce)
  • data about which contract you want to trigger, what functionality of the contract you want to trigger, and any data the contract needs to provide the functionality

As an example, if there's a contract C that has functionality that adds 2 numbers add(n1, n2), you need to provide C's address, and encoded data signifying you want to add and what the 2 numbers are.

The ID number is to prevent replay attacks on the same blockchain network (but be careful across public and private blockchains).

| improve this answer | |
  • You should note that unless the contract specifically cares about msg.sender, it doesn't matter who calls it. (OP had a question about signatures and unrelated parties) – Tjaden Hess Apr 15 '16 at 13:37
  • Yes, wanted to keep it basic and agree we should clarify more. OP: a signature "proves" who's calling the contract. A contract needs explicit code "to make sure an unrelated party doesn't trigger it": a signature by itself doesn't allow or disallow access. – eth Apr 15 '16 at 18:06
1

Adding to eth's answer, assuming it would help any future technology enthusiasts.

To trigger a contract you need everything as explained by eth, from the technology perspective you need an actual contract written in either solidity or serpent

Steps for deploying a contract would be,

  1. Write the contract
  2. Compile it using solidity or serpent
  3. Create and deploy a contract

The entire process is explained in detail ethdocs.org here and ethereum.org here

Example Contract

contract HelloWorld {
        event Print(string out);
        function() { Print("Hello, World!"); }
}
| improve this answer | |
  • Yes, but both the process documents you linked to have glaring errors in the code suggestions (e.g. failing to close brackets) and are non-functional. What's the best way to get those updated to actually be functional docs? – coderintherye May 1 '16 at 6:25
  • @coderintherye those are the official sources, either submit a PR and wait them to approve or find a workaround. – niksmac May 1 '16 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.