codius-deprecated / example-bitcoin

Example contract showing how to use bitcoinjs in Codius.
ISC License
6 stars 5 forks source link

Error: File or module: "." not found #1

Open Ossip opened 9 years ago

Ossip commented 9 years ago

Hi not sure if I installed something incorrectly - but just did a fresh install of codius & the other examples work! (that's after creating the contract_filesystem directory which was missing)

when doing 'codius run' I get : Error: File or module: "." not found. Cannot locate it in contract files or included modules.

(on Mac OS X) Thanks for looking into this! Ossip

emschwartz commented 9 years ago

Hi Ossip,

I can't seem to reproduce that error. If you check out the latest version of the engine again and run npm install, do you still run into the same problem?

Ossip commented 9 years ago

Hi Evan , thanks for taking a look! (also I need to add that I'm not that familiar with the node/npm ecosystem yet)

unfortunately, no. but after commenting in your console.log in codius-engine/runtime_library/module.js I came to the conclusion that the bitcoinlib-js and assert folders in codius_modules should probably not be empty which they are. also I realized in github they look like a symlink - but git clone created empty folders, even with --recursive . Is some mapping missing?

I pulled in & symlinked bitcoinlib-js and assert via npm - looks better . but now (after it is loading lots of modules) I get this. not sure if I needed a specific version?

Error: Error loading: "./codius_modules/bitcoinjs-lib/src/index.js" Error: Error loading: "./codius_modules/bitcoinjs-lib/src/address.js" Error: Error loading: "./codius_modules/bitcoinjs-lib/src/scripts.js" TypeError: Object function ok(value, message) { if (!value) fail(value, true, message, '==', assert.ok); } has no method 'notStrictEqual'

emschwartz commented 9 years ago

Hm, I have no idea how that happened (they weren't even symlinks on my computer), but thanks for pointing it out. Should be fixed now!

On Tue, Aug 19, 2014 at 11:15 AM, Ossip Kaehr notifications@github.com wrote:

Hi Even , thanks for taking a look! (also I need to add that I'm not that familiar with the node/npm ecosystem yet)

unfortunately, no. but after commenting in your console.log in codius-engine/runtime_library/module.js I came to the conclusion that the bitcoinlib-js and assert folders in codius_modules should probably not be empty which they are. also I realized in github they look like a symlink - but git clone created empty folders, even with --recursive . Is some mapping missing?

I pulled in & symlinked bitcoinlib-js and assert via npm - looks better . but now (after it is loading lots of modules) I get this. not sure if I needed a specific version?

Error: Error loading: "./codius_modules/bitcoinjs-lib/src/index.js" Error: Error loading: "./codius_modules/bitcoinjs-lib/src/address.js" Error: Error loading: "./codius_modules/bitcoinjs-lib/src/scripts.js" TypeError: Object function ok(value, message) { if (!value) fail(value, true, message, '==', assert.ok); } has no method 'notStrictEqual'

— Reply to this email directly or view it on GitHub https://github.com/codius/example-bitcoin/issues/1#issuecomment-52675636 .

Ossip commented 9 years ago

great, now I'm making progress! thanks again :) I still needed to add these modules to the codius-manifest & codius_modules , but that worked: "bs58check", "ecurve", "crypto-js"

as I got messages like this: Error: Error loading: "./codius_modules/bitcoinjs-lib/src/index.js" Error: Error loading: "./codius_modules/bitcoinjs-lib/src/address.js" Error: Error loading: "./codius_modules/bitcoinjs-lib/src/scripts.js" Error: Error loading: "./codius_modules/bitcoinjs-lib/src/script.js" Error: Error loading: "./codius_modules/bitcoinjs-lib/src/crypto.js" Error: Module "crypto-js" not declared in manifest. All modules must be declared in manifest.

So now it starts. However I don't seem to get any data into the contract. Using echo the input.getAsync().then(function(data) has empty data .. (I'm investigating further..)

emschwartz commented 9 years ago

Sorry about that. Those modules were supposed to be in codius_modules/bitcoinjs-lib/node_modules but on my computer node_modules are ignored by default so they weren't included in the repo. Should work now.

For this example you should pipe in a bitcoin transaction for the contract to sign

On Wed, Aug 20, 2014 at 10:51 AM, Ossip Kaehr notifications@github.com wrote:

great, now I'm making progress! thanks again :) I still needed to add these modules to the codius-manifest & codius_modules , but that worked: "bs58check", "ecurve", "crypto-js"

as I got messages like this: Error: Error loading: "./codius_modules/bitcoinjs-lib/src/index.js" Error: Error loading: "./codius_modules/bitcoinjs-lib/src/address.js" Error: Error loading: "./codius_modules/bitcoinjs-lib/src/scripts.js" Error: Error loading: "./codius_modules/bitcoinjs-lib/src/script.js" Error: Error loading: "./codius_modules/bitcoinjs-lib/src/crypto.js" Error: Module "crypto-js" not declared in manifest. All modules must be declared in manifest.

So now it starts. However I don't seem to get any data into the contract. Using echo the input.getAsync().then(function(data) has empty data .. (I'm investigating further..)

— Reply to this email directly or view it on GitHub https://github.com/codius/example-bitcoin/issues/1#issuecomment-52815126 .

Ossip commented 9 years ago

Thanks, now the modules are all there! However, the piped in tx does not get read by input.getAsync() - 'data' is still empty.

And after putting the tx string into the code for testing, I get "Error signing bitcoin transaction: Error: Digest method not supported: rmd160"

AronVanAmmers commented 9 years ago

I ran the example on Ubuntu 14.04 after the changes mentioned above. The only thing I had to change was create the codius filesystem folder (by running a contract as root and chmodding it).

My end result is the same however: "Error signing bitcoin transaction: Error: Digest method not supported: rmd160"

@emschwartz could you have a look at that?