by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Ilan
    @ilanolkies

    Hi @tinyyxx ! You can instantiate the library with rsk3. You can pass the class into the RNS conteuctor

    const rsk3 = new Rsk3(/* opts */)
    const rns = new RNS(rsk3)

    Here’s how we handle it rnsdomains/rns-js#76

    tinyyxx
    @tinyyxx

    @ilanolkies Hi, here is my code according to your instruction, but it is not working.

    import RNS from '@rsksmart/rns';
    import Rsk3 from '@rsksmart/rsk3';
    const rskEndpoint = 'https://public-node.testnet.rsk.co';
    
    const rsk3 = new Rsk3(rskEndpoint, null, { privateKey: myPrivateKey});
    const rns = new RNS(rsk3);
    
    rns.subdomains.create('tinyyxx.rsk', '111111', '0x55d6abcaecf88d438aecf32e38b8ab2466fab737', '0x55d6abcaecf88d438aecf32e38b8ab2466fab737').then((receipt) => console.log(JSON.stringify(receipt)));

    The error is below, and seem to be a error of rsk3 package

    Error: Cannot find module 'scrypt-shim'
        at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
        at Function.Module._load (internal/modules/cjs/loader.js:506:25)
        at Module.require (internal/modules/cjs/loader.js:636:17)
        at require (internal/modules/cjs/helpers.js:20:18)
        at Object.<anonymous> (D:\forgeLabs\RNS\node_modules\@rsksmart\rsk3-account\dist\@rsksmart\rsk3-account.cjs.js:25:30)
        at Module._compile (internal/modules/cjs/loader.js:688:30)
        at Module._extensions..js (internal/modules/cjs/loader.js:699:10)
        at Object.require.extensions.(anonymous function) [as .js] (D:\forgeLabs\RNS\node_modules\babel-register\lib\node.js:152:7)
        at Module.load (internal/modules/cjs/loader.js:598:32)
        at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
        at Function.Module._load (internal/modules/cjs/loader.js:529:3)
        at Module.require (internal/modules/cjs/loader.js:636:17)
        at require (internal/modules/cjs/helpers.js:20:18)
        at Object.<anonymous> (D:\forgeLabs\RNS\node_modules\@rsksmart\rsk3\dist\@rsksmart\rsk3.cjs.js:15:19)
        at Module._compile (internal/modules/cjs/loader.js:688:30)
        at Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    Ilan
    @ilanolkies
    Let me send you a snippet @tinyyxx
    tinyyxx
    @tinyyxx
    OK, thx a lot
    Ilan
    @ilanolkies

    I run

    mkdir rns-rsk3
    cd rns-rsk3
    npm i @rsksmart/rsk3 @rsksmart/rns @truffle/hdwallet-provider
    touch index.js

    index.js has:

    const Provider = require('@truffle/hdwallet-provider')
    const Rsk3 = require('@rsksmart/rsk3')
    const RNS = require('@rsksmart/rns')
    
    const provider = new Provider('flush feed canal three author bullet rare very young caution skirt curve','https://public-node.testnet.rsk.co')
    const rsk3 = new Rsk3(provider)
    
    rsk3.getAccounts().then(console.log)
    
    const rns = new RNS(rsk3)
    
    rns.addr('alice.rsk').then(console.log)

    The I run it with

    node index.js

    Output:

      '0x6c561F15a432750a9468c031A7E672089c0E9f42',
      '0x384F3895c87f8b405f03E56323bcEf5A6bd5df55',
      '0x5654508EEEC52423BfF78060E76D768008fc691f',
      '0x0aDe605bbeb714C93b4F67D6D11C1069af39ed28',
      '0xE473ca9bB53c3f6Ac3bcec1501c2d155E4d62357',
      '0xb0cCAd137e5c46f77A741C34789BFd987a4C19F6',
      '0x74cdb2Cc6C55861a41679608b542fA26Bf69409f',
      '0xAe0a9fd23f5beFB3cb4c4367fbeBC3a76fB04eDe',
      '0x545a596360116c8b9b2592AF3b53e5Fe600bC7e8',
      '0x029099E797E017fD797570321049739513a19788'
    ]
    0x1bdaB807c748cC333CF01bA83a65590be537CE56
    1 reply
    you can derive RSK path with HDWallet provider. default one is eth
    i think it works both for mneomnic and private
    Ilan
    @ilanolkies

    i tried this

    const Rsk3 = require('@rsksmart/rsk3')
    const RNS = require('@rsksmart/rns')
    
    const rsk3 = new Rsk3('https://public-node.testnet.rsk.co', null, { privateKey: 'L2j44B6jFY4aPaxaNvZ1H8HHLYgnLzLQaB6FRjzabgfrr9eiirSD' })
    
    rsk3.getAccounts().then(console.log)
    
    const rns = new RNS(rsk3)
    
    rns.addr('alice.rsk').then(console.log)

    but i get a 403 Method Not Allowed from the public nodes

    2 replies
    tinyyxx
    @tinyyxx
    image.png
    my rsk3 version is latest version
    Ilan
    @ilanolkies
    Node version?
    tinyyxx
    @tinyyxx
    you mean babel-node ?
    Ilan
    @ilanolkies
    Ahh good. That’s the point i think
    Cna you share us the whole environment?
    We can test it tomorrow with the devs
    tinyyxx
    @tinyyxx
    image.png
    Ilan
    @ilanolkies
    I mean a repo or some code 😊
    Ilan
    @ilanolkies
    👌🏻 let me check it with the team tomorrow. Will ping you back
    tinyyxx
    @tinyyxx
    Ok, thanks !
    Ilan
    @ilanolkies
    Here’s the pr integrating rsk3 on the lib. Maybe we missed something rnsdomains/rns-js#76
    tinyyxx
    @tinyyxx

    i tried this

    const Rsk3 = require('@rsksmart/rsk3')
    const RNS = require('@rsksmart/rns')
    
    const rsk3 = new Rsk3('https://public-node.testnet.rsk.co', null, { privateKey: 'L2j44B6jFY4aPaxaNvZ1H8HHLYgnLzLQaB6FRjzabgfrr9eiirSD' })
    
    rsk3.getAccounts().then(console.log)
    
    const rns = new RNS(rsk3)
    
    rns.addr('alice.rsk').then(console.log)

    but i get a 403 Method Not Allowed from the public nodes

    Can you see this reply's thread, I mentioned a few question ?

    tinyyxx
    @tinyyxx
    @ilanolkies
    Ilan
    @ilanolkies
    Ah. You get 403 too?
    I thought you got Error: Cannot find module 'scrypt-shim'
    tinyyxx
    @tinyyxx
    yes ! And now I'm trying to set up a new project to run your code
    image.png
    1 reply
    This is a new enviroment, and I still get this problem :(
    Ilan
    @ilanolkies
    👌🏻
    Ilan
    @ilanolkies
    @tinyyxx Hi friend! I tested the scripts in rnsDemo repo in my PC using Node v12.16.1 and worked fine
    I didn't see any usage of @rsksmart/rsk3 anyway
    tinyyxx
    @tinyyxx
    @ilanolkies Sorry, I forget to push my code. Please checkout to branch 5/11_test_rns and run npm run resolution
    Ilan
    @ilanolkies
    @tinyyxx thanks. will check again
    tinyyxx
    @tinyyxx
    @ilanolkies Hi, is there any feedback ?
    Ilan
    @ilanolkies
    Hi friend @tinyyxx i didnt have a minute to put an eye on it yet. Will do tomorrow 💪🏽 hope we can deliver a fix asap
    tinyyxx
    @tinyyxx
    @ilanolkies OK, thanks!
    Ivan
    @ivaneidel
    Hi there! I have a question regarding subdomains. I successfully registered a few subdomains under a parent domain using NodeJS and the RNS library, if I go to https://testnet.manager.rns.rifos.org/resolve I can correctly see the associated address, however, I can not see theese subdomains inside the RNS website under the subdomains menu. Is this intended?
    PS: The subdomains' owner is the same as the domain's owner
    Ilan
    @ilanolkies
    @ivaneidel hey! you just need to input them, click create, and they will appear (the ones created with the library). This is because the manager does not know what the subdomain are until you express it. It is stored as a hash.
    Ivan
    @ivaneidel
    Oh! Okay, i'll try that.
    Thanks @ilanolkies !
    Javier Esses
    @javiesses
    Hi @tinyyxx ! I’ve just pulled your code and managed to make it work. I've made just two changes:
    1. Use @truffle/hdwallet-provider to create a provider and then use that provider to instatiante Rsk3. As Ilan mentioned in a prior thread.
    2. Updated @rsksmart/rns to the latest version (1.8.1)
    tinyyxx
    @tinyyxx
    Hi, @ivaneidel @javiesses .Thanks for your reply, but after upgrade rns version to 1.8.1 , I still encouter that Cannot find module 'scrypt-shim' problem.
    My test code has been pushed to this repo. I am using windows 10 OS and node v10.13.0.
    https://github.com/tinyyxx/rnsTest.git
    According to the error stack, I comment related code in rsk3-accout.cjs.js, this error fixed ! So this error may be caused by @rsksmart/rsk3 ?
    image.png
    image.png
    Javier Esses
    @javiesses

    Hi @tinyyxx
    Finally I could reproduce your error with the rnsTest repo.
    It seems it is an rsk3 error, you can simply check it with this examples:
    This code DOES NOT work:

    const Rsk3 = require('@rsksmart/rsk3')
    
    console.log('Hello World!')

    This code works:

    const RNS = require('@rsksmart/rns')
    
    console.log('Hello World!')

    Anyway, I managed to fix it by increasing the node version, please try to use 10.15.1 or greater. I did it and worked

    tinyyxx
    @tinyyxx
    image.png
    tinyyxx
    @tinyyxx
    @javiesses I've tried node v10.15.1 and node v12.18.1 , both not worked for me. I have deleted node_modules and run npm install every time, but still not worked...
    tinyyxx
    @tinyyxx
    @ilanolkies Can you guys help me to solve this problem please? I tried other version of @rsksmart/rsk3, and v0.3.3 has same problem
    Javier Esses
    @javiesses
    Finally, the scrypt-shim error was related to the npm version. Lower versions like v6.4.0 will not install it because it is a deprecated package. Please make sure you are using an up to date version
    tinyyxx
    @tinyyxx
    Hi, @ilanolkies . I am using "@rsksmart/rns": "^1.7.4" to register a subdomain. But recenetly after registering a subdomain, I check it with this.rns.addr('chris11x.wallet.rsk'), I got this error "No addr resolution set". I figure out that @rsksmart/rns it will help me interact with smart contract three times to actually register a subdomain, but I keep failing at second contract call now. Can you please check it out , thanks.