@@ -162,7 +162,9 @@ Package for Arweave develop toolkit.
162
162
- [x] GetSignatureData
163
163
- [x] VerifyTransaction
164
164
- [x] NewBundle
165
- - [x] GenerateIndepHash
165
+ - [x] NewBundleItem
166
+ - [x] SubmitItemToBundlr
167
+ - [x] SubmitItemToArSeed
166
168
167
169
#### RSA Threshold Cryptography
168
170
@@ -309,58 +311,84 @@ assert.NoError(t, uploader.Once())
309
311
### About Arweave Bundles
310
312
1 . ` goar ` implemented creating,editing,reading and verifying bundles tx
311
313
2 . This is the [ ANS-104] ( https://github.com/joshbenaron/arweave-standards/blob/ans104/ans/ANS-104.md ) standard protocol and refers to the [ arbundles] ( https://github.com/Bundler-Network/arbundles ) js-lib implement
312
- 3 . more example can be viewed in path ` ./example/bundle_test.go `
313
314
314
- #### CreateBundle
315
+ #### Create Bundle Item
315
316
``` go
316
- w , err := goar.NewWalletFromPath (privateKey, arNode)
317
- if err != nil {
318
- panic (err)
319
- }
317
+ signer , err := goar.NewSignerFromPath (" ./testKey.json" ) // rsa signer
318
+ // or
319
+ signer , err := goether.NewSigner (" 0x....." ) // ecdsa signer
320
320
321
321
// Create Item
322
- data := []byte (" upload update..." )
323
- signatureType := 1 // currently only supply type 1
322
+ data := []byte (" aa bb cc dd" )
324
323
target := " " // option
325
324
anchor := " " // option
326
- tags := []types.Tags {}{} // bundle item tags
327
- item01 , err := w. CreateAndSignBundleItem (data, 1 , target, anchor, tags)
325
+ tags := []types.Tags {}{} // option bundle item tags
326
+ item01 , err := itemSigner. CreateAndSignItem (data, target, anchor, tags)
328
327
// Same as create item
329
328
item02
330
329
item03
331
330
....
332
331
333
- items := []types.BundleItem {item01, item02, item03 ...}
332
+ ```
333
+ #### assemble bundle and send to arweave network
334
+ You can send items directly to the arweave network
335
+ ``` go
334
336
337
+ items := []types.BundleItem {item01, item02, item03 ...}
335
338
bundle , err := utils.NewBundle (items...)
336
339
340
+ w , err := goar.NewWalletFromPath (" ./key.json" , arNode)
341
+
342
+ arTxTags := []types.Tags {}{} // option
343
+ tx , err := w.SendBundleTx (bd.BundleBinary , arTxtags)
344
+
337
345
```
338
346
339
- #### Send Item to Bundler
340
- Bundler network provides guaranteed data seeding and instant data accessibility
347
+ #### Send Item to [ Arseeding ] ( https://github.com/everFinance/arseeding ) gateway
348
+ Arseeding provides guaranteed data seeding and instant data accessibility
341
349
``` go
342
- resp , err := w.Client .BatchSendItemToBundler (items," " ) // The second parameter is the bundler gateway url,"" means use default url
350
+ arseedUrl := " https://seed.everpay.io"
351
+ currency := " USDC" // used for payment fee currency
352
+ resp , err := utils.SubmitItemToArSeed (item01,currency,arseedUrl)
343
353
```
344
354
345
- #### Send Bundle Tx
355
+ #### Send Item to Bundler gateway
356
+ Bundler provides guaranteed data seeding and instant data accessibility
346
357
``` go
347
- tx , err := w.SendBundleTx (bd.BundleBinary , arTxtags)
358
+ bundlrUrl := " https://node1.bundlr.network"
359
+ resp , err := utils.SubmitItemToBundlr (item01, bundlrUrl)
348
360
```
349
361
350
- #### Get Bundle and Verify
362
+ #### Verify Bundle Items
351
363
``` go
352
- id := " lt24bnUGms5XLZeVamSPHePl4M2ClpLQyRxZI7weH1k"
353
- bundle , err := cli.GetBundle (id)
354
364
355
365
// verify
356
366
for _ , item := range bundle.Items {
357
367
err = utils.VerifyBundleItem (item)
358
368
assert.NoError (t, err)
359
369
}
360
370
```
371
+ check [ bundle example] ( ./example/bundle_test.go )
361
372
362
- ### notice
363
- if you call ` w.Client.BatchSendItemToBundler(items,"") `
373
+ #### About Arseeding
374
+ if you can ` utils.SubmitItemToArseed(item,currency,arseedUrl) `
375
+ and you will get the following return response
376
+ ``` go
377
+ {
378
+ " ItemId" : " 5rEb7c6OjMQIYjl6P7AJIb4bB9CLMBSxhZ9N7BVbRCk" ,
379
+ " bundler" : " Fkj5J8CDLC9Jif4CzgtbiXJBnwXLSrp5AaIllleH_yY" ,
380
+ " currency" : " USDT" ,
381
+ " decimals" : 6 ,
382
+ " fee" : " 701" ,
383
+ " paymentExpiredTime" : 1656044994 ,
384
+ " expectedBlock" : 960751
385
+ }
386
+ ```
387
+ After you transfer 0.000701 USDT to bundler using everpay, arseeding will upload the item to arweave.
388
+ For more usage, jump to [ docs] ( https://github.com/everFinance/arseeding/blob/main/README.md )
389
+
390
+ #### About Bundlr
391
+ if you call ` utils.SubmitItemToBundlr(item,bundlrUrl) `
364
392
and return ` panic: send to bundler request failed; http code: 402 `
365
393
means that you have to pay ar to the bundler service address
366
394
must use item signature address to transfer funds
@@ -371,13 +399,28 @@ curl --location --request GET 'https://node1.bundlr.network/info'
371
399
372
400
response:
373
401
{
374
- " uptime" : 275690.552536824 ,
375
- " address" : " OXcT1sVRSA5eGwt2k6Yuz8-3e3g9WJi5uSE99CWqsBs" ,
376
- " gateway" : " arweave.net"
402
+ " version" : " 0.2.0" ,
403
+ " addresses" : {
404
+ " arweave" : " OXcT1sVRSA5eGwt2k6Yuz8-3e3g9WJi5uSE99CWqsBs" ,
405
+ " ethereum" : " 0xb4DE0833771eae55040b698aF5eB06d59E142C82" ,
406
+ " matic" : " 0xb4DE0833771eae55040b698aF5eB06d59E142C82" ,
407
+ " bnb" : " 0xb4DE0833771eae55040b698aF5eB06d59E142C82" ,
408
+ " avalanche" : " 0xb4DE0833771eae55040b698aF5eB06d59E142C82" ,
409
+ " solana" : " DHyDV2ZjN3rB6qNGXS48dP5onfbZd3fAEz6C5HJwSqRD" ,
410
+ " arbitrum" : " 0xb4DE0833771eae55040b698aF5eB06d59E142C82" ,
411
+ " boba-eth" : " 0xb4DE0833771eae55040b698aF5eB06d59E142C82" ,
412
+ " boba" : " 0xb4DE0833771eae55040b698aF5eB06d59E142C82" ,
413
+ " chainlink" : " 0xb4DE0833771eae55040b698aF5eB06d59E142C82" ,
414
+ " kyve" : " 0xb4DE0833771eae55040b698aF5eB06d59E142C82" ,
415
+ " fantom" : " 0xb4DE0833771eae55040b698aF5eB06d59E142C82" ,
416
+ " near" : " bundlr1.near" ,
417
+ " algorand" : " DL7ZTTQMTFNXRF3367OTSNAZ3L2X676OJ4GGB3DXMUJ37CCKJ5RJMEO6RI"
418
+ },
419
+ " gateway" : " arweave.net"
377
420
}
378
421
```
379
- This "address" is the bundler service receive ar address.
380
- You need to transfer a certain amount of ar to this address
422
+ This "addresses" are the bundler service receive address.
423
+ You need to transfer a certain amount of token to this address
381
424
and wait for 25 blocks to confirm the transaction before you can use the bundler service.
382
425
383
426
You can also use the following api to query the balance in the bundler service.
0 commit comments