Open kozayupapa opened 1 year ago
test with my local filecoin
(base) go-generate-car % ./generate-car --single -i ./tmp/hellodao.txt -o tmp -p ./tmp/
{"Ipld":{"Name":"","Hash":"bafybeia3dzqclgnjxstztyy26js5qrno7erfptwkthtetxhzv3btzsc424","Size":0,"Link":[{"Name":"hellodao.txt","Hash":"bafkreigtr2tk3dvbyjmfup5hdmklj6gsdwa3fkgqkk6b3n73hllvquvyqa","Size":33,"Link":null}]},"DataCid":"bafybeia3dzqclgnjxstztyy26js5qrno7erfptwkthtetxhzv3btzsc424","PieceCid":"baga6ea4seaqer23asz6azhqynffuzb5aoaaxglf7sexu6un533sylqriqtv2yda","PieceSize":256,"CidMap":{"":{"IsDir":true,"Cid":"bafybeia3dzqclgnjxstztyy26js5qrno7erfptwkthtetxhzv3btzsc424"},"hellodao.txt":{"IsDir":false,"Cid":"bafkreigtr2tk3dvbyjmfup5hdmklj6gsdwa3fkgqkk6b3n73hllvquvyqa"}}}
{"piece_CID":"baga6ea4seaqer23asz6azhqynffuzb5aoaaxglf7sexu6un533sylqriqtv2yda","piece_Size":256,"car_Link":"https://data-depot.lighthouse.storage/api/download/download_car?fileId=11ba5088-c8a7-4f1b-8960-c0415985455c.car","car_Size":226}
we need to fund clinet I modified task script
task(
"deal-fund",
"Gets a deal's status from the piece cid"
)
.addParam("contract", "The address of the deal client solidity")
.addParam("value", "fund tFL")
.setAction(async (taskArgs) => {
const contractAddr = taskArgs.contract
const value = taskArgs.value
const networkId = network.name
console.log("Getting deal status on network", networkId)
//create a new wallet instance
const wallet = new ethers.Wallet(network.config.accounts[0], ethers.provider)
//create a DealClient contract factory
const DealClient = await ethers.getContractFactory("DealClient", wallet)
//create a DealClient contract instance
//this is what you will call to interact with the deployed contract
const dealClient = await DealClient.attach(contractAddr)
//send a transaction to call makeDealProposal() method
//transaction = await dealClient.getDealProposal(proposalID)
let result = await dealClient.addBalance(value)
console.log("The deal status is:", result)
})
(base) fevm-hardhat-kit % yarn hardhat deal-fund --contract $DCLIENT --value 2910400000
result
success case
boost | 2023-06-09T03:10:34.691Z INFO boost-provider storagemarket/contract_deal_monitor.go:189 contract deal proposal accepted {"id": "0x7660de8b0b133d0328050090e559855bf2dc54f6ecea38608e0dde3c49c9e126", "uuid": "cb54bb0e-0c70-4f98-91a4-c4a61f710ee8"}
error1: proposal value less
boost | 2023-06-09T01:39:30.207Z WARN boost-provider storagemarket/contract_deal_monitor.go:191 contract deal proposal rejected {"id": "0xa0bd453715d6630f308c3f1ae8b50e740a56b43ccbb2819e6bc11182da72f708", "uuid": "52a89af9-059a-4d4b-a57e-8b9e7221c396", "err": null, "reason": "failed validation: storage price per epoch less than asking price: 0 < 119"}
error 2: client contract fund less
boost | 2023-06-09T01:40:52.819Z WARN boost-provider storagemarket/contract_deal_monitor.go:191 contract deal proposal rejected {"id": "0xf3370d9ebe3fcca05efcb75fab93b1574b660e3d7a1ba2268632d51a46e4e06c", "uuid": "df231e83-98f4-437b-9c8b-ec715e2f45f9", "err": null, "reason": "failed validation: client available funds in escrow 0 not enough to meet storage cost for deal 291040000"}
check locl lotus listen port p2p
(base) filecoin-fvm-localnet % docker compose exec lotus lotus net listen
/ip4/172.18.0.4/tcp/9090/p2p/12D3KooWRYivrM1DAbk38JfHyUt21YVSEJhBMjVeX3oLAj7adQcB
/ip4/127.0.0.1/tcp/9090/p2p/12D3KooWRYivrM1DAbk38JfHyUt21YVSEJhBMjVeX3oLAj7adQcB
https://github.com/filecoin-project/lassie
clone and run go build ./cmd/lassie
(base) lassie % ./lassie fetch --providers /ip4/127.0.0.1/tcp/9090/p2p/12D3KooWRYivrM1DAbk38JfHyUt21YVSEJhBMjVeX3oLAj7adQcB baga6ea4seaqer23asz6azhqynffuzb5aoaaxglf7sexu6un533sylqriqtv2yda
Fetching baga6ea4seaqer23asz6azhqynffuzb5aoaaxglf7sexu6un533sylqriqtv2yda from [{12D3KooWRYivrM1DAbk38JfHyUt21YVSEJhBMjVeX3oLAj7adQcB: [/ip4/127.0.0.1/tcp/9090]}]
all retrievals failed
retrieval failed: data transfer failed: datatransfer error: data transfer channel 12D3KooWL81kMjvEoAiHTtvapmZr3PEdWaarpZqiPGxJrEmrrQyU-12D3KooWRYivrM1DAbk38JfHyUt21YVSEJhBMjVeX3oLAj7adQcB-1686282029752688001 failed to transfer data: channel 12D3KooWL81kMjvEoAiHTtvapmZr3PEdWaarpZqiPGxJrEmrrQyU-12D3KooWRYivrM1DAbk38JfHyUt21YVSEJhBMjVeX3oLAj7adQcB-1686282029752688001: graphsync request failed to complete: could not choose a decoder: no decoder registered for multicodec code 61697 (0xf101)
all retrievals failed
Status Sealer: ProvingThe deal can be in one of the following states:
Transfer Queued
The storage deal proposal has been accepted, and Boost is about to start the data transfer.
Awaiting Offline Data Import
The client has made an offline deal proposal, and Boost is waiting for the Storage Provider operator to import the deal data.
Transferring
The data for the deal is transferring.
Transfer Complete
The data transfer is complete and Boost is verifying the data matches commp.
Ready to Publish
The deal is in the batch publish queue, ready to be published.
Awaiting Publish Confirmation
Boost sent a publish deal message for the deal and is waiting for on-chain confirmation.
Adding to Sector
Boost is handing the deal off to the lotus-miner sealing subsystem to be added to a sector.
Announcing
Boost is announcing the deal to the network so that clients know where to retrieve it.
Sealing
The deal has been added to a sector and is now sealing.
Complete
The deal has reached its duration and expired.
Cancelled
The deal was cancelled.
git clone git@github.com:web3-storage/ipfs-car.git
https://docs.filecoindata.tools/about/delta-tech-stack/delta-user-guides/getting-api-token-key
curl --location --request GET 'https://auth.estuary.tech/register-new-token'
https://github.com/hammertoe/fdt-deal-monitor
git clone git@github.com:hammertoe/fdt-deal-monitor.git
cd fdt-deal-monitor
yarn
yarn hardhat deploy
modify contractAddress to actual deployed one.
create db dire mkdir db
to store data localy
run fdt-monitor
(base) fdt-deal-monitor % node fdt-deal-monitor-ethers.js
Successfully connected to : db
Listening for events on contract at address: 0x144a27553991F2e5964B903665b2003254edaf80 at RPC endpoint: http://127.0.0.1:1234/rpc/v1
call sample smart contract with lighthouse uploaded file url
(base) fdt-deal-monitor % yarn hardhat store-data --contract $SCLIENT --uri "https://data-depot.lighthouse.storage/api/download/download_car?fileId=11ba5088-c8a7-4f1b-8960-c0415985455c.car"
then monitor got event from sample smart contract and ask edge to store, and show the response which include stored url, and jobid.
[
'https://data-depot.lighthouse.storage/api/download/download_car?fileId=11ba5088-c8a7-4f1b-8960-c0415985455c.car'
]
Sending payload to: https://hackfs-coeus.estuary.tech/edge/api/v1/content/fetch-url
API response: {
status: 'success',
message: 'File uploaded and pinned successfully. Please take note of the ids.',
contents: [
{
ID: 17907,
name: 'bafybeid6dici3ld6bhrw5abw6iely4afwxasmqw5xsynprcxakp5twfdoi',
size: 226,
cid: 'bafybeid6dici3ld6bhrw5abw6iely4afwxasmqw5xsynprcxakp5twfdoi',
selective_car_cid: '',
delta_content_id: 0,
delta_node_url: 'http://localhost:1414',
bucket_uuid: '77a69e06-06a8-11ee-824a-40a6b7203650',
status: 'pinned',
piece_cid: '',
piece_size: 0,
inclusion_proof: null,
verifier_data: null,
deal_id: 0,
deal_uuid: '',
last_message: '',
miner: '',
make_deal: true,
created_at: '2023-06-09T09:49:09.550372125Z',
updated_at: '2023-06-09T09:49:09.550372185Z'
}
]
}
Storing data locally
Success stored id 17907
Download: https://hackfs-coeus.estuary.tech/edge/gw/bafybeid6dici3ld6bhrw5abw6iely4afwxasmqw5xsynprcxakp5twfdoi
Status: https://hackfs-coeus.estuary.tech/edge/open/status/content/17907
Updating smart contract
Complete! {
to: '0x144a27553991F2e5964B903665b2003254edaf80',
from: '0x3e7311e0Fc89fA633433076be268ae007A1b827a',
contractAddress: null,
transactionIndex: 0,
root: '0x0000000000000000000000000000000000000000000000000000000000000000',
gasUsed: BigNumber { _hex: '0x75f9d0', _isBigNumber: true },
logsBloom: '0x00000000000000000000000000000000000010000000000040000000400000000000000000000005000420008000000000004200000000004000000000000000000000000080400000000000040000018000000000000000000000000000000400000000120000000008000020000808000000100000000000000000000000002000000080000002000000010000000000000000020001000000001000000000000010000000000000000000000000000000048001048000000000000000000000400001000000000000004004080000000000000000020000000200000020000040004000000000081000000000000000000400000000000004000000000000',
blockHash: '0x353b32aec5157ad75fabb18823f0fe8d344d44cef61570f17ce7cd3aed78eedc',
transactionHash: '0x14f610754c52ff3a1591cbf3118cf8632e902a0f41220565ca8cb4dcb3523cf0',
logs: [],
blockNumber: 16644,
confirmations: 2,
cumulativeGasUsed: BigNumber { _hex: '0x00', _isBigNumber: true },
effectiveGasPrice: BigNumber { _hex: '0x6fa55e33', _isBigNumber: true },
status: 1,
type: 2,
byzantium: true,
events: []
}
get car file from estuary delta
curl https://hackfs-coeus.estuary.tech/edge/gw/bafybeid6dici3ld6bhrw5abw6iely4afwxasmqw5xsynprcxakp5twfdoi > out.car
extract car file
(base) fdt-deal-monitor % npx ipfs-car unpack out.car --output tmp
https://www.youtube.com/watch?v=BecGGm-YnPc
HugeData : DirectDeal
https://github.com/filecoin-project/filecoin-fvm-localnet https://github.com/filecoin-project/fevm-hardhat-kit
small Data. aggregator
Javascript which monitor event and call Edge.
node fdt-deal-monitor-ethers.js
yarn hardhat store-data --contract {$LOCAL_CONTRACT_ADR} --url {LIGHTOUHSE_CAR_URL}
--network localnetcurl {$DOWNLOAD_URL} > out.car
ipfs-car --unpack out.car