
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Node.js SDK for PPIO storage service.
ppio.js is the Node.js SDK for PPIO. It provides an encapsulation of JSON-RPC interface provided by the PPIO executable.
Note: developers who want to use this SDK need to have the PPIO executable.
You must have a PPIO wallet account first to play with PPIO's products and this library. There is a guide on how to generate a PPIO wallet account and get the keystore and passphrase of it.
npm install ppio
Since ppio.js does not provide the PPIO executable, you need to get it from our website or from your terminal:
poss.exe --help
curl -o poss https://resource.testnet.pp.io/poss/release/macos/latest/poss
chmod +x poss
./poss --help
curl -o poss https://resource.testnet.pp.io/poss/release/linux-amd64/latest/poss
chmod +x poss
./poss --help
You need to initialize a PPIO directroy and start the PPIO daemon service from it.
You can do these by PPIO CLI:
# import your keystore into PPIO CLI
./poss init --keystore=[the absolute path of your keystore file] --datadir='path/to/ppio-dir'
# start the PPIO service
./poss start --key-passphrase=[your passphrase] --datadir='path/to/ppio-dir'
or
# import your wallet user credentials into PPIO CLI and start the PPIO service background
./poss start --keystore=[the absolute path of your keystore file] --key-passphrase=[your passphrase] --datadir='path/to/ppio-dir'
# import your wallet user credentials into PPIO CLI
poss.exe init init --keystore=[the absolute path of your keystore file] --datadir='path/to/ppio-dir'
# start the PPIO service background
poss.exe start --key-passphrase=[your passphrase] --datadir='path/to/ppio-dir'
or
# import your wallet user credentials into PPIO CLI and start the PPIO service background
poss.exe start --keystore=[the absolute path of your keystore file] --key-passphrase=[your passphrase] --datadir='path/to/ppio-dir'
You can get
keystoreandpassphrasefrom your PPIO wallet. This is the guide Complete CLI configuration can be found in PPIO CLI documentation.
You can also do these by this SDK(only in Node.js environment):
const Ppio = require('ppio')
const ppio = new Ppio({
ppioExecutablePath: 'path/to/ppio/executable',
})
ppio.initDaemon([
datadir: 'path/to/ppio-dir'
])
ppio.startDaemon({
keystore: [your keystore file],
passphrase: [your passphrase],
datadir: 'path/to/ppio-dir'
})
Check all available Ppio constructor options in Configuration
You need to create a bucket to upload objects.
ppio.callMethod('CreateBucket', { bucket: 'test-bucket' })
ppio.callMethod('PutObject', {
bucket: 'test-bucket',
key: 'testfile.abc',
body: 'path/to/the/test/file',
chiprice: 100,
copies: 5,
expires: new Date('2020-01-01').toISOString(),
})
This will upload the file you specified in body, with 5 copies, store it until 2020-01-01, and with a key of testfile.abc.
ppio.callMethod('GetObject', {
bucket: 'test-bucket',
key: 'testfile.abc',
chiprice: 100,
outfile: 'path/to/the/destination',
})
This will download the file testfile.abc to path/to/the/destination.
ppio.callMethod('StopDaemon')
This will stop the daemon you started with startDaemon(). You can provide an rpcport to stop a specific daemon.
const Ppio = require('ppio')
const ppio = new Ppio({
ppioExecutablePath: 'path/to/ppio/executable',
rpcport: 18060,
})
| Param | Type | Description |
|---|---|---|
| [options] | object | The options of the Ppio instance |
| [options.ppioExecutablePath] (optional) | string | The path of the ppio executable. |
| [options.rpcport] (optional) | number | The RPC port of a running PPIO daemon. If you are running PPIO daemon from the terminal, use this to indicate the RPC port the daemon is listening. |
| [options.debug] (optional) | boolean | Whether to open debug mode of the SDK. Setting to true will show all logs inside the SDK and PPIO executable. |
| [options.bucket] (optional) | number | The default bucket name. Will be used on all RPC methods which need bucket parameter unless specified. |
ppio.initDaemon({
datadir: 'path/to/ppio-dir',
})
initDaemon() will create a folder(path/to/ppio-dir) in which PPIO will store user's data(keystore, logs, etc). You can check the initial configuration in poss.conf under the datadir you provided. Though optional, it is highly recommended that you specify a different datadir for every account.
Complete configuration can be found in the PPIO CLI Reference.
::: warning NOTE:
The ppioExecutablePath parameter must be provided when creating the instance.
:::
ppio.startDaemon({
'datadir': '.ppio-demo',
})
This will start a PPIO daemon. If you do not specify the RPC port or TCP/UDP port, a default port 18060 will be used.
Complete configuration can be found in PPIO CLI Reference.
::: warning NOTE:
The ppioExecutablePath parameter must be provided when creating the instance.
testnet will be set to "test" by default unless you set isMainnet to true, for we are currently running on testnet.
:::
ppio.callMethod('StopDaemon', { rpcport: 18060 })
This will stop a PPIO daemon listening the specified rpcport. If rpcport is not provided, ppio.js will use the rpcport remembered when startDaemon() was called last time.
Complete configuration can be found in PPIO JSON-RPC API Reference.
ppio.callMethod([method name], parameters)
All methods available in PPIO RPC interface can be accessed through callMethod method, and all parameters are documented in the Reference
ppio.setPpioExecutablePath('path/to/ppio')
Set the PPIO executable path. It can be accessed via ppio.ppioPath which can also be set by creating the Ppio instance with the ppioExecutablePath parameter.
ppio.setDefaultBucket('default-bucket-name')
This will save a default bucket so you do not have to specify it every time when you want to modify an object. You can use this method if you want the user to use only one bucket in your app.
ppio.setRPCPort(18060)
This will save a default RPC port number, then, unless specified, every callMethod call will use it as the default rpcport parameter. So you do not have to specify it every time. Remember to start a daemon before calling this method.
The path of the PPIO executable.
Will be set after startDaemon resolves. Or if you create a ppio instance with rpcport option, that port will be set to this property. So only create an instance with rpcport when there is a daemon running and you know the RPC port it's listening. When calling startDaemon, if ppio.runningDaemonPort is not 0, ppio daemon will not be started for there is already a daemon running. And stopping a daemon will set it to 0.
Some base parameters of ppio. May include:
callMethod method params.callMethod method params.startDaemonFAQs
The PPIO Node.js sdk
The npm package ppio receives a total of 0 weekly downloads. As such, ppio popularity was classified as not popular.
We found that ppio demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.