ckb-js / ckb-sdk-js Goto Github PK
View Code? Open in Web Editor NEWJavaScript SDK for CKB
Home Page: https://www.nervos.org
License: MIT License
JavaScript SDK for CKB
Home Page: https://www.nervos.org
License: MIT License
Searched balance
in the codebase, but got no result.
Any plan to implement sth like get_balance()
?
I am sending ckb using the sendtransaction function of ckb-sdk-js.
However, sending the same amount to the same address within a short period of time will result in a depulicate transaction error. I think that the same transaction should not be made because the previous cell was used. Is there any way to solve this?
For reference, live cells are managed through lumos/indexer.
Imagin this:
total input capacity =100 CKB
target capacity = 70 CKB
which will leave the change output cell only 30 CKB
Since the minimal cell capacity is 63 CKB, it will cause "Insufficient Cell Capacity" error.
I think the code here should be changed to:
if (inputCapacity > targetCapacity + targetFee + BigInt(63e8)) {
I have a problem when sending transaction, I followed the example of building a trading, only modified address and private key
What is the clear mistake? thanks!
Hello, I can use this transfer successfully in the test environment, but when I switch to the main network, an error will be reported. I deleted the private key and need to replace it with yours. The rawTransaction configuration address should also be replaced with your own, please help ,thanks
export const bootstrap = async () => {
const privateKey = "" // example private key
const ckb = new CKB("https://mainnet.ckb.dev") // instantiate the JS SDK with provided node url
await ckb.loadDeps() // load the dependencies of secp256k1 algorithm which is used to verify the signature in transaction's witnesses.
const publicKey = ckb.utils.privateKeyToPublicKey(privateKey)
/**
* to see the public key
*/
// console.log(`Public key: ${publicKey}`)
const publicKeyHash = `0x${ckb.utils.blake160(publicKey, 'hex')}`
/**
* to see the public key hash
*/
console.log(`Public key hash: ${publicKeyHash}`)
const addresses = {
mainnetAddress: ckb.utils.pubkeyToAddress(publicKey, {
prefix: ckb.utils.AddressPrefix.Mainnet
}),
testnetAddress: ckb.utils.pubkeyToAddress(publicKey, {
prefix: ckb.utils.AddressPrefix.Testnet
})
}
console.log(ckb.config,"ckb.config______")
/**
* to see the addresses
*/
// console.log(JSON.stringify(addresses, null, 2))
// return
if (!ckb.config.secp256k1Dep) return
const lock = {
codeHash: ckb.config.secp256k1Dep.codeHash,
hashType: ckb.config.secp256k1Dep.hashType,
args: publicKeyHash
}
// console.log(lock,"lock_____")
/**
* load cells from lumos as `examples/sendTransactionWithLumosCollector.js` shows
*/
const unspentCells = await ckb.loadCells({ indexer, CellCollector, lock })
/**
* to see the unspent cells
*/
console.log(unspentCells,"unspentCells____")
/**
* send transaction
*/
const toAddress = ckb.utils.privateKeyToAddress("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", {
prefix: ckb.utils.AddressPrefix.Testnet
})
/**
* @param fee - transaction fee, can be set in number directly, or use an reconciler to set by SDK
* say, fee: BigInt(100000) means transaction fee is 100000 shannons
* or, fee: { feeRate: '0x7d0', reconciler: ckb.utils.reconcilers.extraInputs } to set transaction fee by reconcilers.extraInputs with feeRate = 2000 shannons/Byte
*
* @external https://docs.nervos.org/docs/essays/faq#how-do-you-calculate-transaction-fee
*/
const rawTransaction = await ckb.generateRawTransaction({
fromAddress: "ckb1qyq9suqw8dlmfe9zfhpeapceypr3mmjax3mse7sf39",
toAddress:"ckb1qyqtjfdvsmlksux7zw69zk54krjt46gkf3eqr0zw7x",
capacity: BigInt(6200000000),
fee: BigInt(100000),
safeMode: true,
cells: unspentCells,
deps: ckb.config.secp256k1Dep,
})
console.log(rawTransaction,"rawTransaction____")
const signedTx = ckb.signTransaction(privateKey)(rawTransaction)
/**
* to see the signed transaction
*/
console.log(JSON.stringify(signedTx, null, 2))
const realTxHash = await ckb.rpc.sendTransaction(signedTx)
/**
* to see the real transaction hash
*/
console.log(`The real transaction hash is: ${realTxHash}`)
}
I run npx tsc
in docker (FROM node:12.12.0
) and gave the following error:
Step 9/11 : RUN npx tsc
---> Running in faa6b0c40395
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(2,23): error TS2688: Cannot find type definition file for './types/ckb_rpc'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(13,53): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(14,66): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(15,54): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(16,57): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(18,56): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(19,74): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(27,28): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(28,28): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(29,26): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(30,28): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(31,32): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(32,27): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(33,30): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(34,29): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(35,36): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(36,26): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(37,40): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(38,34): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(39,28): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(40,30): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(41,26): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(42,31): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(43,24): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(44,32): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(46,19): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(52,26): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(53,41): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(59,43): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(60,49): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(67,26): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(68,48): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(69,50): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(70,40): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(71,39): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(72,41): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(73,42): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(74,46): error TS2503: Cannot find namespace 'CKB_RPC'.
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/index.d.ts(75,52): error TS2503: Cannot find namespace 'CKB_RPC'.
The command '/bin/sh -c npx tsc' returned a non-zero code: 2
...
This problem does not appear on my Apple computer.I suspect that it is the case of the folder name in sdk, please see the figure below:
ruby sdk support block_assembler_config,run the gem is so complex。
puts wallet.block_assembler_config
[block_assembler]
code_hash = "0x9e3b3557f11b2b3532ce352bfe8017e9fd11d154c4c7f9b7aaaa1e621b539a08"
args = ["0x03ae708e284f6a53d12da45f7fe5e8c232c353c2"]
Sign message with specified prefix appended
Ref: https://github.com/nervosnetwork/neuron/blob/feat/hardware-wallet/packages/neuron-wallet/src/services/sign-message.ts#L14
mkdir peter_test&&cd peter_test
npm init
yarn add @nervosnetwork/ckb-sdk-address
const Address = require('@nervosnetwork/ckb-sdk-address')
const privateKey =
'7ee543efa447260ecda666296fa64f67c0482e6371e69b3a9cd8ae6ac7646bdf'
const address = new Address(privateKey)
console.log(address)
node index.js
to see the address in console output
➜ peter-test node index.js
/Users/peter/Desktop/nervos/ckb-mining/peter-test/index.js:6
const address = new Address(privateKey)
^
TypeError: Address is not a constructor
Implement the basic workflow of deploying an anyone-can-pay contract
In a typescript 4.0.3 project, as soon as I add @nervosnetwork/ckb-sdk-core": "^0.36.0"
to my package.json
I get when I try to compile the project:
node_modules/@nervosnetwork/ckb-sdk-core/types/global.d.ts:58:13 - error TS2430: Interface 'Output' incorrectly extends interface 'CellOutput'.
Types of property 'capacity' are incompatible.
Type 'string | bigint' is not assignable to type 'string'.
Type 'bigint' is not assignable to type 'string'.
58 interface Output extends CKBComponents.CellOutput {
~~~~~~
Any way to fix this before 0.37.0?
It's quite annoying as it forces me to turn on skipLibCheck
for the whole project.
I found similar issue #362 before, but can't get the function of "generateTransactionBuilder" anymore, I push each witness from different keys into witnesses, but got an error "InvalidScript(-31)"
the witnesses looks like this "['0x550000001000000055000000550000004100000000xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx','0x550000001000000055000000550000004100000000yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy', '0x', '0x']
When params
is an empty array, it results in an empty array payload
.
As a result, the RPC service returns an empty string ''
for the data. This leads to an error being thrown at this line: https://github.com/ckb-js/ckb-sdk-js/blob/5a462cab76e008c2d54e1c46eff02bf750ddc0c0/packages/ckb-sdk-rpc/src/index.ts#LL113C26-L113C26.
I looked at #227 and looked at ruby's getbalance source code. I found it difficult to get the balance. Is there an easier way?
I see the generateRawTransaction
function with the safeMode
parameter. This parameter controls the use of unspent, but because there is a problem that the remaining spent cannot be less than 61CKB
, the problem is that the balance is sufficient, but the transfer fails. Is the code of the link below, Can be changed to if (inputCapacity >= costCapacity + 61) {
?
I call RPC get_transaction
to get the details of 0x32a6d5be08261efc63ccaa31503fe065cc28ee21b976883f694d062570954e6f
and get the result:
{
"jsonrpc": "2.0",
"result": {
"transaction": {
"cell_deps": [
{
"dep_type": "dep_group",
"out_point": {
"index": "0x0",
"tx_hash": "0xe02c8a20a64a336cac1e477b9847888251a30a9bfe2d9050ca7ab59f507b15c7"
}
}
],
"hash": "0x32a6d5be08261efc63ccaa31503fe065cc28ee21b976883f694d062570954e6f",
"header_deps": [],
"inputs": [
{
"previous_output": {
"index": "0x0",
"tx_hash": "0x7d8bbb5638926ca86d6f318679c014d31bd3eaea474d1a264e863f1867d2cd69"
},
"since": "0x0"
}
],
"outputs": [
{
"capacity": "0x19b45a500",
"lock": {
"args": "0xa43856a2fcef41be40170cb473500cc7b30a4dbf",
"code_hash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
"hash_type": "type"
},
"type": null
}
],
"outputs_data": [
"0x"
],
"version": "0x0",
"witnesses": [
"0x901f842a476383a52e97dcf68a1f56ef9e5f9f30cd1d871b42aeccb6246a5fee22b9a466bab13c8334698288ec8edee10cfe78851cfd1ae8094794108426e33200"
]
},
"tx_status": {
"block_hash": "0x7a7f7296b6922225d4ca35798301139c227b8a8f35033367e89c251317cba91f",
"status": "committed"
}
},
"id": 1
}
How do I know the sender's address through the results?
https://docs.nervos.org/getting-started/mine
Current mining doc is for ruby, is there a way to generate block_assembler
with js-sdk?
[block_assembler]
code_hash = "0x9e3b3557f11b2b3532ce352bfe8017e9fd11d154c4c7f9b7aaaa1e621b539a08"
args = ["0x03ae708e284f6a53d12da45f7fe5e8c232c353c2"]
The call to deposit is successful, and the call to starwithdrawing is also successful, but the call to withdraw reports an error. What is the reason for the error? don't quite understand
This is my address: ckt1qyqw8c9g9vvemn4dk40zy0rwfw89z82h6fys07ens3
const depositOutPoint = {
txHash: "0x201b4e60ee79934170cadc8e296e9d685c49f2b497e964417d754b88e051e2b1",
index: "0x0"
};
const startWithDrawOutPoint = {
txHash: "0xd5271ca8302f155bdcc69e60e967aa9eb709eb8f559f46a8b79613955626bbcf",
index: "0x0"
};
const withdraw = async () => {
await ckb.loadDeps();
await loadCells();
const tx = await ckb.generateDaoWithdrawTransaction({
depositOutPoint,
withdrawOutPoint: startWithDrawOutPoint,
fee: BigInt(1000000)
});
console.log(tx, "tx_________");
const signed = ckb.signTransaction(sk)(tx);
console.log(signed, "signed______");
const txHash = await ckb.rpc.sendTransaction(signed);
console.log(txHash, "txHash______");
const outPoint = {
txHash,
index: "0x0"
};
console.log(`const withdrawOutPoint = ${JSON.stringify(outPoint, null, 2)}`);
};
I found that the implementation of nervous merkle tree is unique. I cannot find the same third-party library's JavaScript implementation. Can you provide this method in this repository?Thank you.
Generate Raw Transaction in sdk only accommodates send capacity use case. It should allow for generating different types of transactions. If we want to have a built in transfer capacity method, this method should then use the generate raw transaction.
Axios cannot handle https cases.
I already check the issue has been solved, https://github.com/ckb-js/ckb-sdk-js/issues/208
. My issue has some different. packages/ckb-sdk-core/examples/nervosDAO.js
, the file dosen't exit ../lib
and I already tried to run
$ yarn install # to install the lerna package in this project, could be skipped if the lerna has been installed globally
$ lerna bootstrap # install the depedencies and link the packages in the project
$ npm run tsc # build packages with tsc command
but got nothing, the ../lib
hasn't show, and if you use default lerna version , if will gives me The bootstrap command was removed by default in v7 and is no longer maintained
error, and I already downgraded the package to 6.6.2.
It's example with loadCells method, but with warning: "This method is only for demo, don't use it in production"
How to create and send tx in production? Or get balance for account?
I am applying blake2b algorithm in c and removing last 12 bytes. But my output in c is not matching with this.
it('blake160', () => {
const fixture = {
message: '024a501efd328e062c8675f2365970728c859c592beeefd6be8ead3d901330bc01',
digest: '36c329ed630d6ce750712a477543672adab57f4c',
}
const digest = blake160(new Uint8Array(Buffer.from(fixture.message, 'hex')), 'hex')
expect(digest).toBe(fixture.digest)
})
yarn add @nervosnetwork/ckb-sdk-core
, I can't find the folder in the local node_modules:node_modules/@nervosnetwork/ckb-sdk-core/lib/types
-> https://github.com/nervosnetwork/ckb-sdk-js/tree/develop/packages/ckb-sdk -core/types
node_modules/@nervosnetwork/ckb-sdk-rpc/lib/types/CKB_RPC
-> https://github.com/nervosnetwork/ckb-sdk-js/tree/develop/packages/ckb-sdk-rpc/types/CKB_RPC
node_modules/@nervosnetwork/ckb-sdk-utils/lib/types/blake2b-wasm
-> https://github.com/nervosnetwork/ckb-sdk-js/tree/develop/packages/ckb-sdk-utils/types/blake2b-wasm
Should be missing these folders and files when packaging.
macOS catalina
, but fails on docker node:12.12.0
.After my debug, the reason for the guess is that the problem of the folder "node_modules/@nervosnetwork/ckb-sdk-rpc/lib/types/CKB_RPC` is uppercase. After changing to lowercase, my project can be built success.
The second question is consistent with #371 .
latest version
example code
(node:24816) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'replace' of undefined
at Core.<anonymous> (/home/hunjixin/project/node_modules/@nervosnetwork/ckb-sdk-core/lib/index.js:59:54)
at Generator.next (<anonymous>)
at fulfilled (/home/hunjixin/project/node_modules/@nervosnetwork/ckb-sdk-core/lib/index.js:4:58)
at processTicksAndRejections (internal/process/task_queues.js:85:5)
The tests are not runnable, lib is not found.
https://github.com/nervosnetwork/ckb-sdk-js/blob/develop/packages/ckb-sdk-address/__tests__/ckb-sdk-address.test.js#L1
const Address = require('../lib').default
我们分别用 ckb-sdk-js ckb.signTransaction
跟 ckb studio 进行签名,witnesses数据不一样
交易结构如下:
const rawTx = {
"version": "0x0",
"cellDeps": [{
"depType": "depGroup",
"outPoint": {
"txHash": "0xace5ea83c478bb866edf122ff862085789158f5cbff155b7bb5f13058555b708",
"index": "0x0"
}
}, {
"depType": "code",
"outPoint": {
"txHash": "0x9b08d3645320e5915c8682e591f36f951dc14a733bdaa58a5e6ccefdb9c4b5b0",
"index": "0x0"
}
}],
"headerDeps": [],
"inputs": [{
"since": "0x0",
"previousOutput": {
"txHash": "0xef7e089ba381ad4eecd64565cc739278032e84baa011d8d559394e5cadd8b898",
"index": "0x1"
}
}, {
"since": "0x0",
"previousOutput": {
"txHash": "0xef7e089ba381ad4eecd64565cc739278032e84baa011d8d559394e5cadd8b898",
"index": "0x0"
}
}],
"outputs": [{
"capacity": "0xb0f387b00",
"lock": {
"hashType": "data",
"codeHash": "0x0fb343953ee78c9986b091defb6252154e0bb51044fd2879fde5b27314506111",
"args": "0xcf0c34ac8af4a2c7861b33640ecc9af4e8d338f1"
},
"type": null
}, {
"capacity": "0x22ecb25c00",
"lock": {
"hashType": "type",
"codeHash": "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8",
"args": "0xbc76e06a53193d3cb2fd0eb331237cb021fe39ea"
},
"type": null
}],
"outputsData": ["0x", "0x"],
"witnesses": [{
"lock": "",
"inputType": "",
"outputType": ""
}, "0x"]
};
sdk签名数据:
"witnesses":["0x5500000010000000550000005500000041000000e2c1d469d5f0c8011c064a9041dd0d556fdb7d95c5a37e0b2778a6e1b115341b17fa8868c2b4ff0cfee9b4196a23cfee72ac240dbe041740dcf15767e334de4901","0x"]}
通过studio签名数据:
"witnesses": ["0x55000000100000005500000055000000410000004c18a8bc16a6403a5e600e9e23c106382f5cdfe8110733dccb7138979cda7dbc14e7fd2350cfa9f7414eb548094fa62bd5de344fd180bae57aeadfcc145eaf4300", "0x"]
共同使用 ckb.rpc.sendTransaction
发送交易,使用sdk签名的数据提示错误 {"code":-3,"message":"Script: ValidationFailure(-31)"}
,而studio签名数据能发送成功。
Has this repository been upgraded to CKB2021 upgrade?
I'm specifically asking if it supports:
nervosnetwork/rfcs#239
Already. I see there was a PR 3 months ago that added some compatibility with CKB2021, but nervosnetwork/rfcs#239 was updated 23 days ago.
cc @Keith-CY
I could not find the related api to interact with address and wallet, could anyone help me? thanks.
JSC 的相关 bug:
iOS 11.2.2 and 11.2.5b6 WebAssembly regression
Values other than valid enums should be rejected.
Replace the travis with github actions
Error: '0x00' is not a valid code hash
at toAddressPayload (/home/username/testing/node_modules/@nervosnetwork/ckb-sdk-utils/lib/address/index.js:57:15)
at bech32Address (/home/username/testing/node_modules/@nervosnetwork/ckb-sdk-utils/lib/address/index.js:69:210)
at pubkeyToAddress (/home/username/testing/node_modules/@nervosnetwork/ckb-sdk-utils/lib/address/index.js:75:38)
at privateKeyToAddress (/home/username/testing/node_modules/@nervosnetwork/ckb-sdk-utils/lib/index.js:55:84)
at Object.<anonymous> (/home/username/testing/index.js:5:57)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789: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)
index.ts:
import {AddressPrefix, AddressType, privateKeyToAddress} from '@nervosnetwork/ckb-sdk-utils';
const PRIVATE_KEY = '0xcd708059624d8301382972808b3e504b5ea3d94e210edf229f48cadcb8fe0989';
const address = privateKeyToAddress(PRIVATE_KEY, {prefix: AddressPrefix.Testnet, type: AddressType.FullVersion});
console.log(address);
How to run contents of test.zip:
npm i
npx tsc
nodejs index.js
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.