Manipulates the bootstrap list, which contains the addresses of the bootstrap nodes. These are the trusted peers from which to learn about other peers in the network.
Warning: your node requires bootstrappers to join the network and find other peers.
If you edit this list, you may find you have reduced or no connectivity. If this is the case, please reset your node's bootstrapper list with ipfs.bootstrap.reset()
.
ipfs.bootstrap.add(addr, [options])
ipfs.bootstrap.reset([options])
ipfs.bootstrap.list([options])
ipfs.bootstrap.rm(addr, [options])
ipfs.bootstrap.clear([options])
Add a peer address to the bootstrap list
Name | Type | Description |
---|---|---|
addr | MultiAddr | The address of a network peer |
An optional object which may have the following keys:
Name | Type | Default | Description |
---|---|---|---|
timeout | Number |
undefined |
A timeout in ms |
signal | AbortSignal | undefined |
Can be used to cancel any long running requests started as a result of this call |
Type | Description |
---|---|
Promise<Object> |
An object that contains an array with all the added addresses |
example of the returned object:
{
Peers: [address1, address2, ...]
}
const validIp4 = '/ip4/104....9z'
const res = await ipfs.bootstrap.add(validIp4)
console.log(res.Peers)
// Logs:
// ['/ip4/104....9z']
A great source of examples can be found in the tests for this API.
Reset the bootstrap list to contain only the default bootstrap nodes
None.
An optional object which may have the following keys:
Name | Type | Default | Description |
---|---|---|---|
timeout | Number |
undefined |
A timeout in ms |
signal | AbortSignal | undefined |
Can be used to cancel any long running requests started as a result of this call |
Type | Description |
---|---|
Promise<{ Peers: Array<MultiAddr> }> |
An object that contains an array with all the added addresses |
example of the returned object:
{
Peers: [address1, address2, ...]
}
const res = await ipfs.bootstrap.reset()
console.log(res.Peers)
// Logs:
// ['/ip4/104....9z']
A great source of examples can be found in the tests for this API.
List all peer addresses in the bootstrap list
None
An optional object which may have the following keys:
Name | Type | Default | Description |
---|---|---|---|
timeout | Number |
undefined |
A timeout in ms |
signal | AbortSignal | undefined |
Can be used to cancel any long running requests started as a result of this call |
Type | Description |
---|---|
Promise<Object> |
An object that contains an array with all the bootstrap addresses |
example of the returned object:
{
Peers: [address1, address2, ...]
}
const res = await ipfs.bootstrap.list()
console.log(res.Peers)
// Logs:
// [address1, address2, ...]
A great source of examples can be found in the tests for this API.
Remove a peer address from the bootstrap list
Name | Type | Description |
---|---|---|
addr | MultiAddr | The address of a network peer |
An optional object which may have the following keys:
Name | Type | Default | Description |
---|---|---|---|
timeout | Number |
undefined |
A timeout in ms |
signal | AbortSignal | undefined |
Can be used to cancel any long running requests started as a result of this call |
Type | Description |
---|---|
Promise<{ Peers: Array<MultiAddr> }> |
An object that contains an array with all the removed addresses |
{
Peers: [address1, address2, ...]
}
const res = await ipfs.bootstrap.rm('address1')
console.log(res.Peers)
// Logs:
// [address1, ...]
A great source of examples can be found in the tests for this API.
Remove all peer addresses from the bootstrap list
None.
An optional object which may have the following keys:
Name | Type | Default | Description |
---|---|---|---|
timeout | Number |
undefined |
A timeout in ms |
signal | AbortSignal | undefined |
Can be used to cancel any long running requests started as a result of this call |
Type | Description |
---|---|
Promise<Object> |
An object that contains an array with all the removed addresses |
{
Peers: [address1, address2, ...]
}
const res = await ipfs.bootstrap.clear()
console.log(res.Peers)
// Logs:
// [address1, address2, ...]
A great source of examples can be found in the tests for this API.