adamyu1024/filecoin-tx

Filecoin transaction library in PHP

Maintainers

👁 adamyu

Package info

github.com/yuminuo/filecoin-tx

Issues

pkg:composer/adamyu1024/filecoin-tx

Statistics

Installs: 213

Dependents: 0

Suggesters: 0

Stars: 4

v1.1.1 2021-08-24 09:19 UTC

Requires

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 13c35e7bd5c15d87ac8e16478c2426e624329eb8

  • Adam Yu <adamyxt.woop@outlook.com>

This package is auto-updated.

Last update: 2026-06-13 17:57:16 UTC


README

Filecoin transaction library in PHP(Only for secp256k1).

Install

composer require adamyu1024/filecoin-tx

Usage

sign

Returns signed of transaction data.

sign(array $message, string $privateKey)

Example
  • Sign the transaction data.
use adamyu1024\FilecoinTx\Sign;

 $message = [
 'version' => 0,
 'from' => "t1hb4737umuzzbcfd3xxk3bdtwezgistj7dycypvi",
 'to' => "t1dynqskhlixt5eswpff3a72ksprqmeompv3pbesy",
 'value' => "1000000000000000000", // 此参数必须是字符串 1 FIL
 'method' => 0, // 表示send
 'nonce' => 0, // 交易序号,用接口 MpoolGetNonce 获取
 'params' => "", // base64 编码数据
 'gasLimit' => 7948138, // 可用接口估算 GasEstimateGasLimit
 'gasPremium' => "2347948138", // 此参数必须是字符串,可用接口估算 GasEstimateGasPremium
 'gasFeeCap' => "2347948138" // 此参数必须是字符串,可用接口估算 GasEstimateFeeCap
 ];
 
 $sign = new Sign();
 $signData = $sign->sign($message,"ee2868ca9485673b36c38ba4f18551be25d08dd9be9bd24c44cd626b37cadae4");
 //获取messageID
 $message['cid'] = ['/' => $sign->getMessageId()];
 //获取离线计算发送返回CID
 $sign->getCid();
 $signMessageData = [
 'message'=>$message,
 'signature'=>[
 'data'=>$signData,
 'type'=>1 //SECP256K1=1
 ]
 ];

License

MIT