kiltro
Nickel Bitcoiner
Nickel Bitcoiner
Posts: 19
Joined: Mon Nov 20, 2017 4:22 am

Why am I getting this error when trying to create SLP TokenType1?

Wed Mar 20, 2019 10:31 pm

Hello people. as I said on the subject:

Code: Select all

(node:17381) UnhandledPromiseRejectionWarning: Error: Invalid network version at Function.ECPair.fromWIF (/home/phglz/Desktop/nodejs/first-app/node_modules/bitcoincashjs-lib/src/ecpair.js:76:40) at Function.fromWIF (/home/phglz/Desktop/nodejs/first-app/node_modules/slp-sdk/node_modules/bitbox-sdk/lib/ECPair.js:42:48) at Slp.buildRawGenesisTx (/home/phglz/Desktop/nodejs/first-app/node_modules/slpjs/lib/slp.js:166:57) at BitboxNetwork.<anonymous> (/home/phglz/Desktop/nodejs/first-app/node_modules/slpjs/lib/bitboxnetwork.js:218:49) at step (/home/phglz/Desktop/nodejs/first-app/node_modules/slpjs/lib/bitboxnetwork.js:32:23) at Object.next (/home/phglz/Desktop/nodejs/first-app/node_modules/slpjs/lib/bitboxnetwork.js:13:53) at /home/phglz/Desktop/nodejs/first-app/node_modules/slpjs/lib/bitboxnetwork.js:7:71 at new Promise (<anonymous>) at __awaiter (/home/phglz/Desktop/nodejs/first-app/node_modules/slpjs/lib/bitboxnetwork.js:3:12) at BitboxNetwork.simpleTokenGenesis (/home/phglz/Desktop/nodejs/first-app/node_modules/slpjs/lib/bitboxnetwork.js:204:16) (node:17381) 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: 2) (node:17381) [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.
I can't figure it up. Thanks a lot.

By the way I am on Ubuntu 16.04, same code working fine on MacOS
Last edited by kiltro on Thu Mar 21, 2019 1:29 am, edited 1 time in total.

SpendBCH
Posts: 3
Joined: Wed Mar 20, 2019 11:31 pm

Donate BTC of your choice to 18pcV42NQ9peH1HCmuVNHuZTSbDemT48eu

Contact: Telegram

Re: Why am I getting this error when trying to create SLP TokenType1?

Wed Mar 20, 2019 11:36 pm

Is your private key (WIF) and slp-sdk configured for the same network -- mainnet or testnet?

Can you post some sample code with your private keys redacted?

kiltro
Nickel Bitcoiner
Nickel Bitcoiner
Posts: 19
Joined: Mon Nov 20, 2017 4:22 am

Re: Why am I getting this error when trying to create SLP TokenType1?

Thu Mar 21, 2019 12:03 am

How do I check for networks?
My code looks exactly like the example on https://developer.bitcoin.com/slp/docs/tokentype1:

Code: Select all

const BITBOXSDK = require('bitbox-sdk'); const BITBOX = new BITBOXSDK(); let SLPSDK = require("slp-sdk"); let SLP = new SLPSDK({ restURL: "https://trest.bitcoin.com/v2/" }); (async function() { let token = await SLP.TokenType1.create({ fundingAddress: 'bitcoincash:qpdg4wtc96zucm6qzvnwwskfu7h4l9wapgmz3jwdm7', fundingWif: 'KxW2CYJ78Tf1fJNYZcoKhGuKD4Gf5qsBEFgLpVFMtZJLSDCRkpXD', tokenReceiverAddress: '19Fk11eyDcou66eTQ1ovTXJj7BsJTgsfo1', batonReceiverAddress: 'simpleledger:qpdg4wtc96zucm6qzvnwwskfu7h4l9wapghe6fmd9q', bchChangeReceiverAddress: '19Fk11eyDcou66eTQ1ovTXJj7BsJTgsfo1', decimals: 2, name: 'Test SLP SDK Token 3', symbol: 'TEST3', documentUri: 'badger@bitcoin.com', documentHash: null, initialTokenQty: 1234, }) console.log(token) })()

SpendBCH
Posts: 3
Joined: Wed Mar 20, 2019 11:31 pm

Donate BTC of your choice to 18pcV42NQ9peH1HCmuVNHuZTSbDemT48eu

Contact: Telegram

Re: Why am I getting this error when trying to create SLP TokenType1?

Thu Mar 21, 2019 2:12 am

Each of those fields needs to be filled out with your own information.

If you only need to create one or a few tokens, it is easier to use the SLP version of Electron Cash which you can find in the Getting Started page on simpleledger dot cash

kiltro
Nickel Bitcoiner
Nickel Bitcoiner
Posts: 19
Joined: Mon Nov 20, 2017 4:22 am

Re: Why am I getting this error when trying to create SLP TokenType1?

Thu Mar 21, 2019 3:02 am

Thanks for your help but I'm trying to set services, Electron Cash (which I use and love), is not suitable for this purpose.
I'm respecting all datatypes.

SpendBCH
Posts: 3
Joined: Wed Mar 20, 2019 11:31 pm

Donate BTC of your choice to 18pcV42NQ9peH1HCmuVNHuZTSbDemT48eu

Contact: Telegram

Re: Why am I getting this error when trying to create SLP TokenType1?

Thu Mar 21, 2019 9:17 am

Ah ok. There is a more complete example at https://github dot com/Bitcoin-com/slp-sdk/blob/master/examples/create-token/create-token.js

It will read in the wallet created in examples/create-wallet and derive HD address 0/0 to fund the transaction fee for token creation.

kiltro
Nickel Bitcoiner
Nickel Bitcoiner
Posts: 19
Joined: Mon Nov 20, 2017 4:22 am

Re: Why am I getting this error when trying to create SLP TokenType1?

Fri Mar 22, 2019 2:18 am

Fixed when funding from an address generated by slp sdk which seems too be acting as a wallet.

Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 2 guests