Decentralized IPFS remote pinning service with Crust Network.
The IPFS W3Auth Pinning Service(aka. W3Auth PS) is compatible with standard IPFS remote pinning service. You can refer IPFS Docs to learn how to use remote pin.
As for the Access Token of W3Auth PS, you can easily get it with several web3 ways.
Authorization: Bear <base64(ChainType-PubKey:SignedMsg)>
Let's take ipfs cli
as an example
ipfs pin remote service add crustpinner http://localhost:3000/psa base64(ChainType-PubKey:SignedMsg)
ChainType
now can be:
sub
(or substrate
)eth
(or ethereum
)sol
(or solana
)pol
(or polygon
)nea
(or near
)ava
(or avalanche
)And you can get PubKey
and SignedMsg
by using the following web3-ways:
PubKey
PubKey
is just the substrate address, like 5Chu5r5GA41xFgMXLQd6CDjz1ABGEGVGS276xjv93ApY6vD7
All substrate-based chains are adapted:
SignedMsg
Just sign the PubKey
with your private key to get the SignedMsg
PubKey
PubKey
is just the ethereum address(42-characters) start with 0x
SignedMsg
Just sign the PubKey
with your eth private key to get the SignedMsg
Moonriver is fully compatiable with the Ethereum, you can just follow the same steps with the Ethereum.
PubKey
PubKey
is just the moonriver(ethereum) address(42-characters) start with 0x
SignedMsg
Just sign the PubKey
with your moonriver private key to get the SignedMsg
PubKey
PubKey
is just the solana address
SignedMsg
You can sign the PubKey
with your solana private key to get the SignedMsg
QmYXnTQwKkup7yNLXZz2VyBvBj9eJB1knG8V8dnmjNuNnu
), source code is here, you can deploy yourself)PubKey
is just the polygon address(42-characters) start with 0x
. It's compatiable with the ethereum.
Just sign the PubKey
with your polygon private key to get the SignedMsg
You can sign the PubKey
with one of your near private key associated with your account to get the SignedMsg
QmZupCTkUs6fDCAjYPfDqDtx85GekztfDa9u6Y8dsWhsvA
), source code is here, you can deploy yourself)You can sign the Address
without chainID prefix, such as avax1se4e9lvhlfwhcqnzjr0vpswqcnhsy5atn5r0l3
, with your X- or P- chain private key associated with your account to get the SignedMsg
.
PubKey
PubKey
is the aptos's account pubkey, such as 0xaa79510150c3a6753f224ef47a315ea6ae9acd23f4506a866feb25f8995c60c
. Please pay attention that it's not the same as the address.
SignedMsg
You can sign the PubKey
with your aptos private key to get the SignedMsg
W3Auth PS uses MySQL as its state database, you can just use docker to start and config the db service.
Please execute the sql script
under ./sql
folder to create database and state tables.
Please create an .env
file baseon .env-example
, each config item means:
NODE_ENV // `production` or `dev`
MYSQL_HOST // optional, default is `localhost`
MYSQL_PORT // optional, default is `3306`
MYSQL_DB // optional, default is `pinning_service` created by ./sql/V1_CREATE_DATABASE.sql
MYSQL_USER // optional, default is `root`
MYSQL_PASSWORD // optional, default is `root`
MYSQL_POOL_MAX // optional, default is `10`
MYSQL_POOL_MIN // optional, default is `0`
MYSQL_POOL_IDLE // optional, default is `30,000`
MYSQL_POOL_ACQUIRE // optional, default is `30,000`
CRUST_SEED // required, the pinning pool private seeds
WS_ENDPOINT // optional, crust chain websocket address, default is `wss://rpc-crust-mainnet.decoo.io`
DEFAULT_FILE_SIZE // optional, ordering file size, default is 2GB
CRUST_TIPS // optional, ordering tips, default is 0.00005 CRUs
VALID_FILE_REPLICAS // optional, the successfully pinning replica count, default is 3
W3Auth PS allows nodes config supported chains with sql script, default supported chain is substrate
, you can config different chain_name
with corresponding chain_type
(auth way):
chain_type
0
: Support all substrate-based chains authentication1
: Support all eth-compatible chains authentication, like ethereum
/polygon
/bsc
/...2
: Support solana authenticationAnd you can run the following sql to add/delete supported chains:
INSERT INTO `pinning_service`.`chain` (`chain_name`, `chain_type`) VALUES ('eth', 1);
DELETE FROM `pinning_service`.`chain` WHERE `chain_name`='eth';
Run with docker
Just run with the compose file in this repo
docker-compose up -d order-service
Run with node native
# 1. Clone repo
git clone https://github.com/crustio/ipfs-w3auth-pinning-service.git
# 2. Install and build
yarn && yarn build
# 3. Run
yarn start
Then, you can just config the standard IPFS remote pinning service with http://localhost:3000/psa
!
Please feel free to send a PR.