Filecoin JSON-RPC API
Web3Signer has deprecated Filecoin and will remove it in a future release. If you still require this feature, we encourage community members to maintain the code by creating a fork and submitting pull requests. Alternatively, you can continue using an older version of Web3Signer that still supports Filecoin.
Access Filecoin JSON-RPC API methods at http://<HOST>:<PORT>/rpc/v1/filecoin
, where:
<HOST>
is specified using--http-listen-host
.<PORT>
is specified using--http-listen-port
.
The default location is http://127.0.0.1:9000/rpc/v1/filecoin
.
Filecoin.WalletHas
Indicates whether an address exists in the wallet.
Parameters
String
: Filecoin address
Returns
result
: Boolean - true
if the address exists in the wallet; otherwise false
.
- curl HTTP request
- JSON result
curl -X POST --data '{"jsonrpc": "2.0", "method": "Filecoin.WalletHas", "params": ["t1m...fvy"], "id": 1}' http://127.0.0.1:9000/rpc/v1/filecoin
{
"id": 1,
"result": true,
"jsonrpc": "2.0"
}
Filecoin.WalletList
Lists all the addresses in the wallet.
Addresses can be based on secp256k1 or BLS12-381 signing keys.
Parameters
None
Returns
result
: Array of Filecoin addresses.
- curl HTTP request
- JSON result
curl -X POST --data '{"jsonrpc":"2.0","method":"Filecoin.WalletList","params":[],"id":1}' http://127.0.0.1:9000/rpc/v1/filecoin
{
"id": 1,
"result": ["t1m...fvy", "t3u...aja"],
"jsonrpc": "2.0"
}
Filecoin.WalletSign
Signs the provided data using the private key belonging to the supplied Filecoin address.
Parameters
String
: Filecoin address
String
: Data to sign
Returns
result
: Object containing:
Type
: Integer identifying the type of key used to sign the data;1
is secp256k1 and2
is BLS12-381.Data
: Signature.
- curl HTTP request
- JSON result
curl -X POST --data '{"jsonrpc": "2.0", "method": "Filecoin.WalletSign", "params": ["t1m...fvy", "NDI="], "id": 1}' http://127.0.0.1:9000/rpc/v1/filecoin
{
"id": 1,
"result": {
"Type": 1,
"Data": "5vEDqBPUTQA44p51Qaclwih+b2WVND7gp12yNXFBrtwsZFuwqQYc7A8CZjocrn6NVPjMLpqvJjGxWY2lXb6a3wE="
},
"jsonrpc": "2.0"
}
Filecoin.WalletSignMessage
Signs a message using the private key belonging to the supplied Filecoin address.
Parameters
String
: Filecoin address
Object: Unsigned message object
Returns
result
: Object containing the sent unsigned Message
object, and the Signature
object.
- curl HTTP Request
- JSON result
curl -X POST --data '{"jsonrpc": "2.0", "method": "Filecoin.WalletSignMessage", "params": ["t1m...fvy", {"Version": 9, "To": "t01234", "From": "t01234", "Nonce": 42, "Value": "0", "GasLimit": 9, "GasFeeCap": "0", "GasPremium": "0", "Method": 1, "Params": "Ynl0ZSBhcnJheQ=="}], "id": 1}' http://127.0.0.1:9000/rpc/v1/filecoin
{
"id": 1,
"result": {
"Message": {
"Version": 9,
"To": "t01234",
"From": "t01234",
"Nonce": 42,
"Value": "0",
"GasLimit": 9,
"GasFeeCap": "0",
"GasPremium": "0",
"Method": 1,
"Params": "Ynl0ZSBhcnJheQ=="
},
"Signature": {
"Type": 1,
"Data": "iuG3q2djl4cRYKXBIvjf5bMgVIyOmgsNZQUDJLJH8aV5aAHmtACKILADp8lNvHK8Tg8bYCi8mNFYAI4/cABOJQA="
}
},
"jsonrpc": "2.0"
}
Filecoin.WalletVerify
Indicates whether a signature is valid.
The supplied address does not need to exist in the wallet.
Parameters
String
: Filecoin address
String
: Unsigned data
Object : Signature object containing:
Type
: Integer identifying the type of key used to sign the data;1
is secp256k1 and2
is BLS12-381.Data
: Signature.
Returns
- curl HTTP Request
- JSON result
curl -X POST --data '{"jsonrpc": "2.0", "method": "Filecoin.WalletVerify", "params": ["t1m...fvy", "NDI=", {"Type":1,"Data":"5vEDqBPUTQA44p51Qaclwih+b2WVND7gp12yNXFBrtwsZFuwqQYc7A8CZjocrn6NVPjMLpqvJjGxWY2lXb6a3wE="}], "id": 1}' http://127.0.0.1:9000/rpc/v1/filecoin
{
"id": 1,
"result": true,
"jsonrpc": "2.0"
}