Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have to run Spring Boot RESTful server on the same machine with full node? #3

Open
soulmachine opened this issue Mar 28, 2018 · 1 comment

Comments

@soulmachine
Copy link

If I add a new api /newAddress to the Controller.java, and this API makes use of WalletUtils.generateFullNewWalletFile(), then I realize that my RESTful server have to access the keystore directory, which means my RESTful server has to run on the full node, am I correct?

    @RequestMapping(value = "/newAddress")
    String newAccount() throws Exception {
        // wallet file is named like `UTC--2018-03-16T05-09-05.79000000Z--3ae52004fd3e16c3b70b92ca0a9b382c786bf27e.json`
        String walletFileName = WalletUtils.generateFullNewWalletFile(getEncryptPassphrase(),
                new File(getKeystoreDir()));
        // in which `3ae52004fd3e16c3b70b92ca0a9b382c786bf27e` is address
        String[] fetchAddress = walletFileName.split("--");
        String address = "0x" + fetchAddress[fetchAddress.length-1].split("\\.")[0];
        return address;
    }
@macrotea
Copy link

why not read the file to parse json and get the address?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants