Skip to content

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

@soulmachine

Description

@soulmachine

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;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions