4

is there any way to execute functions on a smart contract (as EVM-Bytecode) in a separate program like evm (provided by go-ethereum) without having to run a test-network? I need to find a way to run code multiple times so using Remix is unfortunately no option.

Thanks in advance!

3
  • have a look at truffle, their aim is to make ethereum development easier.
    – Malone
    Commented Nov 27, 2017 at 12:46
  • Hi there. What's the issue with running things multiple times in Remix? Why do you want to be able to run it multiple times, and how many times are we talking about? (Clarifying things might help with an answer.) Commented Nov 27, 2017 at 16:56
  • I wanted to run functions on a smart contract multiple times for testing purposes to trace bugs. Using Remix I would need to start each call manually and Web3 w/ testrpc would be too slow. Commented Nov 29, 2017 at 1:20

2 Answers 2

4

Truffle and Ganache seem to be an excellent combo:

  • Ganache is a standalone, in-memory node, designed for development. It can auto-mine, meaning it immediately creates and mine a block each time a transaction is submitted. This make smart contract deployment and invocation almost synchronous.
  • Truffle comes with a command line tool and console with web3 built-in, removing some of the hassle of web3 setup.
  • Truffle lets you write JavaScript tests for your contracts using Mocha and Chai. Definitely the right way to run your contracts "multiple times" :)
2

For whom it may interests, I used the build-in EVM of the Go-Ethereum implementation (Geth). For that I wrote my application in go and mainly used "github.com/ethereum/go-ethereum/core/vm/runtime" and github.com/ethereum/go-ethereum/core/vm" as imports. To generate a EVM-instance I used *runtime.Config and *vm.EVM. Then I used a modified version of the Create- and Call-functions demonstrated in [..]runtime/runtime.go to deploy contracts and call transactions.

1
  • I wonder if you could link the edited code of these two files you used. That would help me a lot for my researches :D
    – Sabrebar
    Commented Dec 18, 2021 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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