Local compilation

How can I compile Sophia code the easiest to test Sophia scripts for correctness?

Is there an online compiler?

forgae compile contracts/ExampleContract.aes failed me with

===== Compiling contracts =====
API ERROR: Error: connect ECONNREFUSED 127.0.0.1:3001

I am guessing I need to be running a node then for compiling? What would be the most convenient way to get one running in that case & why would it be needed?

Thanks!

forgae node can get you a local node up and running. Then you can use forgae compile to try compiling your contract locally.

Thanks a lot. That’s a bit of overhead, VirtualBox, Docker, a node running, just to compile. There is no way to compile without all that?

It fails for me now with:

$ forgae compile contracts/ExampleContract.aes 
Password:
===== Compiling contracts =====
(node:44178) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'includes' of undefined
    at Object.run (/usr/local/lib/node_modules/forgae/forgae-compile/compile.js:53:14)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:44178) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:44178) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Here is version information, in case that helps:

 $ forgae --version

2.0.1

$ aecli --version

2.1.0

The fastest way for compiling and testing a simple smart contracts is via the contracts aepp or the playground

Here is a link to both of them : https://testnet.contracts.aepps.com, https://testing.playground.aepps.com.

About the forgae issue, are you sure that the node and compiler are up and running?

Thanks

i tried installing forgae but got an error

C:\Users\goote_000\Documents\smart_contracts\aepp-contracts\node_modules\argon2>
if not defined npm_config_node_gyp (node “C:\Program Files\nodejs\node_modules\n
pm\node_modules\npm-lifecycle\node-gyp-bin\…\node_modules\node-gyp\bin\node
-gyp.js” rebuild ) else (node “C:\Program Files\nodejs\node_modules\npm\node_mo
dules\node-gyp\bin\node-gyp.js” rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\goote_000\AppData\Local\Programs
Python\Python37-32\python.EXE -c import sys; print “%s.%s.%s” % sys.version_info
[:3];
gyp ERR! stack File “”, line 1
gyp ERR! stack import sys; print “%s.%s.%s” % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at maybeClose (internal/child_process.js:982:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_proces
s.js:259:5)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodej
s\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js” “rebuild”
gyp ERR! cwd C:\Users\goote_000\Documents\smart_contracts\aepp-contracts\node_mo
dules\argon2
gyp ERR! node -v v10.16.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN [email protected] requires a peer of [email protected]^6.0.0 but none is
installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fse
vents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]
1.2.9: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“x64”}
)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\goote_000\AppData\Roaming\npm-cache_logs\2019-06-15T00_22
_13_396Z-debug.log

hey can you share information on what python, nodejs version you are using and also the OS

Thanks