zilliqa / kaya Goto Github PK
View Code? Open in Web Editor NEWRPC Server for Zilliqa
Home Page: https://www.zilliqa.com
License: GNU General Public License v3.0
RPC Server for Zilliqa
Home Page: https://www.zilliqa.com
License: GNU General Public License v3.0
The latest scilla binary has an additional flag --gaslimit
that is not being handled by Kaya RPC now.
Testing is done manually using my testapp
, essentially just a JS file that fires calls. I check the output manually. Automated testing needs to be done.
Follow zilliqa's implementation.
When using the zilliqa-js library, the transaction sends the amount / gasLimit / gasPrice as a BN string.
This ends up causing issues with the current Balance for an account as well as gas calculations.
currentBalance += amount; => will concatenate strings, instead of adding the values.
example:
kaya/components/wallet/wallet.js
Line 180 in 1b84208
Example call:
{ version: 0, nonce: 1, to: '22537dfddb1232be8ce10c7fc4b784f61a4375a9',
amount: <BN: 1>, gasPrice: 10, gasLimit: 10, code: null, data: null, pubKey: null }
Debug output:
[App.js] : Method specified GetBalance
[App.js] : Getting balance for 17f343a7a13bac8026d6c84e2ee2925aeba1fa61
[Wallet] : Getting balance for 17f343a7a13bac8026d6c84e2ee2925aeba1fa61
[App.js] : Sending response back to client
[App.js] : Method specified CreateTransaction
[Logic.js] : Processing transaction...
[Logic.js] : Payload well-formed? true
[Logic.js] : Sender: 17f343a7a13bac8026d6c84e2ee2925aeba1fa61
[Wallet] : Getting balance for 17f343a7a13bac8026d6c84e2ee2925aeba1fa61
[Logic.js] : User Nonce: 0
[Logic.js] : Payload Nonce: 1
[Logic.js] : p2p token tranfer
[Wallet] : Deducting 110 from 17f343a7a13bac8026d6c84e2ee2925aeba1fa61
[Wallet] : Getting balance for 17f343a7a13bac8026d6c84e2ee2925aeba1fa61
[Wallet] : Checking if 17f343a7a13bac8026d6c84e2ee2925aeba1fa61 has 110
[Wallet] : Sufficient Funds.
[Wallet] : Sender's previous Balance: 100000
[Wallet] : Deduct funds complete. Sender's new balance: 99890
[Wallet] : Increasing nonce for 17f343a7a13bac8026d6c84e2ee2925aeba1fa61
[Wallet] : New nonce for 17f343a7a13bac8026d6c84e2ee2925aeba1fa61 : 1
[Wallet] : Adding 1 to 22537dfddb1232be8ce10c7fc4b784f61a4375a9
[Wallet] : Recipient's previous Balance: 100000
[Wallet] : Adding funds complete. Recipient's new Balance: 1000001
=>> 100000 +1 != 1000001
[Logic.js] : Transaction will be logged as 766d9fb349d049d531a9b9825d1b74e37d1bdb988c75ac460c8bb6cf24a336fe
[App.js] : Sending response back to client
[App.js] : Method specified GetBalance
[App.js] : Getting balance for 17f343a7a13bac8026d6c84e2ee2925aeba1fa61
[Wallet] : Getting balance for 17f343a7a13bac8026d6c84e2ee2925aeba1fa61
[App.js] : Sending response back to client
[App.js] : Method specified CreateTransaction
[Logic.js] : Processing transaction...
[Logic.js] : Payload well-formed? true
[Logic.js] : Sender: 17f343a7a13bac8026d6c84e2ee2925aeba1fa61
[Wallet] : Getting balance for 17f343a7a13bac8026d6c84e2ee2925aeba1fa61
[Logic.js] : User Nonce: 1
[Logic.js] : Payload Nonce: 2
[Logic.js] : p2p token tranfer
[Wallet] : Deducting 110 from 17f343a7a13bac8026d6c84e2ee2925aeba1fa61
[Wallet] : Getting balance for 17f343a7a13bac8026d6c84e2ee2925aeba1fa61
[Wallet] : Checking if 17f343a7a13bac8026d6c84e2ee2925aeba1fa61 has 110
[Wallet] : Sufficient Funds.
[Wallet] : Sender's previous Balance: 99890
[Wallet] : Deduct funds complete. Sender's new balance: 99780
[Wallet] : Increasing nonce for 17f343a7a13bac8026d6c84e2ee2925aeba1fa61
[Wallet] : New nonce for 17f343a7a13bac8026d6c84e2ee2925aeba1fa61 : 2
[Wallet] : Adding 1 to 22537dfddb1232be8ce10c7fc4b784f61a4375a9
[Wallet] : Recipient's previous Balance: 1000001
[Wallet] : Adding funds complete. Recipient's new Balance: 10000011
=>> 1000001 +1 != 10000011
[Logic.js] : Transaction will be logged as 88c533a5d5d803a45a8dfb0deaee9a05919eb4d14b4df3117ec6dde68312fef2
[App.js] : Sending response back to client
Since we're using BN, the whole implementation should most likely parse the payload.amount into a BN instance and use add / sub / div methods.
Kaya current works with zilliqa-js-0.1.x
. We need to support for zilliqa-js 0.2.^ and deprecate 0.1.x.
When Kaya is running in terminal, if I use Zilliqa Javascript Library to implement createTransaction
, calling transition method in the contract ( NOT deploying new contract, code
parameter is omitted). The TX is invoked successfully however on Kaya terimal window, it says
Contract Address Deployed: 17843f270b8fc8717e684e76b1d44cfd52421b59
Should it be changed to Contract called:
with incoming message?
Hello,
I'm using Node v11.10.1 installed by nvm. I have installed kaya-cli npm install -g kaya-cli
.
When I run kaya-cli
from terminal, I got the error.
kaya-cli
internal/modules/cjs/loader.js:615
throw err;
^
Error: Cannot find module 'tslib'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:613:15)
at Function.Module._load (internal/modules/cjs/loader.js:539:25)
at Module.require (internal/modules/cjs/loader.js:667:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/Users/developers/.nvm/versions/node/v11.10.1/lib/node_modules/kaya-cli/node_modules/@zilliqa-js/util/dist/index.js:3:15)
at Module._compile (internal/modules/cjs/loader.js:738:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:749:10)
at Module.load (internal/modules/cjs/loader.js:630:32)
at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
at Function.Module._load (internal/modules/cjs/loader.js:562:3)
Can someone help me with this issue?
NOTE:
@edisonljh I think I found the issue, you need to add tslib
as dev dependency to the package.json. I tried and it works
I can start the server by kaya-cli
kaya-cli
ZILLIQA KAYA RPC SERVER (ver: 0.2.6)
Server listening on 127.0.0.1:4200
Running from local interpreter
================================================================================
Available Accounts
================================================================================
(1) f949cd77cd1ad980492ba3f7afc208c969dede62 (1000000 ZILs) (Nonce: 0)
(2) 1ab8b643ec6f62ee9dfcc8b2e222f809a5a7258a (1000000 ZILs) (Nonce: 0)
(3) d165816d56a9b6cb4552db468cb3121440967953 (1000000 ZILs) (Nonce: 0)
(4) 5aaa209d65a527170d018902d420daf13cd7ea08 (1000000 ZILs) (Nonce: 0)
(5) 7eb6c1d20542b1452f47323112fe72838d0070a9 (1000000 ZILs) (Nonce: 0)
(6) 5dd43414d6aa2d1370598a0ede5775b211fb2023 (1000000 ZILs) (Nonce: 0)
(7) 541cd8739bb6948ff9116fbbeeaf46d992121e71 (1000000 ZILs) (Nonce: 0)
(8) a78ca865d1bbaf2af472d990f004369ea150d9e9 (1000000 ZILs) (Nonce: 0)
(9) 96755f2f9fc8499319fe68a5d07eb746a70baed9 (1000000 ZILs) (Nonce: 0)
(10) 5c4068f17d0dd6304c2cf5b3d68db769021352ae (1000000 ZILs) (Nonce: 0)
Private Keys
================================================================================
(1) 7bf8089b7a524e3f4ef507249d8d0de3447920a13db96d1e55098eaef132497a
(2) d43ad75a3f9d4482a7a6c752d4f013aecead26772aac6ebe47904a9479adaf29
(3) eb63c6f310b7da3f2cfbc701da0db24d95c40b966abc84838e039af4d08cf65f
(4) 33d5b71040f2da508b74dfa43046d8a3d89d94c3186e23e7ad4aea8123e6a2ef
(5) fb2b984bef959ae7cc451a190a26c49ce7e06203faf64302d73cd931c3f434a6
(6) cc0ffb6ce56f46ccd60e5fb7630e17017bd8552886d1e3c60dff31857f931c77
(7) 28f7d7ea73c8d3d8629755ee05e2d5b17aa8b11951cc880bca3986ed53037f31
(8) ff76411c725d5f8dfe7595b9b48de039bb21bda2367b731fc87bf6dd11bdbcbb
(9) dbfbd90973003a62fde579564b81fe62f58d1a3f7b4ebde1bb3b43ed8fbc680e
(10) 05acfdc0259303d35f8f61f55b181ad4cdcd2b547a277f116ac637d8f35ad8f1
================================================================================
To support npm install -g kaya-rpc
on npm
Example: https://github.com/trufflesuite/ganache-cli#installation
To support new zilliqa-js. Breaking changes with the base units: Zilliqa/zilliqa-js#102
Conversion units reference:
Unit | To Zils |
---|---|
Zil |
10^0 |
Li |
10^-6 |
Qa |
10^-12 |
CreateTransaction: should return an error message if TX nonce is lower than account nonce
Fix: return Error Object instead of just the message.
Call
getNonce( 0x17f343a7A13BaC8026D6C84e2Ee2925aEba1FA61 ) {
balance: 88130, nonce: 17
}
{ jsonrpc: '2.0',
method: 'CreateTransaction',
params:
[ { version: 0,
nonce: 1,
to: '22537dfddb1232be8ce10c7fc4b784f61a4375a9',
amount: <BN: 1>,
pubKey: '03b51541a4e231517740ec9bc5dda5647bc5ef560f849f95a4f7d9eaa118fba131',
gasPrice: 10,
gasLimit: 10,
code: '',
data: '',
signature: '9acfcb4a0aac7911559038c576cdbc0256a8ffe355c10d9922069ca3c7513806dfa32f01e00ed12bbf0012ec26e684c1015a71fc9352d9513f4b81d4179df8d6' } ],
id: 31 }
EXPECTED:
new Error( "the tx doesn't have the correct nonce" );
Actual
{
status: 200,
statusText: 'OK',
config: {
data: '{"jsonrpc":"2.0","method":"CreateTransaction","params":[{"version":0,"nonce":1,"to":"22537dfddb1232be8ce10c7fc4b784f61a4375a9","amount":"1","pubKey":"03b51541a4e231517740ec9bc5dda5647bc5ef560f849f95a4f7d9eaa118fba131","gasPrice":10,"gasLimit":10,"code":"","data":"","signature":"9acfcb4a0aac7911559038c576cdbc0256a8ffe355c10d9922069ca3c7513806dfa32f01e00ed12bbf0012ec26e684c1015a71fc9352d9513f4b81d4179df8d6"}],"id":29}' },
=>>> data: { id: 29, jsonrpc: '2.0', result: { Error: 'Invalid Tx Json' } } }
Create a blockchain counter to mimic an actual blockchain.
Kaya RPC should check the contract before running the interpreter.
If scilla-checker
fails, the KayaRPC should through the ScillaInterpreterError
and the correct gas should be deducted from the account.
CC @neeboo
Implement the two functionalities.
GetSmartContractCode
GetSmartContractInit
To test the kaya
on a few example contracts to ensure correctness:
This issue is composed of two parts, as follows:
1. Use hex
encoding
In
Line 47 in fe84564
hex
is not passed to the update
method. This will result in the wrong hash.
2. Update user nonce after computing address
This is related to Zilliqa/Zilliqa#675. In the core protocol implementation, we now use the current nonce, not the TX nonce. So,
Line 158 in fe84564
computeContractAddr
is called.testrpc
should check the signatures of the incoming message for validity
rimraf
used in shutdown
of server.js
is not stable.fs
checks.Testrpc relies on local scilla interpreter. Developers will have to compile it themselves, and some people might run into problems. This testrpc should ideally work "out-of-the-box".
Developers should be able to choose if they want to build their own scilla-runner
from the Scilla source code, or to use the API that we already have.
As long as it is automated, its good! Help appreciated.
P.S: I already have a list of postman templates to test the APIs internally.
The -p command line option to change the port does not seem to have any effect.
E.g., starting Kaya like so: kaya-cli -p 4123
Will still result in the Kaya server using port the default port 4200.
ZILLIQA KAYA RPC SERVER (ver: 0.2.6)
Server listening on 127.0.0.1:4200
Running from local interpreter
When user sends an erroneous code to the kaya rpc server, the error is not handled properly. The server should still return a transaction hash like the actual zilliqa blockchain's response. But the error will be displayed on the console screen when run debug
is activated.
When use tab and Kaya and zilliqa-js, deploy will fail.
Interpreter says:
{ id: 1,
jsonrpc: '2.0',
result:
{ Error:
'Interpreter error: Syntax error in file tmp/967c182975d2046a7f5bcbae87b625761e7757a3_code.scilla: line 1, position 71.: Unexpected character: \\\n' } }
Content of tmp/967c182975d2046a7f5bcbae87b625761e7757a3_code.scilla
is here:
import BoolUtils library Room let zero = Uint128 0 let one_msg = \tfun ( ...
position 71 is '\t'.
I replace tab to 4 spaces.
Repeated calls might yield incorrect contract state. It's likely to be due to some logic gap and improper error checking. Have to align code with interpreter's behavior.
Developers building testapp on kaya should be aware of this issue. Will fix it soon since its urgent.
As suggested by @iantanwx, use the Wallet class in conjunction with a passphrase to generate accounts, as that makes it repeatable between runs of kaya.
// server.js
...
const cors = require('cors')
...
// cross region settings with Env
if (process.env.NODE_ENV === 'dev') {
app.use(cors())
}
Required dependencies as follows:
// package.json
"scripts": {
...
"dev": "cross-env NODE_ENV=dev node server.js"
},
"devDependencies": {
...
"cross-env": "^5.2.0",
...
},
"dependencies": {
...
"cors": "^2.8.4",
...
}
That we can use npm run dev
to start the dev mode and use CORS
More testing vectors have to be introduced.
Test coverage for the CreateTransaction
has been limited so far. Help needed to have more test cases to ensure correctness of CreateTransaction
with smart contract. Payments testing has already been done under tests/transaction.test.js
, but more vectors are welcome.
Currently only 50.87% of the lines have been covered under test case. Will be good if we can have 80% coverage since smart contract transaction is a significant portion of the code.
------------------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
------------------------|----------|----------|----------|----------|-------------------|
All files | 50.77 | 43.59 | 56 | 50.87 | |
kaya | 52.59 | 48.36 | 53.33 | 52.77 | |
app.js | 70.07 | 64.71 | 83.33 | 69.85 |... 14,215,220,221 |
config.js | 100 | 100 | 100 | 100 | |
jest.config.js | 0 | 100 | 100 | 0 | 18,38 |
logic.js | 49.76 | 44.05 | 64.71 | 50 |... 99,400,401,404 |
server.js | 0 | 0 | 0 | 0 |... 41,42,43,44,46 |
utilities.js | 5.56 | 100 | 0 | 5.56 |... 49,50,54,55,58 |
kaya/components | 83.33 | 100 | 50 | 83.33 | |
blockchain.js | 83.33 | 100 | 50 | 83.33 | 23 |
kaya/components/scilla | 15.38 | 0 | 0 | 15.38 | |
scilla.js | 15.38 | 0 | 0 | 15.38 |... 08,209,212,214 |
kaya/components/wallet | 74.49 | 60.47 | 84.62 | 74.49 | |
wallet.js | 74.49 | 60.47 | 84.62 | 74.49 |... 66,191,194,204 |
------------------------|----------|----------|----------|----------|-------------------|
Test Suites: 2 passed, 2 total
Tests: 19 passed, 19 total
Snapshots: 0 total
Time: 5.116s
Ran all test suites.
From @bobio2018
To clarify the issue isn't we want to use node
or kaya-cli
to spin up kaya in terminal, it is
whether we spin out kaya inside our node code, it feels like it is running but not printing any result compare to run kaya server.js
in terminal directly. kaya-cli
has the same issue, when I call kaya-cli server.js
inside a node app it is not printing any result.
I have setup a test app here you can download and play to replicate the issue, instruction is in readme.me ( we just use node command for simplicity, in muer project it is muer develop
)
https://github.com/bobio2018/testkayacli
Currently we have to have entire kaya inside muer folder, and reference it as library, however when we reference it, it starts straightaway.
Ideally, kaya npm package should be a library we can reference in code and set init parameters to start kaya in the current terminal window. for example we can use kaya or kaya-cli npm like this
const kaya = require('kaya-cli') ;
var DevelopMode = {
run: async function(options) {
kaya.start({fixtures:'test/account-fixtures.json',remote=false}).then(
function(data){
// this should start kaya server and output 10xaccounts on the screen
}
);
},
}
module.exports = DevelopMode
I'm attempting to use the starter provided here and I keep getting invalid tx json. The error responses have not helped me troubleshoot the error on the kaya side:
[LOGIC] : Processing transaction...
Error: Msg is not well-formed
Possible fix: Did you specify the correct chain Id and msg version?
[LOGIC] : Payload well-formed? false
Error: Msg is not well-formed
Possible fix: Did you specify the correct chain Id and msg version?
[App.js] : Sending response back to client
[App.js] : Method specified GetBalance
[App.js] : Getting balance for 7bb3b0e8a59f3f61d9bff038f4aeb42cae2ecce8
[Wallet] : Getting balance for 7bb3b0e8a59f3f61d9bff038f4aeb42cae2ecce8
[App.js] : Sending response back to client
[App.js] : Method specified GetMinimumGasPrice
[App.js] : Sending response back to client
[App.js] : Method specified GetBalance
[App.js] : Getting balance for 7bb3b0e8a59f3f61d9bff038f4aeb42cae2ecce8
[Wallet] : Getting balance for 7bb3b0e8a59f3f61d9bff038f4aeb42cae2ecce8
[App.js] : Sending response back to client
[App.js] : Method specified CreateTransaction
I'm running with fixtures, and the only change I made to QuickStart.ts from the linked repo was adding a destination address that was provided by the fixtures file (QuickStart.ts/line40):
const tx = await zilliqa.blockchain.createTransaction(
zilliqa.transactions.new({
version: VERSION,
toAddr: "381f4008505e940ad7681ec3468a719060caf796",
amount: new BN(units.toQa("888", units.Units.Zil)), // Sending an amount in Zil (888) and converting the amount to Qa
gasPrice: myGasPrice, // Minimum gasPrice veries. Check the `GetMinimumGasPrice` on the blockchain
gasLimit: Long.fromNumber(1)
})
);
➜ zilliqajs-starter git:(master) ✗ ts-node src/QuickStart.ts
Your account address is:
0x7bb3b0e8a59f3f61d9bff038f4aeb42cae2ecce8
Your account balance is:
{ balance: '1000000000000000000', nonce: 0 }
Current Minimum Gas Price: 1000000000
My Gas Price 1000000000
Sufficient Gas Price?
true
{ message: 'Invalid Tx Json' }
As a result I am not able to progress with development. Is there something I am missing? None of the examples I've seen have provided any clues. Can you confirm that this will provide a valid Kaya RPC version:
const CHAIN_ID = 2;
const MSG_VERSION = 1;
const VERSION = bytes.pack(CHAIN_ID, MSG_VERSION);
Implement the new RPC specs. Awaiting approval and confirmation.
GetContractAddressFromTransactionID
https://github.com/Zilliqa/Zilliqa/blob/master/src/libServer/Server.cpp
Known bug in the Kaya RPC. If there's insufficient gasLimit in your transaction, Kaya RPC will not run correctly.
Waiting for a more structured error message from scilla interpreter to be developed before rectifying this issue. Zilliqa/scilla#214
For now, make sure you have enough gas limit in your transactions (e.g. assign 2000 as a gas limit. The unused gas will be refunded anyway).
Useful for testing.
Installation error reported:
> [email protected] preinstall /Users/<user>/Desktop/testing_folder/kaya/node_modules/scrypt
> node node-scrypt-preinstall.js
> [email protected] install /Users/<user>/Desktop/testing_folder/kaya/node_modules/fsevents
> node install
node-pre-gyp WARN Tried to download(404): https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.2.4/fse-v1.2.4-node-v67-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: Command failed: /Users/<user>/.pyenv/shims/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "<string>", 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:188:13)
gyp ERR! stack at maybeClose (internal/child_process.js:978:16)
gyp ERR! stack at Socket.stream.socket.on (internal/child_process.js:395:11)
gyp ERR! stack at Socket.emit (events.js:188:13)
gyp ERR! stack at Pipe._handle.close (net.js:610:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/Cellar/node/11.6.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/<user>/Desktop/testing_folder/kaya/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node" "--module_name=fse" "--module_path=/Users/<user>/Desktop/testing_folder/kaya/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /Users/<user>/Desktop/testing_folder/kaya/node_modules/fsevents
gyp ERR! node -v v11.6.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/11.6.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/<user>/Desktop/testing_folder/kaya/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node --module_name=fse --module_path=/Users/<user>/Desktop/testing_folder/kaya/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/<user>/Desktop/testing_folder/kaya/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:188:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:978:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
node-pre-gyp ERR! System Darwin 18.2.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/11.6.0/bin/node" "/Users/<user>/Desktop/testing_folder/kaya/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/<user>/Desktop/testing_folder/kaya/node_modules/fsevents
node-pre-gyp ERR! node -v v11.6.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/Cellar/node/11.6.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/<user>/Desktop/testing_folder/kaya/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node --module_name=fse --module_path=/Users/<user>/Desktop/testing_folder/kaya/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)
> [email protected] install /Users/<user>/Desktop/testing_folder/kaya/node_modules/scrypt
> node-gyp rebuild
gyp ERR! configure error
gyp ERR! stack Error: Command failed: /Users/<user>/.pyenv/shims/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "<string>", 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:188:13)
gyp ERR! stack at maybeClose (internal/child_process.js:978:16)
gyp ERR! stack at Socket.stream.socket.on (internal/child_process.js:395:11)
gyp ERR! stack at Socket.emit (events.js:188:13)
gyp ERR! stack at Pipe._handle.close (net.js:610:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/Cellar/node/11.6.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/<user>/Desktop/testing_folder/kaya/node_modules/scrypt
gyp ERR! node -v v11.6.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node install`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
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 logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/<user>/.npm/_logs/2019-02-16T21_03_31_296Z-debug.log
Unable to replicate on my machine. Will appreciate if anyone can find a workaround if you face the same issue.
With the implementation of events on Scilla, Kaya RPC should support too.
Can only be completed after the JS support is done.
Dependency: Zilliqa/zilliqa-js#63
I've been having several problems with Kaya on windows so now I'm using NVM and virtualbox in an attempt to bypass the issues. However, it seems that npm install -g kaya-cli will result in some problems regarding permissions in its relative path. Full output of my error:
~ kaya-cli -f
ZILLIQA KAYA RPC SERVER (ver: 0.2.9)
Server listening on 127.0.0.1:4200
Running from remote interpreter
https://scilla-runner.zilliqa.com/contract/call
================================================================================
fs.js:114
throw err;
^
Error: EACCES: permission denied, mkdir '../data/'
at Object.mkdirSync (fs.js:757:3)
at Object.prepareDirectories (/home/cameron/.nvm/versions/node/v10.16.0/lib/node_modules/kaya-cli/src/utilities.js:177:10)
at Object. (/home/cameron/.nvm/versions/node/v10.16.0/lib/node_modules/kaya-cli/src/app.js:89:7)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (/home/cameron/.nvm/versions/node/v10.16.0/lib/node_modules/kaya-cli/src/server.js:38:13)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
There is an open issue that may fix this by removing relative paths: #78 , but it may have gone stale. If we were to move to a database, what would it be? a sqlite DB stored in $HOME/.kaya ? If I have time in a couple weeks I may attempt a fix and submit pull request.
hi i want to test kaya rpc deploy contract, im user windows, so im used remote interpreter scilla, but its always throwing an error,
this my log
[Logic.js] : Processing transaction...
[Logic.js] : Payload well-formed? true
[Logic.js] : Sender: b9998710c6c5b7ad49bda5080031412c5a3f20d3
[Wallet] : Getting balance for b9998710c6c5b7ad49bda5080031412c5a3f20d3
[Logic.js] : User Nonce: 0
[Logic.js] : Payload Nonce: 1
[Logic.js] : Task: Contract Deployment / Create Transaction
[Wallet] : Getting balance for b9998710c6c5b7ad49bda5080031412c5a3f20d3
[Wallet] : Checking if b9998710c6c5b7ad49bda5080031412c5a3f20d3 has 25002000200000000
[Wallet] : Funds sufficient true
[Logic.js] : Running scilla interpreter now
[Wallet] : Increasing nonce for b9998710c6c5b7ad49bda5080031412c5a3f20d3
[Wallet] : New nonce for b9998710c6c5b7ad49bda5080031412c5a3f20d3 : 1
[Scilla] : blockchain.json file prepared for blocknumber: 68
[Scilla] : Code Deployment
[Scilla] : Running Remote Interpreter
throwing interpreter error
can i get explained about this ?
It is randomly generated now.
When running kaya-cli, the app seems to create a new directory relative to the path the app was started: ../data
The directory is not removed after the app closes, so it should be relatively easy to confirm the issue.
The reason this is a problem is 1) it creates a directory in a place you, as a user, probably don't want a random directory to be created, and 2) depending from which directory you open kaya-cli, the app could fail to launch.
$ cd /Users/ronalddanger
$ kaya-cli
ZILLIQA KAYA RPC SERVER (ver: 0.2.6)
Server listening on 127.0.0.1:4200
Running from local interpreter
================================================================================
fs.js:119
throw err;
^
Error: EACCES: permission denied, mkdir ‘../data/‘
at Object.mkdirSync (fs.js:773:3)
at Object.prepareDirectories (/usr/local/lib/node_modules/kaya-cli/src/utilities.js:177:10)
at Object.<anonymous> (/usr/local/lib/node_modules/kaya-cli/src/app.js:90:7)
at Module._compile (internal/modules/cjs/loader.js:738:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:749:10)
at Module.load (internal/modules/cjs/loader.js:630:32)
at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
at Function.Module._load (internal/modules/cjs/loader.js:562:3)
at Module.require (internal/modules/cjs/loader.js:667:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/usr/local/lib/node_modules/kaya-cli/src/server.js:26:13)
at Module._compile (internal/modules/cjs/loader.js:738:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:749:10)
at Module.load (internal/modules/cjs/loader.js:630:32)
at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
at Function.Module._load (internal/modules/cjs/loader.js:562:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:801:12)
at internal/main/run_main_module.js:21:11
The feature to save and load persistent state is not working as expected.
We should be able to pass addresses in any uppercase / lowercase / checksummed format.
Currently it only accepts lowercase addresses.
Available Accounts
=============================
(0) 17f343a7a13bac8026d6c84e2ee2925aeba1fa61 (Amt: 100000) (Nonce: 0)
call:
{ jsonrpc: '2.0', method: 'GetBalance', params: [ '17F343A7A13BAC8026D6C84E2EE2925AEBA1FA61' ], id: 1 }
result:
{ id: 1, jsonrpc: '2.0', result: { balance: 0, nonce: 0 } }
EXPECTED result:
{ id: 1, jsonrpc: '2.0', result: { balance: 100000, nonce: 0 } }
Command line parser (Yargs) exhibits unpredictable behaviour.
E.g. sometimes --help
works, sometimes it doesn't. Same goes for -?
and --version
. But the option flags seem to work fine.
To implement the function to allow two wallets to send zils to each other.
zilliqa-js-0.1.2 has new crypto stuffs and smaller build size which has to be linked up in kaya.
Requirements:
local
and remote
modeReference:
Contracts that calls another contracts are not supported now. TestRPC
only supports returns to the sender.
To do this functionality, a revert mechanism is required to stop contracts with insufficient gas.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.